re PR target/78904 (zero-extracts are not effective)
authorUros Bizjak <ubizjak@gmail.com>
Tue, 27 Dec 2016 08:59:04 +0000 (09:59 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 27 Dec 2016 08:59:04 +0000 (09:59 +0100)
PR target/78904
* config/i386/i386.md (*cmpqi_ext_1, *extvqi, *extzvqi): Use
nonimmediate_operand instead of nonimmediate_x64nomem_operand.
(*cmpqi_ext_3, insv<mode>_1, addqi_ext_1, *testqi_ext_1, andqi_ext_1)
(*<any_or:code>qi_ext_1, *xorqi_ext_1_cc): Use general_operand
instead of general_x64nomem_operand.
* config/i386/predicates.md (nonimmediate_x64nomem_operand): Remove.
(general_x64nomem_operand): Ditto.

testsuite/ChangeLog:

PR target/78904
* gcc.target/i386/pr78904-2.c: New test.

From-SVN: r243933

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/config/i386/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr78904-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr78904-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr78904.c [deleted file]

index e7865bdf7b5ab69848854caaa8e1fe6a77a65f12..3b0e8161ae1a57fcb004a8e1bc81a9e81c6f1930 100644 (file)
@@ -1,3 +1,14 @@
+2016-12-27  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78904
+       * config/i386/i386.md (*cmpqi_ext_1, *extvqi, *extzvqi): Use
+       nonimmediate_operand instead of nonimmediate_x64nomem_operand.
+       (*cmpqi_ext_3, insv<mode>_1, addqi_ext_1, *testqi_ext_1, andqi_ext_1)
+       (*<any_or:code>qi_ext_1, *xorqi_ext_1_cc): Use general_operand
+       instead of general_x64nomem_operand.
+       * config/i386/predicates.md (nonimmediate_x64nomem_operand): Remove.
+       (general_x64nomem_operand): Ditto.
+
 2016-12-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/78904
index f3f358326ac446755c8811403527d57f3383e2a7..3fd85974bb5cac86707c869e7dd6aecfdf22f70b 100644 (file)
 (define_insn "*cmpqi_ext_1"
   [(set (reg FLAGS_REG)
        (compare
-         (match_operand:QI 0 "nonimmediate_x64nomem_operand" "Q,m")
+         (match_operand:QI 0 "nonimmediate_operand" "Q,m")
          (subreg:QI
            (zero_extract:SI
              (match_operand 1 "ext_register_operand" "Q,Q")
              (match_operand 0 "ext_register_operand" "Q,Q")
              (const_int 8)
              (const_int 8)) 0)
-         (match_operand:QI 1 "general_x64nomem_operand" "Qn,m")))]
+         (match_operand:QI 1 "general_operand" "Qn,m")))]
   "ix86_match_ccmode (insn, CCmode)"
   "cmp{b}\t{%1, %h0|%h0, %1}"
   [(set_attr "isa" "*,nox64")
    (set_attr "mode" "SI")])
 
 (define_insn "*extvqi"
-  [(set (match_operand:QI 0 "nonimmediate_x64nomem_operand" "=Q,?R,m")
+  [(set (match_operand:QI 0 "nonimmediate_operand" "=Q,?R,m")
         (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q,Q")
                          (const_int 8)
                          (const_int 8)))]
    (set_attr "mode" "SI")])
 
 (define_insn "*extzvqi"
-  [(set (match_operand:QI 0 "nonimmediate_x64nomem_operand" "=Q,?R,m")
+  [(set (match_operand:QI 0 "nonimmediate_operand" "=Q,?R,m")
         (subreg:QI
          (zero_extract:SI (match_operand 1 "ext_register_operand" "Q,Q,Q")
                           (const_int 8)
   [(set (zero_extract:SWI248 (match_operand 0 "ext_register_operand" "+Q,Q")
                             (const_int 8)
                             (const_int 8))
-       (match_operand:SWI248 1 "general_x64nomem_operand" "Qn,m"))]
+       (match_operand:SWI248 1 "general_operand" "Qn,m"))]
   ""
 {
   if (CONST_INT_P (operands[1]))
              (zero_extract:SI (match_operand 1 "ext_register_operand" "0,0")
                               (const_int 8)
                               (const_int 8)) 0)
-           (match_operand:QI 2 "general_x64nomem_operand" "Qn,m")) 0))
+           (match_operand:QI 2 "general_operand" "Qn,m")) 0))
    (clobber (reg:CC FLAGS_REG))]
   ""
 {
              (zero_extract:SI (match_operand 0 "ext_register_operand" "Q,Q")
                               (const_int 8)
                               (const_int 8)) 0)
-           (match_operand:QI 1 "general_x64nomem_operand" "Qn,m"))
+           (match_operand:QI 1 "general_operand" "Qn,m"))
          (const_int 0)))]
   "ix86_match_ccmode (insn, CCNOmode)"
   "test{b}\t{%1, %h0|%h0, %1}"
              (zero_extract:SI (match_operand 1 "ext_register_operand" "0,0")
                               (const_int 8)
                               (const_int 8)) 0)
-           (match_operand:QI 2 "general_x64nomem_operand" "Qn,m")) 0))
+           (match_operand:QI 2 "general_operand" "Qn,m")) 0))
    (clobber (reg:CC FLAGS_REG))]
   ""
   "and{b}\t{%2, %h0|%h0, %2}"
              (zero_extract:SI (match_operand 1 "ext_register_operand" "0,0")
                               (const_int 8)
                               (const_int 8)) 0)
-           (match_operand:QI 2 "general_x64nomem_operand" "Qn,m")) 0))
+           (match_operand:QI 2 "general_operand" "Qn,m")) 0))
    (clobber (reg:CC FLAGS_REG))]
   "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)"
   "<logic>{b}\t{%2, %h0|%h0, %2}"
              (zero_extract:SI (match_operand 1 "ext_register_operand" "0,0")
                               (const_int 8)
                               (const_int 8)) 0)
-           (match_operand:QI 2 "general_x64nomem_operand" "Qn,m"))
+           (match_operand:QI 2 "general_operand" "Qn,m"))
          (const_int 0)))
    (set (zero_extract:SI (match_operand 0 "ext_register_operand" "=Q,Q")
                         (const_int 8)
index eb985983ff6078a1862f9107d44149a489e91b1c..b2d847e991fbbfaf1acd54797caadc37dbad7c28 100644 (file)
          && (REGNO (op) > LAST_VIRTUAL_REGISTER || QI_REGNO_P (REGNO (op))));
 })
 
-;; Match nonimmediate operands, but exclude memory operands on 64bit targets.
-(define_predicate "nonimmediate_x64nomem_operand"
-  (if_then_else (match_test "TARGET_64BIT")
-    (match_operand 0 "register_operand")
-    (match_operand 0 "nonimmediate_operand")))
-
-;; Match general operands, but exclude memory operands on 64bit targets.
-(define_predicate "general_x64nomem_operand"
-  (if_then_else (match_test "TARGET_64BIT")
-    (match_operand 0 "nonmemory_operand")
-    (match_operand 0 "general_operand")))
-
 ;; Match register operands, but include memory operands for TARGET_SSE_MATH.
 (define_predicate "register_ssemem_operand"
   (if_then_else
index 31f0e4345839b8c066b37d2468ece6c7f921ec93..fc9233a21bb9a921e8d1f3ba2219b80d3fb9779d 100644 (file)
@@ -1,7 +1,12 @@
+2016-12-27  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78904
+       * gcc.target/i386/pr78904-2.c: New test.
+
 2016-12-26  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/78904
-       * gcc.target/i386/pr78904.c: New test.
+       * gcc.target/i386/pr78904-1.c: New test.
 
 2016-12-23  Andre Vehreschild  <vehre@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gcc.target/i386/pr78904-1.c b/gcc/testsuite/gcc.target/i386/pr78904-1.c
new file mode 100644 (file)
index 0000000..d27d7fd
--- /dev/null
@@ -0,0 +1,48 @@
+/* PR target/78904 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+/* { dg-final { scan-assembler-not "movzbl" } } */
+/* { dg-final { scan-assembler-not "movb" } } */
+
+struct S1
+{
+  unsigned char pad1;
+  unsigned char val;
+  unsigned short pad2;
+};
+
+struct S1 test_and (struct S1 a, struct S1 b)
+{
+  a.val &= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]andb" } } */
+
+struct S1 test_or (struct S1 a, struct S1 b)
+{
+  a.val |= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]orb" } } */
+
+struct S1 test_xor (struct S1 a, struct S1 b)
+{
+  a.val ^= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]xorb" } } */
+
+struct S1 test_add (struct S1 a, struct S1 b)
+{
+  a.val += b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]addb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr78904-2.c b/gcc/testsuite/gcc.target/i386/pr78904-2.c
new file mode 100644 (file)
index 0000000..03792b0
--- /dev/null
@@ -0,0 +1,48 @@
+/* PR target/78904 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+
+struct S1
+{
+  unsigned char pad1;
+  unsigned char val;
+  unsigned short pad2;
+};
+
+extern struct S1 t;
+
+struct S1 test_and (struct S1 a, struct S1 b)
+{
+  a.val &= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]andb\[^\n\r]*, %.h" } } */
+
+struct S1 test_or (struct S1 a, struct S1 b)
+{
+  a.val |= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]orb\[^\n\r]*, %.h" } } */
+
+struct S1 test_xor (struct S1 a, struct S1 b)
+{
+  a.val ^= b.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]xorb\[^\n\r]*, %.h" } } */
+
+struct S1 test_add (struct S1 a, struct S1 b)
+{
+  a.val += t.val;
+
+  return a;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]addb\[^\n\r]*, %.h" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr78904.c b/gcc/testsuite/gcc.target/i386/pr78904.c
deleted file mode 100644 (file)
index d27d7fd..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* PR target/78904 */
-/* { dg-do compile } */
-/* { dg-options "-O2 -masm=att" } */
-/* { dg-final { scan-assembler-not "movzbl" } } */
-/* { dg-final { scan-assembler-not "movb" } } */
-
-struct S1
-{
-  unsigned char pad1;
-  unsigned char val;
-  unsigned short pad2;
-};
-
-struct S1 test_and (struct S1 a, struct S1 b)
-{
-  a.val &= b.val;
-
-  return a;
-}
-
-/* { dg-final { scan-assembler "\[ \t\]andb" } } */
-
-struct S1 test_or (struct S1 a, struct S1 b)
-{
-  a.val |= b.val;
-
-  return a;
-}
-
-/* { dg-final { scan-assembler "\[ \t\]orb" } } */
-
-struct S1 test_xor (struct S1 a, struct S1 b)
-{
-  a.val ^= b.val;
-
-  return a;
-}
-
-/* { dg-final { scan-assembler "\[ \t\]xorb" } } */
-
-struct S1 test_add (struct S1 a, struct S1 b)
-{
-  a.val += b.val;
-
-  return a;
-}
-
-/* { dg-final { scan-assembler "\[ \t\]addb" } } */