comparison gcc/testsuite/gcc.c-torture/execute/pr92618.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* PR tree-optimization/92618 */
2
3 typedef long long __m128i __attribute__((__may_alias__, __vector_size__(2 * sizeof (long long))));
4
5 double a[4];
6 unsigned long long b[4];
7
8 __attribute__((noipa)) __m128i
9 bar (void)
10 {
11 static int cnt;
12 cnt += 2;
13 return (__m128i) { cnt, cnt + 1 };
14 }
15
16 #if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__
17 typedef double __m128d __attribute__((__may_alias__, __vector_size__(2 * sizeof (double))));
18
19 __attribute__((noipa)) __m128i
20 qux (void)
21 {
22 static double cnt;
23 cnt += 2.0;
24 return (__m128i) (__m128d) { cnt, cnt + 1.0 };
25 }
26 #endif
27
28 void
29 foo (unsigned long long *x)
30 {
31 __m128i c = bar ();
32 __m128i d = bar ();
33 *(__m128i *) &b[0] = c;
34 *(__m128i *) &b[2] = d;
35 *x = b[0] + b[1] + b[2] + b[3];
36 }
37
38 void
39 baz (double *x)
40 {
41 #if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__
42 __m128i c = qux ();
43 __m128i d = qux ();
44 *(__m128i *) &a[0] = c;
45 *(__m128i *) &a[2] = d;
46 *x = a[0] + a[1] + a[2] + a[3];
47 #endif
48 }
49
50 int
51 main ()
52 {
53 unsigned long long c = 0;
54 foo (&c);
55 if (c != 2 + 3 + 4 + 5)
56 __builtin_abort ();
57 #if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__
58 double d = 0.0;
59 baz (&d);
60 if (d != 2.0 + 3.0 + 4.0 + 5.0)
61 __builtin_abort ();
62 #endif
63 }