Debian Codegraph @

gcc/testsuite/g++.dg/other/sse2-pr85572-2.C

raw
1 // PR target/85572
2 // { dg-do run { target i?86-*-* x86_64-*-* } }
3 // { dg-options "-O2 -msse2" }
4 // { dg-require-effective-target sse2_runtime }
5
6 typedef long long V __attribute__((vector_size (16)));
7 typedef long long W __attribute__((vector_size (32)));
8
9 __attribute__((noipa)) V
10 foo (V x)
11 {
12 return x < 0 ? -x : x;
13 }
14
15 __attribute__((noipa)) void
16 bar (W *x, W *y)
17 {
18 *y = *x < 0 ? -*x : *x;
19 }
20
21 int
22 main ()
23 {
24 V a = { 11LL, -15LL };
25 V b = foo (a);
26 if (b[0] != 11LL || b[1] != 15LL)
27 __builtin_abort ();
28 V c = { -123456789123456LL, 654321654321654LL };
29 V d = foo (c);
30 if (d[0] != 123456789123456LL || d[1] != 654321654321654LL)
31 __builtin_abort ();
32 V e = { 0, 1 };
33 V f = foo (e);
34 if (f[0] != 0 || f[1] != 1)
35 __builtin_abort ();
36 W g = { 17LL, -32LL, -123456789123456LL, 654321654321654LL }, h;
37 bar (&g, &h);
38 if (h[0] != 17LL || h[1] != 32LL
39 || h[2] != 123456789123456LL || h[3] != 654321654321654LL)
40 __builtin_abort ();
41 W i = { 0, 1, -1, 0 }, j;
42 bar (&i, &j);
43 if (j[0] != 0 || j[1] != 1 || j[2] != 1 || j[3] != 0)
44 __builtin_abort ();
45 }