re PR target/78904 (zero-extracts are not effective)
authorUros Bizjak <ubizjak@gmail.com>
Thu, 29 Dec 2016 21:41:07 +0000 (22:41 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 29 Dec 2016 21:41:07 +0000 (22:41 +0100)
PR target/78904
* config/i386/i386.md (*extvqi): Remove insn pattern.
(divmodqi4): Update expander to generate QImode zero-extract from AH.

testsuite/ChangeLog:

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

From-SVN: r243968

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

index ae62a53ef01531386dfb281bf1d4adb81a71249a..517c50511d9762c369a503acbabffe3d0b14255d 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-29  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78904
+       * config/i386/i386.md (*extvqi): Remove insn pattern.
+       (divmodqi4): Update expander to generate QImode zero-extract from AH.
+
 2016-12-29  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (altivec_expand_builtin): Fix typos in
 2016-12-29  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (altivec_expand_builtin): Fix typos in
index cf9dc03ba8b2640503e7ee28a272c53e96b202d6..0f0bf7a393af8bfafe6e7755b94f51d97aed519f 100644 (file)
   [(set_attr "type" "imovx")
    (set_attr "mode" "SI")])
 
   [(set_attr "type" "imovx")
    (set_attr "mode" "SI")])
 
-(define_insn "*extvqi"
-  [(set (match_operand:QI 0 "nonimmediate_operand" "=QBc,?R,m")
-        (sign_extract:QI (match_operand 1 "ext_register_operand" "Q,Q,Q")
-                         (const_int 8)
-                         (const_int 8)))]
-  ""
-{
-  switch (get_attr_type (insn))
-    {
-    case TYPE_IMOVX:
-      return "movs{bl|x}\t{%h1, %k0|%k0, %h1}";
-    default:
-      return "mov{b}\t{%h1, %0|%0, %h1}";
-    }
-}
-  [(set_attr "isa" "*,*,nox64")
-   (set (attr "type")
-     (if_then_else (and (match_operand:QI 0 "register_operand")
-                       (ior (not (match_operand:QI 0 "QIreg_operand"))
-                            (match_test "TARGET_MOVX")))
-       (const_string "imovx")
-       (const_string "imov")))
-   (set (attr "mode")
-     (if_then_else (eq_attr "type" "imovx")
-       (const_string "SI")
-       (const_string "QI")))])
-
 (define_expand "extzv<mode>"
   [(set (match_operand:SWI248 0 "register_operand")
        (zero_extract:SWI248 (match_operand:SWI248 1 "register_operand")
 (define_expand "extzv<mode>"
   [(set (match_operand:SWI248 0 "register_operand")
        (zero_extract:SWI248 (match_operand:SWI248 1 "register_operand")
   emit_insn (gen_divmodhiqi3 (tmp0, tmp1, operands[2]));
 
   /* Extract remainder from AH.  */
   emit_insn (gen_divmodhiqi3 (tmp0, tmp1, operands[2]));
 
   /* Extract remainder from AH.  */
-  tmp1 = gen_rtx_SIGN_EXTRACT (QImode, tmp0, GEN_INT (8), GEN_INT (8));
+  tmp1 = gen_rtx_ZERO_EXTRACT (SImode, tmp0, GEN_INT (8), GEN_INT (8));
+  tmp1 = gen_rtx_SUBREG (QImode, tmp1, 0);
   rtx_insn *insn = emit_move_insn (operands[3], tmp1);
 
   mod = gen_rtx_MOD (QImode, operands[1], operands[2]);
   rtx_insn *insn = emit_move_insn (operands[3], tmp1);
 
   mod = gen_rtx_MOD (QImode, operands[1], operands[2]);
index 46d47323d690f79936b7ca8ac8071c5c36f1f28c..dc47c623376589ac334ec1d3d25682d72208983a 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-29  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/78904
+       * gcc.target/i386/pr78904-6.c: New test.
+
 2016-12-29  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.target/i386/mpx/memcpy-1.c: Include mpx-check.h.
 2016-12-29  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.target/i386/mpx/memcpy-1.c: Include mpx-check.h.
diff --git a/gcc/testsuite/gcc.target/i386/pr78904-6.c b/gcc/testsuite/gcc.target/i386/pr78904-6.c
new file mode 100644 (file)
index 0000000..2fad223
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR target/78904 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -masm=att" } */
+
+typedef __SIZE_TYPE__ size_t;
+
+struct S1
+{
+  char pad1;
+  char val;
+  short pad2;
+};
+
+extern char t[256];
+
+void foo (struct S1 a, size_t i)
+{
+  t[i] = a.val;
+}
+
+/* { dg-final { scan-assembler "\[ \t\]movb\[\t \]*%.h," } } */