aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-06-19 11:39:51 +0200
committerRichard Biener <rguenther@suse.de>2024-06-19 11:41:18 +0200
commita73744a4f81e669d8ae72ed3bf529e1602858c88 (patch)
tree5e5249004806c7e26dfb757e5a99ad5b06296374
parentdbb718175d7df89b957b316ba2f5fbea5d21b2b1 (diff)
downloadgcc-a73744a4f81e669d8ae72ed3bf529e1602858c88.zip
gcc-a73744a4f81e669d8ae72ed3bf529e1602858c88.tar.gz
gcc-a73744a4f81e669d8ae72ed3bf529e1602858c88.tar.bz2
Improve gcc.dg/vect/bb-slp-32.c testcase
The following adds a correctness check to the combined store/reduce vectorization. * gcc.dg/vect/bb-slp-32.c: Add check for correctness.
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-32.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
index f10442e..4f72727 100644
--- a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c
@@ -1,14 +1,15 @@
-/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fvect-cost-model=dynamic" } */
-void bar (int *);
-int foo (int *p, int a, int b)
+#include "tree-vect.h"
+
+int __attribute__((noipa))
+foo (int * __restrict__ x, int *p, int a, int b)
{
- int x[4];
+ p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__);
+ x = __builtin_assume_aligned (x, __BIGGEST_ALIGNMENT__);
int tem0, tem1, tem2, tem3;
int sum = 0;
- p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__);
tem0 = p[0] + 1 + a;
sum += tem0;
x[0] = tem0;
@@ -21,6 +22,19 @@ int foo (int *p, int a, int b)
tem3 = p[3] + 4 + a;
sum += tem3;
x[3] = tem3;
- bar (x);
return sum;
}
+
+int x[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
+int p[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__))) = { 0, 1, 2, 3 };
+
+int main()
+{
+ check_vect ();
+
+ if (foo (x, p, 7, 13) != 56)
+ abort ();
+ if (x[0] != 8 || x[1] != 16 || x[2] != 18 || x[3] != 14)
+ abort ();
+ return 0;
+}