Re: Inline assembly and ldm/stm

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

 



Ian Lance Taylor writes:
 > "Bryce Schober" <bryce.schober@xxxxxxxxxxxxxxxxx> writes:
 > 
 > > So how should I go about wrapping ldm / stm for usage in C land?
 > > 
 > > I tried:
 > > 
 > > typedef struct
 > > {
 > >     UNS_32 reg[2];
 > > } arm_2_registers_t;
 > > 
 > > static inline
 > > arm_2_registers_t arm_2_registers_load(
 > >     UNS_32 *src_addr_ptr )
 > > {
 > >     arm_2_registers_t result;
 > >     __asm__ (
 > >         "ldmia    %0, {%1,%2}    \n\t"
 > >         : "+r" (src_addr_ptr), "=r" (result.reg[0]), "=r" (result.reg[1])
 > >     );
 > >     return( result );
 > > }
 > > 
 > > That seems to work fine until the compiler decides to use registers
 > > for %1 and %2 that aren't in ascending order. I've examined the
 > > assembly constraints and I don't see anything obvious.
 > 
 > There is in general no way to do that.

Sure, but there's nothing to stop him picking two named register
variables.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux