Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/vec-abs-emu.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O3 -mzarch -march=z13 -save-temps -fno-stack-protector" } */
3 /* { dg-require-effective-target int128 } */
4 /* { dg-final { check-function-bodies "**" "" "" } } */
5 /* { dg-final { scan-assembler-not {\tvlpq\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 /*
13 ** my_abs:
14 ** vzero %v[0-9]+
15 ** vchlg %v[0-9]+,%v[0-9]+,%v[0-9]+
16 ** vceqg %v[0-9]+,%v[0-9]+,%v[0-9]+
17 ** vpdi %v[0-9]+,%v[0-9]+,%v[0-9]+,4
18 ** vchg %v[0-9]+,%v[0-9]+,%v[0-9]+
19 ** vn %v[0-9]+,%v[0-9]+,%v[0-9]+
20 ** vo %v[0-9]+,%v[0-9]+,%v[0-9]+
21 ** vrepg %v[0-9]+,%v[0-9]+,0
22 ** vsq %v[0-9]+,%v[0-9]+,%v[0-9]+
23 ** vsel %v[0-9]+,%v[0-9]+,%v[0-9]+,%v[0-9]+
24 ** br %r14
25 */
26 __attribute__ ((noipa)) v1ti
27 my_abs (v1ti x)
28 {
29 return __builtin_s390_vec_abs (x);
30 }
31
32 int
33 main (void)
34 {
35 v2di x;
36
37 x = (v2di){ -1, -42 };
38 x = (v2di) my_abs ((v1ti) x);
39 assert (x[0] == 0 && x[1] == 42);
40
41 x = (v2di){ 0, 42 };
42 x = (v2di) my_abs ((v1ti) x);
43 assert (x[0] == 0 && x[1] == 42);
44
45 return 0;
46 }