152
|
1 /* { dg-do run } */
|
|
2 /* { dg-require-effective-target powerpc_future_hw } */
|
|
3 /* { dg-options "-O1 -mdejagnu-cpu=future" } */
|
|
4 /* See vec-strir-19.c for the same test with -O2 optimization. */
|
|
5
|
|
6 #include <altivec.h>
|
|
7
|
|
8 extern void abort (void);
|
|
9
|
|
10 vector signed char
|
|
11 doString(vector signed char *vp)
|
|
12 {
|
|
13 /* Though two built-in functions are called, the implementation
|
|
14 should use a single instruction to implement both with -O1. */
|
|
15 vector signed char result = vec_strir (*vp);
|
|
16 if (vec_strir_p (*vp))
|
|
17 return result;
|
|
18 else
|
|
19 return doString (vp + 1);
|
|
20 }
|
|
21
|
|
22 int main (int argc, char *argv [])
|
|
23 {
|
|
24 vector signed char composed_string [4] = {
|
|
25 { 0x1, 0x2, 0xf3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
26 0x9, 0xa, 0xb, 0xc, 0xd, 0xe2, 0xf, 0x11 },
|
|
27 { 0x1, 0x2, 0xf3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
28 0x9, 0xa, 0xb, 0xc, 0xd, 0x0, 0xf, 0x11 },
|
|
29 { 0x1, 0x2, 0xf3, 0x0, 0x5, 0x6, 0x7, 0x8,
|
|
30 0x9, 0xa, 0xb, 0xc, 0xd, 0xe2, 0x0, 0x11 },
|
|
31 { 0x1, 0x2, 0xf3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
32 0x9, 0xa, 0xb, 0xc, 0xd, 0xe2, 0x0, 0x11 }
|
|
33 };
|
|
34
|
|
35 vector signed char expected0 =
|
|
36 { 0x1, 0x2, 0xf3, 0x4, 0x5, 0x6, 0x7, 0x8,
|
|
37 0x9, 0xa, 0xb, 0xc, 0xd, 0xe2, 0xf, 0x11 };
|
|
38 vector signed char expected1 =
|
|
39 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
40 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x11 };
|
|
41 vector signed char expected2 =
|
|
42 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
43 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11 };
|
|
44 vector signed char expected3 =
|
|
45 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
|
46 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11 };
|
|
47
|
|
48 if (!vec_all_eq (doString (&composed_string[0]), expected1))
|
|
49 abort ();
|
|
50 if (!vec_all_eq (doString (&composed_string[1]), expected1))
|
|
51 abort ();
|
|
52 if (!vec_all_eq (doString (&composed_string[2]), expected2))
|
|
53 abort ();
|
|
54 if (!vec_all_eq (doString (&composed_string[3]), expected3))
|
|
55 abort ();
|
|
56 }
|