Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr68376-2.c

raw
1 /* PR rtl-optimization/68376 */
2
3 extern void abort (void);
4
5 __attribute__((noinline, noclone)) int
6 f1 (int x)
7 {
8 return x < 0 ? ~x : x;
9 }
10
11 __attribute__((noinline, noclone)) int
12 f2 (int x)
13 {
14 return x < 0 ? x : ~x;
15 }
16
17 __attribute__((noinline, noclone)) int
18 f3 (int x)
19 {
20 return x <= 0 ? ~x : x;
21 }
22
23 __attribute__((noinline, noclone)) int
24 f4 (int x)
25 {
26 return x <= 0 ? x : ~x;
27 }
28
29 __attribute__((noinline, noclone)) int
30 f5 (int x)
31 {
32 return x >= 0 ? ~x : x;
33 }
34
35 __attribute__((noinline, noclone)) int
36 f6 (int x)
37 {
38 return x >= 0 ? x : ~x;
39 }
40
41 __attribute__((noinline, noclone)) int
42 f7 (int x)
43 {
44 return x > 0 ? ~x : x;
45 }
46
47 __attribute__((noinline, noclone)) int
48 f8 (int x)
49 {
50 return x > 0 ? x : ~x;
51 }
52
53 int
54 main ()
55 {
56 if (f1 (5) != 5 || f1 (-5) != 4 || f1 (0) != 0)
57 abort ();
58 if (f2 (5) != -6 || f2 (-5) != -5 || f2 (0) != -1)
59 abort ();
60 if (f3 (5) != 5 || f3 (-5) != 4 || f3 (0) != -1)
61 abort ();
62 if (f4 (5) != -6 || f4 (-5) != -5 || f4 (0) != 0)
63 abort ();
64 if (f5 (5) != -6 || f5 (-5) != -5 || f5 (0) != -1)
65 abort ();
66 if (f6 (5) != 5 || f6 (-5) != 4 || f6 (0) != 0)
67 abort ();
68 if (f7 (5) != -6 || f7 (-5) != -5 || f7 (0) != 0)
69 abort ();
70 if (f8 (5) != 5 || f8 (-5) != 4 || f8 (0) != -1)
71 abort ();
72 return 0;
73 }