aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c')
-rw-r--r--gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c
new file mode 100644
index 00000000000..27bf39e0963
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/vector/vec-vrepi-1.c
@@ -0,0 +1,58 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */
+/* { dg-require-effective-target vector } */
+
+typedef unsigned char uv16qi __attribute__((vector_size(16)));
+typedef unsigned short uv8hi __attribute__((vector_size(16)));
+typedef unsigned int uv4si __attribute__((vector_size(16)));
+typedef unsigned long long uv2di __attribute__((vector_size(16)));
+
+uv2di __attribute__((noinline))
+foo1 ()
+{
+ return (uv2di){ 0x7f0f, 0x7f0f };
+}
+/* { dg-final { scan-assembler-times "vrepig\t%v24,32527" 1 } } */
+
+uv4si __attribute__((noinline))
+foo2 ()
+{
+ return (uv4si){ 0x7f0f, 0x7f0f, 0x7f0f, 0x7f0f };
+}
+/* { dg-final { scan-assembler-times "vrepif\t%v24,32527" 1 } } */
+
+uv8hi __attribute__((noinline))
+foo3 ()
+{
+ return (uv8hi){ 0x7f0f, 0x7f0f, 0x7f0f, 0x7f0f,
+ 0x7f0f, 0x7f0f, 0x7f0f, 0x7f0f };
+}
+/* { dg-final { scan-assembler-times "vrepih\t%v24,32527" 1 } } */
+
+uv16qi __attribute__((noinline))
+foo4 ()
+{
+ return (uv16qi){ 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77,
+ 0x77, 0x77, 0x77, 0x77 };
+}
+/* { dg-final { scan-assembler-times "vrepib\t%v24,119" 1 } } */
+
+int
+main ()
+{
+ if (foo1()[1] != 0x7f0f)
+ __builtin_abort ();
+
+ if (foo2()[1] != 0x7f0f)
+ __builtin_abort ();
+
+ if (foo3()[1] != 0x7f0f)
+ __builtin_abort ();
+
+ if (foo4()[1] != 0x77)
+ __builtin_abort ();
+
+ return 0;
+}