diagnostics: move output formats from diagnostic.{c,h} to their own files
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vec-strir-21.c
blob1a90e56ee6e937b9f42c7c9c9eaf7d7fc877b00a
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-O2 -mdejagnu-cpu=power10" } */
6 #include <altivec.h>
8 extern void abort (void);
10 vector unsigned short
11 doString(vector unsigned short *vp)
13 /* Iteration replaces tail recursion with -O2. */
14 vector unsigned short result = vec_strir (*vp);
15 if (vec_strir_p (*vp))
16 return result;
17 else
18 return doString (vp + 1);
21 int main (int argc, short *argv [])
23 vector unsigned short composed_string [4] = {
24 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
25 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf },
26 { 0x1, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 },
27 { 0x1, 0x3, 0x5, 0x7, 0x9, 0x0, 0xd, 0xe }
30 vector unsigned short expected0 =
31 { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
32 vector unsigned short expected1 =
33 { 0x0, 0x0, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
34 vector unsigned short expected2 =
35 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
36 vector unsigned short expected3 =
37 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0xe };
39 if (!vec_all_eq (doString (&composed_string[0]), expected1))
40 abort ();
41 if (!vec_all_eq (doString (&composed_string[1]), expected1))
42 abort ();
43 if (!vec_all_eq (doString (&composed_string[2]), expected2))
44 abort ();
45 if (!vec_all_eq (doString (&composed_string[3]), expected3))
46 abort ();