https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78952

--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> ---
Another testcase:

--cut here--
extern void foo (void);
extern void bar (void);

struct S1
{
  char pad1;
  char val;
  short pad2;
};

void test (struct S1 a)
{
  if (a.val)
    foo ();
  else
    bar ();
}
--cut here--

Trying 6 -> 7:
Failed to match this instruction:
(set (reg:CCZ 17 flags)
    (compare:CCZ (subreg:QI (sign_extract:SI (reg/v:SI 88 [ a ])
                (const_int 8 [0x8])
                (const_int 8 [0x8])) 0)
        (const_int 0 [0])))

This pattern should match:

(define_insn "*cmpqi_ext_2"
  [(set (reg FLAGS_REG)
        (compare
          (subreg:QI
            (zero_extract:SI
              (match_operand 0 "ext_register_operand" "Q")
              (const_int 8)
              (const_int 8)) 0)
          (match_operand:QI 1 "const0_operand")))]
  "ix86_match_ccmode (insn, CCNOmode)"
  "test{b}\t%h0, %h0"
  [(set_attr "type" "test")
   (set_attr "length_immediate" "0")
   (set_attr "mode" "QI")])

Reply via email to