comparison gcc/testsuite/gcc.target/powerpc/vec-stril-22.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
comparison
equal deleted inserted replaced
145:1830386684a0 152:2b5abeee2509
1 /* { dg-do run } */
2 /* { dg-require-effective-target powerpc_future_hw } */
3 /* { dg-options "-O1 -mdejagnu-cpu=future" } */
4 /* See vec-stril-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_stril (*vp);
16 if (vec_stril_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, 0xb, 0xd, 0x0 }
29 };
30
31 vector signed short expected0 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0xf };
32 vector signed short expected1 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
33 vector signed short expected2 = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
34 vector signed short expected3 = { 0x1, 0x3, 0x5, 0x7, 0x9, 0xb, 0xd, 0x0 };
35
36 if (!vec_all_eq (doString (&composed_string[0]), expected1))
37 abort ();
38 if (!vec_all_eq (doString (&composed_string[1]), expected1))
39 abort ();
40 if (!vec_all_eq (doString (&composed_string[2]), expected2))
41 abort ();
42 if (!vec_all_eq (doString (&composed_string[3]), expected3))
43 abort ();
44 }