This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/17935] Two consecutive movzbl are generated
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 May 2005 10:07:21 -0000
- Subject: [Bug rtl-optimization/17935] Two consecutive movzbl are generated
- References: <20041011163842.17935.kazu@cs.umass.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From uros at kss-loka dot si 2005-05-13 10:07 -------
I think there is another optimization opportunity regarding movzbl following andl.
Consider this part:
movb (%eax), %al EAX = x...xbbbbbbbb
andl $1, %eax EAX = 0...00000000b
movzbl %al, %eax (not needed)
ret
If the value of the constant to andl operator is less than 2 ^ bit width of the
register we would like to extend, then andl instruction inherently performs
zero-extension.
So if the xorl in comment #5 is moved before andl, we could apply above
simplification to get:
movb (%eax), %al
xorl $1, %eax
andl $1, %eax
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17935