This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/15556] Idiom for "xchg %ah,%al" not recognized
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 May 2004 01:05:27 -0000
- Subject: [Bug target/15556] Idiom for "xchg %ah,%al" not recognized
- References: <20040520191543.15556.cesarb@nitnet.com.br>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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