c++: normalizing ttp constraints [PR115656]
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-stril-20.c
bloba2db6a75cb3e8fa3edc6d9fe20d03f412bf8fbdc
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-O1 -mdejagnu-cpu=power10" } */
5 /* See vec-stril-21.c for the same test with -O2 optimization. */
7 #include <altivec.h>
9 extern void abort (void);
11 vector unsigned short
12 doString(vector unsigned short *vp)
14 /* Though two built-in functions are called, the implementation
15 should use a single instruction to implement both with -O1. */
16 vector unsigned short result = vec_stril (*vp);
17 if (vec_stril_p (*vp))
18 return result;
19 else
20 return doString (vp + 1);
23 int main (int argc, short *argv [])
25 vector unsigned short composed_string [4] = {
26 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
27 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
28 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
29 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 }
32 vector unsigned short expected0 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
33 vector unsigned short expected1 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
34 vector unsigned short expected2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
35 vector unsigned short expected3 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 };
37 if (!vec_all_eq (doString (&composed_string[0]), expected1))
38 abort ();
39 if (!vec_all_eq (doString (&composed_string[1]), expected1))
40 abort ();
41 if (!vec_all_eq (doString (&composed_string[2]), expected2))
42 abort ();
43 if (!vec_all_eq (doString (&composed_string[3]), expected3))
44 abort ();