C Compiler for Unix V.2 Motorola 68020 Port

Thomas Tornblom thomas at uplog.se
Mon Feb 19 20:22:20 AEST 1990


In article <00392 at sarek.UUCP> gsarff at sarek.UUCP (Gary Sarff) writes:

   In article <1990Feb10.035315.1140 at esegue.segue.boston.ma.us>, ray at ntmtka.mn.org (ray) writes:
   >I am having a problem compiling the following source:
   >
   >main()
   >{
   >	long	x;
   >	double	y;
   >
   >	x = -((long) y);
   >}
   >
   >The faulty generated assembler code is :
   > 
   >	fneg.d((S%1-12).w,%fp),%d0
   >
   >The %d0 is obviously wrong.  This should be a floating poing register.

   I compiled this on my 68020 machine with no-optimization to see what it
   was "thinking" and got the following assembler code
	   ;trunc2	d:-12(a6),l:d0
	   fintrz.d	-12(a6),fp2
	   fmove.l	fp2,d0
	   neg.l	d0
	   move.l	d0,-4(a6)

   I don't understand your question, the %d0 is not obviously wrong, "x" is
   _not_ a floating point variable so why should the destination be a floating
   point register?  Am I misunderstanding you here or what?

Yes you are.
Your problem is that you aren't using the same compiler, which is obvious from
the syntax of the output.
Rays problem is that the compiler emits assembly code that isn't legal.
You cannot do a 'fneg.d' and have anything other than a float register as the
destination. We are also using the Motorola PCC based C compiler and I got
the same output.

-- 
Real life:	Thomas Tornblom		Email:	thomas at uplog.se
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden



More information about the Comp.lang.c mailing list