[comp.sys.m88k] 88000 assembly code

hogue@hsi.UUCP (Jim Hogue) (07/27/90)

I am having troule with the gnu C compiler on an AViiON.  Specifically
I am running DG-UX (version 4.30) and with the optimiser on, the
compiler produces code that the assembler barfs on.  The function is
rather large and I would like to narrow it down before I ask for
detailed help.  But in the mean time I don't have any knowledge of nor
texts that describe the 88000 assembler.  Question is what does br.n
addr do?  Is it an unconditional branch or is it branch not equal to 0
or something else?  As usual help is greatly appreaciated!

FYI, from memory the code generated is something like

	br.n	addr1
	or	r1,r2,r3,0x1234
addrn	add	r10,r2,0x400

The assembler complains that or instructions cannot have 4 operands!
-- 
I told them to arrest those women laying on the lawn.
They made me wreck my car because they didn't have any clothes on!  -CW song
Jim Hogue   hogue@hsi.com or {uunet, yale}!hsi!hogue

jkenton@pinocchio.encore.com (Jeff Kenton) (07/27/90)

From article <1872@hsi86.hsi.UUCP>, by hogue@hsi.UUCP (Jim Hogue):
> I am having troule with the gnu C compiler on an AViiON.  Specifically
> I am running DG-UX (version 4.30) and with the optimiser on, the
> compiler produces code that the assembler barfs on.  The function is
> rather large and I would like to narrow it down before I ask for
> detailed help.  But in the mean time I don't have any knowledge of nor
> texts that describe the 88000 assembler.  Question is what does br.n
> addr do?  Is it an unconditional branch or is it branch not equal to 0
> or something else?  As usual help is greatly appreaciated!
> 
> FYI, from memory the code generated is something like
> 
> 	br.n	addr1
> 	or	r1,r2,r3,0x1234
> addrn	add	r10,r2,0x400
> 
> The assembler complains that or instructions cannot have 4 operands!

The assembler is right (naturally) -- the compiler is producing broken
code.  "or" instructions, and many others, have only 3 operands.  None
has 4 operands, although some have 1 or 2 (or none).

The br.n instruction is an unconditional branch.  The ".n" causes the
"next" instruction (physically after the br.n) to be executed before
doing the branch.










- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      jeff kenton  ---	temporarily at jkenton@pinocchio.encore.com	 
		   ---  always at (617) 894-4508  ---
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

jat@xavax.com (John Tamplin) (07/28/90)

In article <1872@hsi86.hsi.UUCP> hogue@hsi.UUCP (Jim Hogue) writes:
 >I am having troule with the gnu C compiler on an AViiON.  Specifically
 >I am running DG-UX (version 4.30) and with the optimiser on, the
 >compiler produces code that the assembler barfs on.  The function is
 >rather large and I would like to narrow it down before I ask for
 >detailed help.  But in the mean time I don't have any knowledge of nor
 >texts that describe the 88000 assembler.  Question is what does br.n
 >addr do?  Is it an unconditional branch or is it branch not equal to 0
 >or something else?  As usual help is greatly appreaciated!
 >
 >FYI, from memory the code generated is something like
 >
 >	br.n	addr1
 >	or	r1,r2,r3,0x1234
 >addrn	add	r10,r2,0x400
 >
 >The assembler complains that or instructions cannot have 4 operands!
 >-- 
 >I told them to arrest those women laying on the lawn.
 >They made me wreck my car because they didn't have any clothes on!  -CW song
 >Jim Hogue   hogue@hsi.com or {uunet, yale}!hsi!hogue

The definitive 88k assembly manual is "MC88100 RISC Microprocessor User's
Manual" available from Motorola.

br.n is an unconditional delayed branch, meaning that the next instruction
is executed before the branch takes place.  The or is definitely incorrect,
since the 88k or instruction takes one register and either another registor
or a 16 bit constant and places the result in a destination register (the
first one in the list).  I have been using DG's port of gcc 1.35 for a while
and I haven't noticed any bad opcodes, but your version might be newer.
gcc -v will tell you the version number.
-- 
John Tamplin						Xavax
jat@xavax.COM						2104 West Ferry Way
...!uunet!xavax!jat					Huntsville, AL 35801