Debian Codegraph @

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

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -mzarch -march=z15" } */
3 /* { dg-require-effective-target s390_vxe2 } */
4 /* { dg-final { scan-assembler-times {\tvstbrq\t} 1 } } */
5 /* { dg-final { scan-assembler-times {\tvster[hfg]\t} 5 } } */
6 /* { dg-final { scan-assembler-not {\tvperm\t} } } */
7
8 typedef signed char __attribute__ ((vector_size (16))) V16QI;
9 typedef short __attribute__ ((vector_size (16))) V8HI;
10 typedef int __attribute__ ((vector_size (16))) V4SI;
11 typedef long long __attribute__ ((vector_size (16))) V2DI;
12 typedef float __attribute__ ((vector_size (16))) V4SF;
13 typedef double __attribute__ ((vector_size (16))) V2DF;
14
15 void
16 v16qi (V16QI *x, V16QI y)
17 {
18 V16QI z;
19 for (int i = 0; i < 16; ++i)
20 z[i] = y[15 - i];
21 *x = z;
22 }
23
24 void
25 v8hi (V8HI *x, V8HI y)
26 {
27 V8HI z;
28 for (int i = 0; i < 8; ++i)
29 z[i] = y[7 - i];
30 *x = z;
31 }
32
33 void
34 v4si (V4SI *x, V4SI y)
35 {
36 V4SI z;
37 for (int i = 0; i < 4; ++i)
38 z[i] = y[3 - i];
39 *x = z;
40 }
41
42 void
43 v2di (V2DI *x, V2DI y)
44 {
45 V2DI z;
46 for (int i = 0; i < 2; ++i)
47 z[i] = y[1 - i];
48 *x = z;
49 }
50
51 void
52 v4sf (V4SF *x, V4SF y)
53 {
54 V4SF z;
55 for (int i = 0; i < 4; ++i)
56 z[i] = y[3 - i];
57 *x = z;
58 }
59
60 void
61 v2df (V2DF *x, V2DF y)
62 {
63 V2DF z;
64 for (int i = 0; i < 2; ++i)
65 z[i] = y[1 - i];
66 *x = z;
67 }