Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr95464.c

raw
1 /* { dg-options "-O2" } */
2 /* { dg-do run { target { *-*-linux* && { ! ia32 } } } } */
3
4 struct S { unsigned a:1, b:1, c:1, d:1, e:14, f:14; };
5
6 __attribute__((noipa)) int
7 foo (struct S x)
8 {
9 if (x.a != 0 || x.b != 1 || x.c != 0 || x.d != 1
10 || x.e != 7239 || x.f != 6474)
11 __builtin_abort ();
12 }
13
14 __attribute__((noipa)) void
15 bar (struct S x, struct S y)
16 {
17 if (x.a != 0 || x.b != 1 || x.c != 0 || x.d != 1
18 || x.e != 7239 || x.f != 6474)
19 __builtin_abort ();
20 if (y.a != 0 || y.b != 1 || y.c != 1 || y.d != 1
21 || y.e != 16320 || y.f != 7315)
22 __builtin_abort ();
23 }
24
25 __attribute__((noipa)) void
26 baz (struct S x)
27 {
28 if (x.a != 1 || x.b != 1 || x.c != 1 || x.d != 1
29 || x.e != 16320 || x.f != 7315)
30 __builtin_abort ();
31 }
32
33 __attribute__((noipa)) void
34 qux (struct S x, struct S y, unsigned z)
35 {
36 struct S a = x, b;
37 for (unsigned i = 0; i < z; ++i)
38 foo (x);
39 if (x.a && x.e == 16)
40 a.e = 32;
41 b = a;
42 b.c = y.c;
43 b.e = y.e;
44 b.f = y.f;
45 bar (a, b);
46 a = b;
47 __asm volatile ("" : : : "ax", "bx", "cx", "dx", "si", "di",
48 #ifdef __OPTIMIZE__
49 "bp",
50 #endif
51 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
52 a.a = 1;
53 a.c = 1;
54 baz (a);
55 }
56
57 int
58 main ()
59 {
60 struct S x = { 0, 1, 0, 1, 7239, 6474 };
61 struct S y = { 1, 0, 1, 0, 16320, 7315 };
62 qux (x, y, 1);
63 return 0;
64 }