On Apr 14, 2011, at 8:50 PM, Eric Decker wrote:

>> And yes, if you did it in assembler, you could use a 20-bit  
>> immediate.
>
>
>> Anyone know how to get 20 bit immediate in gcc extended asm?
>>
>> ie.
>>
>>  __asm__ __volatile__ ("movx.a %1,%0":"=m" (DMA0SA):"i" (0xefefeUL));
>
> Note the immediate field is 0xefefe (20 bits).
>
>>
>> which unfortunately generates...
>>
>>  __asm__ __volatile__ ("movx.a %1,%0":"=m" (DMA0SA):"i" (0xefefeUL));
>>  3b12:    00 18 f2 40 fe fe d2 01     movx.a     
>> #65278,&0x001d2;#0x0fefe

I think what Peter was saying is that this is a limitation of C  
inlining not being able to pass a 20bit constant to the assembler,  
rather than the assembler not being able to use the 20-bit immediate  
value.  It's the compiler side that handles all those magic "-m" and  
"i" modifiers.
You can probably fake it with something like:

#define mov20(dest, srcconst) \
  __asm__ __volatile__ ("movx.a (%1<<16)+%2,  
%0":"=m" (dest):"i" (srcconst>>16): "i"(srcconst & 0xFFFF));

(I'm not familiar enough with the extended MSP430's to actually give  
it a try...)

BillW


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to