Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!amdcad!tim From: tim@amdcad.AMD.COM (Tim Olson) Newsgroups: comp.arch Subject: Re: AM29000 Booleans Message-ID: <16587@amdcad.AMD.COM> Date: Thu, 7-May-87 12:07:22 EDT Article-I.D.: amdcad.16587 Posted: Thu May 7 12:07:22 1987 Date-Received: Sat, 9-May-87 04:43:12 EDT References: <1270@aw.sei.cmu.edu> <138@neptune.AMD.COM> <3540@spool.WISC.EDU> Organization: Advanced Micro Devices, Inc., Sunnyvale, Ca. Lines: 71 In article <3540@spool.WISC.EDU>, lm@cottage.WISC.EDU (Larry McVoy) writes: > In article <138@neptune.AMD.COM> brian@neptune.AMD.COM (Brian McMinn) writes: > > > >No, this is not a typo. All negative numbers are regarded as Boolean > >TRUE. Although this does not correspond with the "C" language > >definition of TRUE, it did gain some speed in the hardware. Since > > Could you please show the assembly language generated for the following, > > { int x; > > if (x) > ; > else > ; > > if (!x) > ; > else > ; > } > > And tell me which will be executed for x = -1, 0, 1. I think you may be confusing Am29000 Booleans with 'C' Booleans. They are two different animals, and when code is generated from C programs, comparison instructions (usually) must be used to create the correct Am29000 Boolean. For example, the above code fragment compiles to: --------------------------------------- .global _main _main: .align ; if (x) cpneq gr72,gr70,0 <-- sets the msb of gr72 if gr70 != 0 jmpf gr72,$16 <-- jumps if the msb of gr72 is not set nop ; y = 0; jmp $17 <-- remember those delayed branches! const gr71,0 $16: ; else ; y = 1; const gr71,1 $17: ; if (!x) cpeq gr72,gr70,0 jmpf gr72,$18 nop ; y = 0; jmp $19 const gr71,0 $18: ; else ; y = 1; const gr71,1 $19: jmpi lr00 nop ---------------------------------------------- The code execution would be just what you expect (and what is required of C) for all values of x. -- Tim Olson Advanced Micro Devices Processor Strategic Planning