Debian Codegraph @

gcc/testsuite/gcc.target/s390/vector/vec-max-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 {\tvmxq\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_max:
14 ** vchlg %v[0-9]+,%v[0-9]+,%v[0-9]+
15 ** vceqg %v[0-9]+,%v[0-9]+,%v[0-9]+
16 ** vpdi %v[0-9]+,%v[0-9]+,%v[0-9]+,4
17 ** vchg %v[0-9]+,%v[0-9]+,%v[0-9]+
18 ** vn %v[0-9]+,%v[0-9]+,%v[0-9]+
19 ** vo %v[0-9]+,%v[0-9]+,%v[0-9]+
20 ** vrepg %v[0-9]+,%v[0-9]+,0
21 ** vsel %v[0-9]+,%v[0-9]+,%v[0-9]+,%v[0-9]+
22 ** br %r14
23 */
24 __attribute__ ((noipa)) v1ti
25 my_max (v1ti x, v1ti y)
26 {
27 return __builtin_s390_vec_max (x, y);
28 }
29
30 int
31 main (void)
32 {
33 v2di x, y, z;
34
35 x = (v2di){ -1, -42 };
36 y = (v2di){ 0, 42 };
37 z = (v2di) my_max ((v1ti) x, (v1ti) y);
38 assert (z[0] == 0 && z[1] == 42);
39 z = (v2di) my_max ((v1ti) y, (v1ti) x);
40 assert (z[0] == 0 && z[1] == 42);
41
42 x = (v2di){ 42, 42 };
43 y = (v2di){ 42, 43 };
44 z = (v2di) my_max ((v1ti) x, (v1ti) y);
45 assert (z[0] == 42 && z[1] == 43);
46 z = (v2di) my_max ((v1ti) y, (v1ti) x);
47 assert (z[0] == 42 && z[1] == 43);
48
49 x = (v2di){ 42, 42 };
50 y = (v2di){ 43, 42 };
51 z = (v2di) my_max ((v1ti) x, (v1ti) y);
52 assert (z[0] == 43 && z[1] == 42);
53 z = (v2di) my_max ((v1ti) y, (v1ti) x);
54 assert (z[0] == 43 && z[1] == 42);
55
56 return 0;
57 }