Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/vec-shift-12.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 "\tvsrl\t" } } */
5 /* { dg-final { scan-assembler "\tvsrlb\t" } } */
6
7 #include <assert.h>
8
9 typedef __attribute__ ((vector_size (16))) unsigned long long uv2di;
10 typedef __attribute__ ((vector_size (16))) unsigned __int128 uv1ti;
11
12 __attribute__ ((noipa)) uv1ti
13 dyn_shift (uv1ti x, uv1ti n)
14 {
15 return x >> n;
16 }
17
18 int
19 main (void)
20 {
21 uv2di x, y;
22
23 x = (uv2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
24 y = (uv2di){ 0x657f6806ef56df77, 0xe57f6806ef56df77 };
25 x = (uv2di) dyn_shift ((uv1ti) x, (uv1ti){1});
26 assert (x[0] == y[0] && x[1] == y[1]);
27
28 x = (uv2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
29 y = (uv2di){ 0x0000cafed00ddead, 0xbeefcafed00ddead };
30 x = (uv2di) dyn_shift ((uv1ti) x, (uv1ti){16});
31 assert (x[0] == y[0] && x[1] == y[1]);
32
33 x = (uv2di){ 0xcafed00ddeadbeef, 0xcafed00ddeadbeef };
34 y = (uv2di){ 0x000000000032bfb4, 0x0377ab6fbbf2bfb4 };
35 x = (uv2di) dyn_shift ((uv1ti) x, (uv1ti){42});
36 assert (x[0] == y[0] && x[1] == y[1]);
37
38 return 0;
39 }