avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Building AVRGCC on an AMD64-Box fails


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Building AVRGCC on an AMD64-Box fails
Date: Thu, 15 Apr 2004 09:53:20 +0200 (MET DST)

address@hidden (Joerg Wunsch) wrote:

>> Here http://matwei.callisto.twam.info/fixunsdfsi.tar.gz is the complete 
>> file. The interesting lines are
>> 
>>      ldi r18,lo8(0xffffffffcf000000)
>>      ldi r19,hi8(0xffffffffcf000000)
>>      ldi r20,hlo8(0xffffffffcf000000)
>>      ldi r21,hhi8(0xffffffffcf000000)
> 
> Hmm.

On an IA32 box, this shows as:

..LM3:
        ldi r18,lo8(0xcf000000)
        ldi r19,hi8(0xcf000000)
        ldi r20,hlo8(0xcf000000)
        ldi r21,hhi8(0xcf000000)

> is a lot of preprocessor magic around.  Next try: run the command
> again, but this time using a -E option instead of -S (and set the
> output file name to end in .i, which is the conventional suffix for
> preprocessed C source files).  Just try to see how the various
> constants used there (Wtype_MIN etc.) resolve.  Perhaps they resolve
> to 64-bit constants (suffix LL or ULL) when they ought to resolve to
> 32-bit constants while compiling for the AVR target.

For comparision, this is the preprocessed output on an IA32 host:

USItype
__fixunsdfsi (DFtype a)
{
  if (a >= - (DFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
    return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1)) 
- (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1);
  return (SItype) a;
}

USItype is `unsigned int'
SItype is `int'
DFtype is `float'

I've added the following piece of code for verification:

 static volatile size_t usi, si, df;
 usi = sizeof(USItype);
 si = sizeof(SItype);
 df = sizeof(DFtype);

....and analyzed the compiled assembler code.  usi is 4, si is 4, df is
4 (so it's sure that all types are evaluated in the target CPU's
context).

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]