This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/45434] x86 missed optimization: use high register (ah, bh, ch, dh) when available to make comparisons
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2010 18:59:44 -0000
- Subject: [Bug rtl-optimization/45434] x86 missed optimization: use high register (ah, bh, ch, dh) when available to make comparisons
- References: <bug-45434-17273@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from ubizjak at gmail dot com 2010-08-29 18:59 -------
(In reply to comment #3)
> Combine seems to prefer LSHIFTRT over ZERO_EXTRACT.
It seems so. Slightly changed testcase:
char test(int a, int b, int i, int j)
{
return (i & 0xFF) == ((j & 0xFF00) >> 8);
}
and changed "*cmpqi_ext_3_insn_rex64" pattern:
(define_insn "*cmpqi_ext_3_insn_rex64"
[(set (reg FLAGS_REG)
(compare
(subreg:QI
(lshiftrt:SI
;; (zero_extract:SI
(match_operand 0 "ext_register_operand" "Q")
;; (const_int 8)
(const_int 8)) 0)
(match_operand:QI 1 "nonmemory_operand" "Qn")))]
"TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
"cmp{b}\t{%1, %h0|%h0, %1}"
[(set_attr "type" "icmp")
(set_attr "modrm" "1")
(set_attr "mode" "QI")])
result in:
cmpb %dl, %ch
sete %al
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45434