This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/15556] Idiom for "xchg %ah,%al" not recognized


------- Additional Comments From giovannibajo at libero dot it  2004-05-21 01:05 -------
Notice that if you use 32bit words, it works:

------------------------------------------------------------------
#define regparm __attribute__((regparm(3)))
unsigned regparm a(unsigned x) { return (x << 24) | (x >> 8); }
unsigned regparm b(unsigned x) { return (x >> 24) | (x << 8); }
------------------------------------------------------------------

_Z1aj:
.LFB2:
 rorl $8, %eax
 ret

_Z1bj:
.LFB3:
 rorl $24, %eax
 ret

Since the optimization is done in fold-const (look for "bit_rotate"), maybe the 
bug is there, rather than in target-specific code.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15556


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]