re PR target/91385 (Zero-extended negation (*negsi2_1_zext) is not generated)
authorUros Bizjak <ubizjak@gmail.com>
Wed, 7 Aug 2019 18:34:11 +0000 (20:34 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 7 Aug 2019 18:34:11 +0000 (20:34 +0200)
PR target/91385
* config/i386/sse.md (*negsi2_1_zext): Simplify insn pattern.
(*negsi2_cmpz_zext): Ditto.

testsuite/ChangeLog:

PR target/91385
* gcc.target/i386/pr91385.c: New test.

From-SVN: r274183

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr91385.c [new file with mode: 0644]

index e4605fcda47128936cf4f3c64a62ef5a6480249d..31f0fece2a112c8d8c73f976f9204678eea41b45 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-07  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/91385
+       * config/i386/sse.md (*negsi2_1_zext): Simplify insn pattern.
+       (*negsi2_cmpz_zext): Ditto.
+
 2019-08-07  Richard Sandiford  <richard.sandiford@arm.com>
 
        * config/aarch64/iterators.md (commutative): Remove.
index e19a591fa9dcd2a64394b75cbe25dc652f5757d0..e0a446d8f1cb82fc937b18e4834354be52adac62 100644 (file)
   [(set_attr "type" "negnot")
    (set_attr "mode" "<MODE>")])
 
-;; Combine is quite creative about this pattern.
 (define_insn "*negsi2_1_zext"
   [(set (match_operand:DI 0 "register_operand" "=r")
-       (lshiftrt:DI
-         (neg:DI (ashift:DI (match_operand:DI 1 "register_operand" "0")
-                            (const_int 32)))
-       (const_int 32)))
+       (zero_extend:DI
+         (neg:SI (match_operand:SI 1 "register_operand" "0"))))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
   "neg{l}\t%k0"
 (define_insn "*negsi2_cmpz_zext"
   [(set (reg:CCZ FLAGS_REG)
        (compare:CCZ
-         (lshiftrt:DI
-           (neg:DI (ashift:DI
-                     (match_operand:DI 1 "register_operand" "0")
-                     (const_int 32)))
-           (const_int 32))
+         (neg:SI (match_operand:SI 1 "register_operand" "0"))
          (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
-       (lshiftrt:DI (neg:DI (ashift:DI (match_dup 1)
-                                       (const_int 32)))
-                    (const_int 32)))]
+       (zero_extend:DI
+         (neg:SI (match_dup 1))))]
   "TARGET_64BIT && ix86_unary_operator_ok (NEG, SImode, operands)"
   "neg{l}\t%k0"
   [(set_attr "type" "negnot")
   [(set_attr "type" "negnot")
    (set_attr "mode" "<MODE>")])
 
-;; ??? Currently never generated - xor is used instead.
 (define_insn "*one_cmplsi2_1_zext"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (zero_extend:DI
              (set (match_dup 1)
                   (xor:SWI (match_dup 3) (const_int -1)))])])
 
-;; ??? Currently never generated - xor is used instead.
 (define_insn "*one_cmplsi2_2_zext"
   [(set (reg FLAGS_REG)
        (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
index e69e59be069922e9680fe0c9ceca142cf4bfb462..a53639841a05b6d0df062f20cbe5eaf70a50f9c8 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-07  Uroš Bizjak  <ubizjak@gmail.com>
+
+       PR target/91385
+       * gcc.target/i386/pr91385.c: New test.
+
 2019-08-07  Marek Polacek  <polacek@redhat.com>
 
        PR c++/81429 - wrong parsing of constructor with C++11 attribute.
diff --git a/gcc/testsuite/gcc.target/i386/pr91385.c b/gcc/testsuite/gcc.target/i386/pr91385.c
new file mode 100644 (file)
index 0000000..f3ff8c8
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -dp" } */
+/* { dg-final { scan-assembler-not "zero_extendsidi" } } */
+
+unsigned long long
+foo (unsigned int a)
+{
+  return -a;
+}