arm: Require MVE memory operand for destination of vst1q intrinsic
authorJoe Ramsay <Joe.Ramsay@arm.com>
Wed, 19 Aug 2020 12:34:06 +0000 (12:34 +0000)
committerJoe Ramsay <joe.ramsay@arm.com>
Thu, 20 Aug 2020 15:27:09 +0000 (15:27 +0000)
Previously, the machine description patterns for vst1q accepted a generic memory
operand for the destination, which could lead to an unrecognised builtin when
expanding vst1q* intrinsics. This change fixes the pattern to only accept MVE
memory operands.

gcc/ChangeLog:

PR target/96683
* config/arm/mve.md (mve_vst1q_f<mode>): Require MVE memory operand for
destination.
(mve_vst1q_<supf><mode>): Likewise.

gcc/testsuite/ChangeLog:

PR target/96683
* gcc.target/arm/mve/intrinsics/vst1q_f16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_s8.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u16.c: New test.
* gcc.target/arm/mve/intrinsics/vst1q_u8.c: New test.

gcc/config/arm/mve.md
gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_f16.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s16.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_s8.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u16.c
gcc/testsuite/gcc.target/arm/mve/intrinsics/vst1q_u8.c

index 9758862ac2bb40805dc5b66c9b05466fffcf91df..465b39a51b3a258295ed764f0e742932e5d59225 100644 (file)
   [(set_attr "length" "4")])
 
 (define_expand "mve_vst1q_f<mode>"
-  [(match_operand:<MVE_CNVT> 0 "memory_operand")
+  [(match_operand:<MVE_CNVT> 0 "mve_memory_operand")
    (unspec:<MVE_CNVT> [(match_operand:MVE_0 1 "s_register_operand")] VST1Q_F)
   ]
   "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT"
 })
 
 (define_expand "mve_vst1q_<supf><mode>"
-  [(match_operand:MVE_2 0 "memory_operand")
+  [(match_operand:MVE_2 0 "mve_memory_operand")
    (unspec:MVE_2 [(match_operand:MVE_2 1 "s_register_operand")] VST1Q)
   ]
   "TARGET_HAVE_MVE"
index 363b4caf472a68ded61ca7bc6da975aaa92692b3..312b7464f17b171a765b42d2c31451969e8a1c50 100644 (file)
@@ -10,12 +10,16 @@ foo (float16_t * addr, float16x8_t value)
   vst1q_f16 (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
-
 void
 foo1 (float16_t * addr, float16x8_t value)
 {
   vst1q (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
+/* { dg-final { scan-assembler-times "vstrh.16" 2 }  } */
+
+void
+foo2 (float16_t a, float16x8_t x)
+{
+  vst1q (&a, x);
+}
index 37c4713f542ece273c53ce54e77680f75de166ac..cd14e2c408f18945f593ee46bdb1e4cfb9ee6034 100644 (file)
@@ -10,12 +10,16 @@ foo (int16_t * addr, int16x8_t value)
   vst1q_s16 (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
-
 void
 foo1 (int16_t * addr, int16x8_t value)
 {
   vst1q (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
+/* { dg-final { scan-assembler-times "vstrh.16" 2 }  } */
+
+void
+foo2 (int16_t a, int16x8_t x)
+{
+  vst1q (&a, x);
+}
index fe5edea02f50529a0721e4c62e63fa0cf4da5aa5..0004c80963ec572523cfaa8ebf649bf32550e91e 100644 (file)
@@ -10,12 +10,16 @@ foo (int8_t * addr, int8x16_t value)
   vst1q_s8 (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrb.8"  }  } */
-
 void
 foo1 (int8_t * addr, int8x16_t value)
 {
   vst1q (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrb.8"  }  } */
+/* { dg-final { scan-assembler-times "vstrb.8" 2 }  } */
+
+void
+foo2 (int8_t a, int8x16_t x)
+{
+  vst1q (&a, x);
+}
index a4c8c1aabe7e0c278bc0a5291f3d92f70416202a..248e7ce82b097185a02d398debe996f5ad2a21c8 100644 (file)
@@ -10,12 +10,16 @@ foo (uint16_t * addr, uint16x8_t value)
   vst1q_u16 (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
-
 void
 foo1 (uint16_t * addr, uint16x8_t value)
 {
   vst1q (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrh.16"  }  } */
+/* { dg-final { scan-assembler-times "vstrh.16" 2 }  } */
+
+void
+foo2 (uint16_t a, uint16x8_t x)
+{
+  vst1q (&a, x);
+}
index bf20b6da7291de670f899acf07b9096d76be6f6b..f8b48a69903aa8a2a022dbd4cc18e23423c5183e 100644 (file)
@@ -10,12 +10,16 @@ foo (uint8_t * addr, uint8x16_t value)
   vst1q_u8 (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrb.8"  }  } */
-
 void
 foo1 (uint8_t * addr, uint8x16_t value)
 {
   vst1q (addr, value);
 }
 
-/* { dg-final { scan-assembler "vstrb.8"  }  } */
+/* { dg-final { scan-assembler-times "vstrb.8" 2 }  } */
+
+void
+foo2 (uint8_t a, uint8x16_t x)
+{
+  vst1q (&a, x);
+}