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 int
8 #endif
9
10 t feq(t *a, t *b)
11 {
12 t c = *a;
13 *b = c == 0;
14 return c;
15 }
16
17 t fne(t *a, t *b)
18 {
19 t c = *a;
20 *b = c != 0;
21 return c;
22 }
23
24 t fgt(t *a, t *b)
25 {
26 t c = *a;
27 *b = c > 0;
28 return c;
29 }
30
31 unsigned t fgtu(unsigned t *a, unsigned t *b)
32 {
33 unsigned t c = *a;
34 *b = c > 0;
35 return c;
36 }
37
38 t flt(t *a, t *b)
39 {
40 t c = *a;
41 *b = c < 0;
42 return c;
43 }
44
45 #if 0
46 /* Always false... */
47 unsigned t fltu(unsigned t *a, unsigned t *b)
48 {
49 unsigned t c = *a;
50 *b = c < 0;
51 return c;
52 }
53 #endif
54
55 t fge(t *a, t *b)
56 {
57 t c = *a;
58 *b = c >= 0;
59 return c;
60 }
61
62 #if 0
63 /* Always true... */
64 unsigned t fgeu(unsigned t *a, unsigned t *b)
65 {
66 unsigned t c = *a;
67 *b = c > 0;
68 return c;
69 }
70 #endif
71
72 t fle(t *a, t *b)
73 {
74 t c = *a;
75 *b = c <= 0;
76 return c;
77 }
78
79 /* Same as eq... */
80 unsigned t fleu(unsigned t *a, unsigned t *b)
81 {
82 unsigned t c = *a;
83 *b = c <= 0;
84 return c;
85 }