[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-strir-22.c
blob5621f3cc888dd1ae099d8a352b8dd65ca27c09b4
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-O1 -mdejagnu-cpu=power10" } */
5 /* See vec-strir-23.c for the same test with -O2 optimization. */
7 #include <altivec.h>
9 extern void abort (void);
11 vector signed short
12 doString(vector signed short *vp)
14 /* Though two built-in functions are called, the implementation
15 should use a single instruction to implement both with -O1. */
16 vector signed short result = vec_strir (*vp);
17 if (vec_strir_p (*vp))
18 return result;
19 else
20 return doString (vp + 1);
23 int main (int argc, short *argv [])
25 vector signed short composed_string [4] = {
26 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
27 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
28 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
29 { 0x1, 0x3, 0x5, 0x7, 0x9, 0x0, 0xd, 0xe }
32 vector signed short expected0 =
33 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
34 vector signed short expected1 =
35 { 0x0, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
36 vector signed short expected2 =
37 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
38 vector signed short expected3 =
39 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0xe };
41 if (!vec_all_eq (doString (&composed_string[0]), expected1))
42 abort ();
43 if (!vec_all_eq (doString (&composed_string[1]), expected1))
44 abort ();
45 if (!vec_all_eq (doString (&composed_string[2]), expected2))
46 abort ();
47 if (!vec_all_eq (doString (&composed_string[3]), expected3))
48 abort ();