libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / pr91088.c
blobf8b3c49b973a129911d6de2dc790f83023eb73fe
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-ipa-cp-details -fno-inline" } */
4 int foo();
6 #define large_code \
7 do { \
8 foo (); \
9 foo (); \
10 foo (); \
11 foo (); \
12 foo (); \
13 foo (); \
14 foo (); \
15 foo (); \
16 foo (); \
17 foo (); \
18 foo (); \
19 foo (); \
20 foo (); \
21 foo (); \
22 foo (); \
23 foo (); \
24 foo (); \
25 foo (); \
26 foo (); \
27 foo (); \
28 foo (); \
29 foo (); \
30 foo (); \
31 foo (); \
32 foo (); \
33 foo (); \
34 foo (); \
35 foo (); \
36 foo (); \
37 foo (); \
38 foo (); \
39 foo (); \
40 foo (); \
41 foo (); \
42 foo (); \
43 foo (); \
44 foo (); \
45 foo (); \
46 foo (); \
47 foo (); \
48 } while (1)
51 struct A
53 char f1;
54 short f2 : 5;
55 int f3;
58 int callee1 (struct A a)
60 if ((a.f2 + 7) & 17)
61 foo ();
63 if ((1300 / (short)a.f3) == 19)
64 large_code;
66 return 1;
69 int callee2 (short *p)
71 if ((*p ^ 1) < 8)
72 large_code;
74 return 2;
77 int callee3 (int v)
79 if ((27 % ((1 - (v & 0xff)) * 3)) < 6)
81 large_code;
82 return v + 2;
84 else
85 return v + 1;
88 int caller ()
90 struct A a;
91 short b;
93 a.f2 = -7;
94 a.f3 = 68;
95 if (callee1 (a))
96 foo ();
98 a.f2 = 3;
99 a.f3 = 10;
100 if (callee1 (a))
101 foo ();
103 b = 9;
104 if (callee2 (&b))
105 foo ();
107 b = 2;
108 if (callee2 (&b))
109 foo ();
111 return callee3 (-5) +
112 callee3 (0);
115 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee1" 1 "cp" } } */
116 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee2" 1 "cp" } } */
117 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee3" 1 "cp" } } */
118 /* { dg-final { scan-ipa-dump "op0\\\[offset: 16],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target default_packed } } } */
119 /* { dg-final { scan-ipa-dump "op0\\\[offset: 32],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target { ! default_packed } } } } */
120 /* { dg-final { scan-ipa-dump "op0\\\[ref offset: 0],\\(# \\^ 1\\) <" "cp" } } */
121 /* { dg-final { scan-ipa-dump "op0,\\(# & 255\\),\\(1 - #\\),\\(# \\* 3\\),\\(27 % #\\) <" "cp" } } */