Existing splitter is not able to split const_vector 0 as
general_operand predicate matches only scalar zeros.

2018-10-10  Uros Bizjak  <ubiz...@gmail.com>

    PR target/87573
    * config/i386/mmx.md (const_vector 0 -> mem splitter): New splitter.

testsuite/ChangeLog:

2018-10-10  Uros Bizjak  <ubiz...@gmail.com>

    PR target/87573
    * gcc.target/i386/pr87573.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN.

Uros.
Index: config/i386/mmx.md
===================================================================
--- config/i386/mmx.md  (revision 265018)
+++ config/i386/mmx.md  (working copy)
@@ -217,11 +217,18 @@
 
 (define_split
   [(set (match_operand:MMXMODE 0 "nonimmediate_gr_operand")
-        (match_operand:MMXMODE 1 "general_gr_operand"))]
+        (match_operand:MMXMODE 1 "nonimmediate_gr_operand"))]
   "!TARGET_64BIT && reload_completed"
   [(const_int 0)]
   "ix86_split_long_move (operands); DONE;")
 
+(define_split
+  [(set (match_operand:MMXMODE 0 "nonimmediate_gr_operand")
+        (match_operand:MMXMODE 1 "const0_operand"))]
+  "!TARGET_64BIT && reload_completed"
+  [(const_int 0)]
+  "ix86_split_long_move (operands); DONE;")
+
 (define_expand "movmisalign<mode>"
   [(set (match_operand:MMXMODE 0 "nonimmediate_operand")
        (match_operand:MMXMODE 1 "nonimmediate_operand"))]
Index: testsuite/gcc.target/i386/pr87573.c
===================================================================
--- testsuite/gcc.target/i386/pr87573.c (nonexistent)
+++ testsuite/gcc.target/i386/pr87573.c (working copy)
@@ -0,0 +1,12 @@
+/* PR target/87573 */
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O1 -mmmx -mno-sse" } */
+
+typedef char __v8qi __attribute__((vector_size(8)));
+
+__v8qi e;
+
+void f (void)
+{
+  e = (__v8qi) {0, 0, 0, 0, 0, 0, 0, 0};
+}

Reply via email to