Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/pr115355.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* Force vectorization with -fno-vect-cost-model to have vector unpack
4 which exposes the issue in PR115355. */
5 /* { dg-options "-O2 -mdejagnu-cpu=power9 -fno-vect-cost-model" } */
6
7 /* Verify it runs successfully. */
8
9 __attribute__((noipa))
10 void setToIdentityGOOD(unsigned long long *mVec, unsigned int mLen)
11 {
12 #pragma GCC novector
13 for (unsigned int i = 0; i < mLen; i++)
14 mVec[i] = i;
15 }
16
17 __attribute__((noipa))
18 void setToIdentityBAD(unsigned long long *mVec, unsigned int mLen)
19 {
20 for (unsigned int i = 0; i < mLen; i++)
21 mVec[i] = i;
22 }
23
24 unsigned long long vec1[100];
25 unsigned long long vec2[100];
26
27 int main()
28 {
29 unsigned int l = 29;
30 setToIdentityGOOD (vec1, 29);
31 setToIdentityBAD (vec2, 29);
32
33 if (__builtin_memcmp (vec1, vec2, l * sizeof (vec1[0])) != 0)
34 __builtin_abort ();
35
36 return 0;
37 }