ray@ntmtka.mn.org (ray) (02/10/90)
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.
Does anybody have any ideas where to start looking in the compiler code?
Please use email.
Thanks in advance.
--
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus}!esegue. Meta-mail to compilers-request@esegue.
Please send responses to the author of the message, not the poster.
gsarff@sarek.UUCP (Gary Sarff) (02/18/90)
In article <1990Feb10.035315.1140@esegue.segue.boston.ma.us>, ray@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. > > >Does anybody have any ideas where to start looking in the compiler code? >Please use email. > >Thanks in advance. 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?
thomas@uplog.se (Thomas Tornblom) (02/19/90)
In article <00392@sarek.UUCP> gsarff@sarek.UUCP (Gary Sarff) writes: In article <1990Feb10.035315.1140@esegue.segue.boston.ma.us>, ray@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@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden