1 /* Check that eliminable compare-instructions are eliminated. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 /* { dg-final { scan-assembler-not "\tcmp|\ttest" } } */
5
6 #ifndef t
7 #define t short int
8 #endif
9 #ifndef t2
10 #define t2 t
11 #endif
12 #ifndef op
13 #define op +
14 #endif
15 #ifndef do_f
16 #define do_f 1
17 #endif
18 #ifndef do_g
19 #define do_g 1
20 #endif
21
22 extern void foo(void);
23
24 #if do_f
25 void f(t a, t b)
26 {
27 t2 c = a op b;
28
29 if (c == 0)
30 foo();
31 }
32 #endif
33
34 #if do_g
35 void g(t a, t b)
36 {
37 t2 c = a op b;
38
39 if (c >= 0)
40 foo();
41 }
42 #endif