------- 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

Reply via email to