Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/vec-shift-10.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O3 -mzarch -march=z13 -save-temps" } */
3 /* { dg-require-effective-target int128 } */
4 /* { dg-final { scan-assembler "\tvsra\t" } } */
5 /* { dg-final { scan-assembler "\tvsrab\t" } } */
6
7 #include <assert.h>
8
9 typedef __attribute__ ((vector_size (16))) signed long long v2di;
10 typedef __attribute__ ((vector_size (16))) signed __int128 v1ti;
11
12 __attribute__ ((noipa)) v1ti
13 dyn_shift (v1ti x, v1ti n)
14 {
15 return x >> n;
16 }
17
18 int
19 main (void)
20 {
21 v2di x, y;
22
23 x = (v2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
24 y = (v2di){ 0xe57f6806ef56df77, 0xe57f6806ef56df77 };
25 x = (v2di) dyn_shift ((v1ti) x, (v1ti){1});
26 assert (x[0] == y[0] && x[1] == y[1]);
27
28 x = (v2di){ 0x4afed00dbeadbeee, 0xcafed00ddeadbeef };
29 y = (v2di){ 0x257f6806df56df77, 0x657f6806ef56df77 };
30 x = (v2di) dyn_shift ((v1ti) x, (v1ti){1});
31 assert (x[0] == y[0] && x[1] == y[1]);
32
33 x = (v2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
34 y = (v2di){ 0xffffcafed00ddead, 0xbeefcafed00ddead };
35 x = (v2di) dyn_shift ((v1ti) x, (v1ti){16});
36 assert (x[0] == y[0] && x[1] == y[1]);
37
38 x = (v2di){ 0x4afed00ddead3eef, 0xcafed00ddeadbeef };
39 y = (v2di){ 0x00004afed00ddead, 0x3eefcafed00ddead };
40 x = (v2di) dyn_shift ((v1ti) x, (v1ti){16});
41 assert (x[0] == y[0] && x[1] == y[1]);
42
43 x = (v2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
44 y = (v2di){ 0xfffffffffff2bfb4, 0x377ab6fbbf2bfb4 };
45 x = (v2di) dyn_shift ((v1ti) x, (v1ti){42});
46 assert (x[0] == y[0] && x[1] == y[1]);
47
48 x = (v2di){ 0x4afed00ddeadbeee, 0xcafed00ddeadbeef };
49 y = (v2di){ 0x000000000012bfb4, 0x0377ab6fbbb2bfb4 };
50 x = (v2di) dyn_shift ((v1ti) x, (v1ti){42});
51 assert (x[0] == y[0] && x[1] == y[1]);
52
53 return 0;
54 }