Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/reverse-elements-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -mzarch -march=z13" } */
3 /* { dg-require-effective-target s390_vx } */
4 /* { dg-final { scan-assembler-times {\tvpdi\t} 4 } } */
5 /* { dg-final { scan-assembler-not {\tvperm\t} } } */
6
7 typedef short __attribute__ ((vector_size (16))) V8HI;
8 typedef int __attribute__ ((vector_size (16))) V4SI;
9 typedef long long __attribute__ ((vector_size (16))) V2DI;
10 typedef double __attribute__ ((vector_size (16))) V2DF;
11
12 V8HI
13 v8hi (V8HI x)
14 {
15 V8HI y;
16 for (int i = 0; i < 8; ++i)
17 y[i] = x[7 - i];
18 return y;
19 }
20
21 V4SI
22 v4si (V4SI x)
23 {
24 V4SI y;
25 for (int i = 0; i < 4; ++i)
26 y[i] = x[3 - i];
27 return y;
28 }
29
30 V2DI
31 v2di (V2DI x)
32 {
33 V2DI y;
34 for (int i = 0; i < 2; ++i)
35 y[i] = x[1 - i];
36 return y;
37 }
38
39 V2DF
40 v2df (V2DF x)
41 {
42 V2DF y;
43 for (int i = 0; i < 2; ++i)
44 y[i] = x[1 - i];
45 return y;
46 }