Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr96779.c

raw
1 /* PR tree-optimization/96779 */
2 /* { dg-do run } */
3 /* { dg-options "-O -fdump-tree-optimized" } */
4 /* { dg-require-effective-target int32plus } */
5
6 #include <stdbool.h>
7
8 bool __attribute__ ((noipa)) f_func(int a)
9 {
10 return -a == a;
11 }
12
13 bool __attribute__ ((noipa)) h_func(short a)
14 {
15 return -a == a;
16 }
17
18 bool __attribute__ ((noipa)) k_func(long a)
19 {
20 return -a == a;
21 }
22
23 int
24 main (void)
25 {
26 // few randomly generated test cases
27 if (f_func (71856034))
28 {
29 __builtin_abort ();
30 }
31 if (f_func (71856034))
32 {
33 __builtin_abort ();
34 }
35 if (h_func (1744))
36 {
37 __builtin_abort ();
38 }
39 if (k_func (68268386))
40 {
41 __builtin_abort ();
42 }
43 if (f_func (-112237))
44 {
45 __builtin_abort ();
46 }
47 if (f_func (-787116))
48 {
49 __builtin_abort ();
50 }
51 if (h_func (-863))
52 {
53 __builtin_abort ();
54 }
55 if (k_func (-787116))
56 {
57 __builtin_abort ();
58 }
59 if (!f_func (0))
60 {
61 __builtin_abort ();
62 }
63 if (!f_func (0))
64 {
65 __builtin_abort ();
66 }
67 if (!h_func (0))
68 {
69 __builtin_abort ();
70 }
71 if (!k_func (0))
72 {
73 __builtin_abort ();
74 }
75
76 return 0;
77 }
78
79 /* Verify that we transfered to "= -" pattern from "_2 = -_1;". */
80 /* { dg-final { scan-tree-dump-not "= -" "optimized" } } */