OSDN Git Service

PR c/44051
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / long-long-compare-1.c
1 /* Problem only noticed on SH for -mcbranchdi DImode comparison with constants.
2  * Target dependant failure but test valid for alls.  */
3 /* { dg-do run } */
4 /* { dg-options "-O0" } */
5 /* { dg-options "-O0 -mcbranchdi" { target sh4-*-* } } */
6
7 extern void abort(void);
8 extern void exit(int);
9
10 int test2(long long n)
11 {
12   if (n < 2)
13     return 1;
14   return 0;
15 }
16
17 int test1(long long n)
18 {
19   if (n < 1)
20     return 1;
21   return 0;
22 }
23
24 int test0(long long n)
25 {
26   if (n < 0)
27     return 1;
28   return 0;
29 }
30
31 int test1n(long long n)
32 {
33   if (n < -1LL)
34     return 1;
35   return 0;
36 }
37
38 int test2n(long long n)
39 {
40   if (n < -2LL)
41     return 1;
42   return 0;
43 }
44
45 int main()
46 {
47   if (test2n (-1LL))
48     abort ();
49
50   if (test2n (-2LL))
51     abort ();
52
53   if (test2n (0LL))
54     abort ();
55
56   if (test2n (1LL))
57     abort ();
58
59   if (test2n (2LL))
60     abort ();
61  
62   if (test1n (-1LL))
63     abort ();
64
65   if (!test1n (-2LL))
66     abort ();
67
68   if (test1n (0LL))
69     abort ();
70
71   if (test1n (1LL))
72     abort ();
73
74   if (test1n (2LL))
75     abort ();
76
77   if (!test0 (-1LL))
78     abort ();
79
80   if (!test0 (-2LL))
81     abort ();
82
83   if (test0 (0LL))
84     abort ();
85
86   if (test0 (1LL))
87     abort ();
88
89   if (test0 (2LL))
90     abort ();
91
92   if (!test2 (-1LL))
93     abort ();
94
95   if (!test2 (-2LL))
96     abort ();
97
98   if (!test2 (0LL))
99     abort ();
100
101   if (!test2 (1LL))
102     abort ();
103
104   if (test2 (2LL))
105     abort ();
106
107   if (!test1 (-1LL))
108     abort ();
109
110   if (!test1 (-2LL))
111     abort ();
112
113   if (!test1 (0LL))
114     abort ();
115
116   if (test1 (1LL))
117     abort ();
118
119   if (test1 (2LL))
120     abort ();
121
122   exit (0);
123 }
124
125
126