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