Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/vec-clrl-1.c

raw
1 /* { dg-do run { target { power10_hw } } } */
2 /* { dg-do link { target { ! power10_hw } } } */
3 /* { dg-require-effective-target power10_ok } */
4 /* { dg-options "-mdejagnu-cpu=power10" } */
5
6 #include <altivec.h>
7
8 extern void abort (void);
9
10 /* Vector string clear left-most bytes of unsigned char. */
11 vector unsigned char
12 clrl (vector unsigned char arg, int n)
13 {
14 return vec_clrl (arg, n);
15 }
16
17 int main (int argc, char *argv [])
18 {
19 vector unsigned char input0 =
20 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
21 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 };
22 vector unsigned char expected0 =
23 { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
24 0x0, 0x0, 0x0, 0xc, 0xd, 0xe, 0xf, 0x11 };
25 vector unsigned char expected1 =
26 { 0x0, 0x0, 0x0, 0x4, 0x5, 0x6, 0x7, 0x8,
27 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 };
28 vector unsigned char expected2 =
29 { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
30 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x11 };
31
32 if (!vec_all_eq (clrl (input0, 5), expected0))
33 abort ();
34 if (!vec_all_eq (clrl (input0, 13), expected1))
35 abort ();
36 if (!vec_all_eq (clrl (input0, 19), expected2))
37 abort ();
38 }