Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.c-torture / execute / 20040409-2.c
blobc83ff1adf5ea05ddb5640c1db3b3a43176257ad6
1 #include <limits.h>
3 extern void abort ();
5 int test1(int x)
7 return (x ^ INT_MIN) ^ 0x1234;
10 unsigned int test1u(unsigned int x)
12 return (x ^ (unsigned int)INT_MIN) ^ 0x1234;
15 int test2(int x)
17 return (x ^ 0x1234) ^ INT_MIN;
20 unsigned int test2u(unsigned int x)
22 return (x ^ 0x1234) ^ (unsigned int)INT_MIN;
25 int test3(int x)
27 return (x + INT_MIN) ^ 0x1234;
30 unsigned int test3u(unsigned int x)
32 return (x + (unsigned int)INT_MIN) ^ 0x1234;
35 int test4(int x)
37 return (x ^ 0x1234) + INT_MIN;
40 unsigned int test4u(unsigned int x)
42 return (x ^ 0x1234) + (unsigned int)INT_MIN;
45 int test5(int x)
47 return (x - INT_MIN) ^ 0x1234;
50 unsigned int test5u(unsigned int x)
52 return (x - (unsigned int)INT_MIN) ^ 0x1234;
55 int test6(int x)
57 return (x ^ 0x1234) - INT_MIN;
60 unsigned int test6u(unsigned int x)
62 return (x ^ 0x1234) - (unsigned int)INT_MIN;
65 int test7(int x)
67 int y = INT_MIN;
68 int z = 0x1234;
69 return (x ^ y) ^ z;
72 unsigned int test7u(unsigned int x)
74 unsigned int y = (unsigned int)INT_MIN;
75 unsigned int z = 0x1234;
76 return (x ^ y) ^ z;
79 int test8(int x)
81 int y = 0x1234;
82 int z = INT_MIN;
83 return (x ^ y) ^ z;
86 unsigned int test8u(unsigned int x)
88 unsigned int y = 0x1234;
89 unsigned int z = (unsigned int)INT_MIN;
90 return (x ^ y) ^ z;
93 int test9(int x)
95 int y = INT_MIN;
96 int z = 0x1234;
97 return (x + y) ^ z;
100 unsigned int test9u(unsigned int x)
102 unsigned int y = (unsigned int)INT_MIN;
103 unsigned int z = 0x1234;
104 return (x + y) ^ z;
107 int test10(int x)
109 int y = 0x1234;
110 int z = INT_MIN;
111 return (x ^ y) + z;
114 unsigned int test10u(unsigned int x)
116 unsigned int y = 0x1234;
117 unsigned int z = (unsigned int)INT_MIN;
118 return (x ^ y) + z;
121 int test11(int x)
123 int y = INT_MIN;
124 int z = 0x1234;
125 return (x - y) ^ z;
128 unsigned int test11u(unsigned int x)
130 unsigned int y = (unsigned int)INT_MIN;
131 unsigned int z = 0x1234;
132 return (x - y) ^ z;
135 int test12(int x)
137 int y = 0x1234;
138 int z = INT_MIN;
139 return (x ^ y) - z;
142 unsigned int test12u(unsigned int x)
144 unsigned int y = 0x1234;
145 unsigned int z = (unsigned int)INT_MIN;
146 return (x ^ y) - z;
150 void test(int a, int b)
152 if (test1(a) != b)
153 abort();
154 if (test2(a) != b)
155 abort();
156 if (test3(a) != b)
157 abort();
158 if (test4(a) != b)
159 abort();
160 if (test5(a) != b)
161 abort();
162 if (test6(a) != b)
163 abort();
164 if (test7(a) != b)
165 abort();
166 if (test8(a) != b)
167 abort();
168 if (test9(a) != b)
169 abort();
170 if (test10(a) != b)
171 abort();
172 if (test11(a) != b)
173 abort();
174 if (test12(a) != b)
175 abort();
178 void testu(unsigned int a, unsigned int b)
180 if (test1u(a) != b)
181 abort();
182 if (test2u(a) != b)
183 abort();
184 if (test3u(a) != b)
185 abort();
186 if (test4u(a) != b)
187 abort();
188 if (test5u(a) != b)
189 abort();
190 if (test6u(a) != b)
191 abort();
192 if (test7u(a) != b)
193 abort();
194 if (test8u(a) != b)
195 abort();
196 if (test9u(a) != b)
197 abort();
198 if (test10u(a) != b)
199 abort();
200 if (test11u(a) != b)
201 abort();
202 if (test12u(a) != b)
203 abort();
207 int main()
209 #if INT_MAX == 2147483647
210 test(0x00000000,0x80001234);
211 test(0x00001234,0x80000000);
212 test(0x80000000,0x00001234);
213 test(0x80001234,0x00000000);
214 test(0x7fffffff,0xffffedcb);
215 test(0xffffffff,0x7fffedcb);
217 testu(0x00000000,0x80001234);
218 testu(0x00001234,0x80000000);
219 testu(0x80000000,0x00001234);
220 testu(0x80001234,0x00000000);
221 testu(0x7fffffff,0xffffedcb);
222 testu(0xffffffff,0x7fffedcb);
223 #endif
225 #if INT_MAX == 32767
226 test(0x0000,0x9234);
227 test(0x1234,0x8000);
228 test(0x8000,0x1234);
229 test(0x9234,0x0000);
230 test(0x7fff,0xedcb);
231 test(0xffff,0x6dcb);
233 testu(0x0000,0x9234);
234 testu(0x8000,0x1234);
235 testu(0x1234,0x8000);
236 testu(0x9234,0x0000);
237 testu(0x7fff,0xedcb);
238 testu(0xffff,0x6dcb);
239 #endif
241 return 0;