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 unsigned char
|
|
10 doString(vector unsigned char *vp)
|
|
11 {
|
|
12 /* Tail recursion replaced with iteration with -O2. */
|
|
13 vector unsigned char 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, char *argv [])
|
|
21 {
|
|
22 vector unsigned char composed_string [4] = {
|
|
23 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
24 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 },
|
|
25 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
26 0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 },
|
|
27 { 0x1, 0x2, 0x0, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
28 0x9, 0xa, 0xb, 0xc, 0xd, 0x0, 0xf, 0x11 },
|
|
29 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
30 0x9, 0xa, 0xb, 0xc, 0xd, 0x0, 0xf, 0x11 }
|
|
31 };
|
|
32
|
|
33 vector unsigned char expected0 =
|
|
34 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
35 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 };
|
|
36 vector unsigned char expected1 =
|
|
37 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
38 0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 };
|
|
39 vector unsigned char expected2 =
|
|
40 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
41 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x11 };
|
|
42 vector unsigned char expected3 =
|
|
43 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
44 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x11 };
|
|
45
|
|
46 if (!vec_all_eq (doString (&composed_string[0]), expected1))
|
|
47 abort ();
|
|
48 if (!vec_all_eq (doString (&composed_string[1]), expected1))
|
|
49 abort ();
|
|
50 if (!vec_all_eq (doString (&composed_string[2]), expected2))
|
|
51 abort ();
|
|
52 if (!vec_all_eq (doString (&composed_string[3]), expected3))
|
|
53 abort ();
|
|
54 }
|