152
|
1 /* { dg-do run } */
|
|
2 /* { dg-require-effective-target powerpc_future_hw } */
|
|
3 /* { dg-options "-O1 -mdejagnu-cpu=future" } */
|
|
4 /* See vec-strir-23.c for the same test with -O2 optimization. */
|
|
5
|
|
6 #include <altivec.h>
|
|
7
|
|
8 extern void abort (void);
|
|
9
|
|
10 vector signed short
|
|
11 doString(vector signed short *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 short 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, short *argv [])
|
|
23 {
|
|
24 vector signed short composed_string [4] = {
|
|
25 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
|
|
26 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
|
|
27 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
|
|
28 { 0x1, 0x3, 0x5, 0x7, 0x9, 0x0, 0xd, 0xe }
|
|
29 };
|
|
30
|
|
31 vector signed short expected0 =
|
|
32 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
|
|
33 vector signed short expected1 =
|
|
34 { 0x0, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
|
|
35 vector signed short expected2 =
|
|
36 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
|
|
37 vector signed short expected3 =
|
|
38 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0xe };
|
|
39
|
|
40 if (!vec_all_eq (doString (&composed_string[0]), expected1))
|
|
41 abort ();
|
|
42 if (!vec_all_eq (doString (&composed_string[1]), expected1))
|
|
43 abort ();
|
|
44 if (!vec_all_eq (doString (&composed_string[2]), expected2))
|
|
45 abort ();
|
|
46 if (!vec_all_eq (doString (&composed_string[3]), expected3))
|
|
47 abort ();
|
|
48 }
|