[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    [Bug rtl-optimization/78952] Combine does not convert 8-bit sign-extract to a zero-extract for QImod
From:       "ubizjak at gmail dot com" <gcc-bugzilla () gcc ! gnu ! org>
Date:       2016-12-30 8:37:34
Message-ID: bug-78952-4-xGzGlVyayR () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]

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")])=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic