Re: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Andreas Schwab
Joakim Tjernlund writes: > unsigned short my__arch_swab16(unsigned short value) > { > __asm__("rlwimi %0,%0,16,0x00ff" > : "+r" (value)); You are creating a value that does not fit in a short. Andreas. -- Andreas Schwab, sch...@redhat.com GPG Key fingerprint = D4E8 DBE

Re: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
Andreas Schwab wrote on 2011/08/11 10:45:42: > > Joakim Tjernlund writes: > > > unsigned short my__arch_swab16(unsigned short value) > > { > >__asm__("rlwimi %0,%0,16,0x00ff" > > : "+r" (value)); > > You are creating a value that does not fit in a short. Short is passed in a 32 bit

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread David Laight
> Joakim Tjernlund writes: > > > unsigned short my__arch_swab16(unsigned short value) > > { > > __asm__("rlwimi %0,%0,16,0x00ff" > > : "+r" (value)); > > You are creating a value that does not fit in a short. Which is a problem because the compiler could schedule it be writt

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
"David Laight" wrote on 2011/08/11 10:56:26: > > > Joakim Tjernlund writes: > > > > > unsigned short my__arch_swab16(unsigned short value) > > > { > > >__asm__("rlwimi %0,%0,16,0x00ff" > > > : "+r" (value)); > > > > You are creating a value that does not fit in a short. > > Which is

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread David Laight
> > Which is a problem because the compiler could schedule > > it be written back to real memory between the instructions. > > It can? There is no memory here, just registers. Even if it > is written to memory, how would that affect the register? Although the function argument is passed in a re

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
"David Laight" wrote on 2011/08/11 11:29:33: > > > > > Which is a problem because the compiler could schedule > > > it be written back to real memory between the instructions. > > > > It can? There is no memory here, just registers. Even if it > > is written to memory, how would that affect the re