Code Generation

Thomas H{meenaho thomas at kuling.UUCP
Thu Dec 5 15:51:20 AEST 1985


In article <462 at graffiti.UUCP> peter at graffiti.UUCP (Peter da Silva) writes:

>The registers are not wide enough to hold a double. Also, you cannot
>just change the flavors of the instructions. Consider a case where
>{ register short i; register long j; short c; } are in registers. Perform
>{ i=c; ... j=i; }. You have to do more than move the low word of the register.
>You have to either explicitly clear the high word of i when you store
>c in it, have explicitly cleared it when you entered the block, or clear
>the high word of j after doing a 16-bit move from i to j.
>-- 

With that declaration of the register variables it is wrong to merely clear the
high bits.
Remember that they were implicitly declared as signed and you must therefore
sign extend them at some time. If that is done before the move or after doesn't
matter as long as it gets done.-- 
Thomas Hameenaho, Dept. of Computer Science, Uppsala University, Sweden
Phone: +46 18 138650
UUCP: thomas at kuling.UUCP (...!{seismo,mcvax}!enea!kuling!thomas)



More information about the Comp.lang.c mailing list