1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
5
6 #include <altivec.h>
7
8 extern void abort (void);
9
10 vector signed short
11 doString(vector signed short *vp)
12 {
13 /* Iteration replaces tail recursion with -O2. */
14 vector signed short result = vec_stril (*vp);
15 if (vec_stril_p (*vp))
16 return result;
17 else
18 return doString (vp + 1);
19 }
20
21 int main (int argc, short *argv [])
22 {
23 vector signed short composed_string [4] = {
24 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
25 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
26 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
27 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 }
28 };
29
30 vector signed short expected0 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
31 vector signed short expected1 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
32 vector signed short expected2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
33 vector signed short expected3 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 };
34
35 if (!vec_all_eq (doString (&composed_string[0]), expected1))
36 abort ();
37 if (!vec_all_eq (doString (&composed_string[1]), expected1))
38 abort ();
39 if (!vec_all_eq (doString (&composed_string[2]), expected2))
40 abort ();
41 if (!vec_all_eq (doString (&composed_string[3]), expected3))
42 abort ();
43 }