* gcc.c-torture/execute/20101011-1.c: Skip on SH.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20020508-3.c
blobb41adffda9986cc29f13d0e0b10a0749b38474c5
1 #include <limits.h>
3 #ifndef CHAR_BIT
4 #define CHAR_BIT 8
5 #endif
7 #define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b))))
8 #define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b))))
10 #define CHAR_VALUE ((char)0xf234)
11 #define SHORT_VALUE ((short)0xf234)
12 #define INT_VALUE ((int)0xf234)
13 #define LONG_VALUE ((long)0xf2345678L)
14 #define LL_VALUE ((long long)0xf2345678abcdef0LL)
16 #define SHIFT1 4
17 #define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1)
19 char c = CHAR_VALUE;
20 short s = SHORT_VALUE;
21 int i = INT_VALUE;
22 long l = LONG_VALUE;
23 long long ll = LL_VALUE;
24 int shift1 = SHIFT1;
25 int shift2 = SHIFT2;
27 main ()
29 if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1))
30 abort ();
32 if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1))
33 abort ();
35 if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1))
36 abort ();
38 if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1))
39 abort ();
41 if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1))
42 abort ();
44 if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1))
45 abort ();
47 if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1))
48 abort ();
50 if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1))
51 abort ();
53 if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1))
54 abort ();
56 if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1))
57 abort ();
59 if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2))
60 abort ();
62 if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2))
63 abort ();
65 if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1))
66 abort ();
68 if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1))
69 abort ();
71 if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1))
72 abort ();
74 if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1))
75 abort ();
77 if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1))
78 abort ();
80 if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1))
81 abort ();
83 if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1))
84 abort ();
86 if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1))
87 abort ();
89 if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1))
90 abort ();
92 if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1))
93 abort ();
95 if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2))
96 abort ();
98 if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2))
99 abort ();
101 exit (0);