simplify-rtx: Simplify ROTATE:HI (X:HI, 8) into BSWAP:HI (X)
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020508-3.c
blob58e15ed40a7a469d463c71d8544b350b7e0537f2
1 #include <limits.h>
3 void abort (void);
4 void exit (int);
6 #ifndef CHAR_BIT
7 #define CHAR_BIT 8
8 #endif
10 #define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
11 #define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
13 #define CHAR_VALUE ((char)0xf234)
14 #define SHORT_VALUE ((short)0xf234)
15 #define INT_VALUE ((int)0xf234)
16 #define LONG_VALUE ((long)0xf2345678L)
17 #define LL_VALUE ((long long)0xf2345678abcdef0LL)
19 #define SHIFT1 4
20 #define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
22 char c = CHAR_VALUE;
23 short s = SHORT_VALUE;
24 int i = INT_VALUE;
25 long l = LONG_VALUE;
26 long long ll = LL_VALUE;
27 int shift1 = SHIFT1;
28 int shift2 = SHIFT2;
30 int
31 main (void)
33 if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1))
34 abort ();
36 if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
37 abort ();
39 if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1))
40 abort ();
42 if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
43 abort ();
45 if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1))
46 abort ();
48 if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1))
49 abort ();
51 if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1))
52 abort ();
54 if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
55 abort ();
57 if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1))
58 abort ();
60 if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1))
61 abort ();
63 if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2))
64 abort ();
66 if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2))
67 abort ();
69 if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1))
70 abort ();
72 if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
73 abort ();
75 if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1))
76 abort ();
78 if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
79 abort ();
81 if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1))
82 abort ();
84 if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1))
85 abort ();
87 if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1))
88 abort ();
90 if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
91 abort ();
93 if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1))
94 abort ();
96 if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1))
97 abort ();
99 if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2))
100 abort ();
102 if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2))
103 abort ();
105 exit (0);