Re: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Andreas Schwab
Joakim Tjernlund joakim.tjernl...@transmode.se 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

Re: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
Andreas Schwab sch...@redhat.com wrote on 2011/08/11 10:45:42: Joakim Tjernlund joakim.tjernl...@transmode.se 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

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread David Laight
Joakim Tjernlund joakim.tjernl...@transmode.se 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

RE: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
David Laight david.lai...@aculab.com wrote on 2011/08/11 10:56:26: Joakim Tjernlund joakim.tjernl...@transmode.se 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

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: [RFC] Optimize __arch_swab32 and __arch_swab16

2011-08-11 Thread Joakim Tjernlund
David Laight david.lai...@aculab.com 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