1 //===-- ashrti3_test.c - Test __ashrti3 -----------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __ashrti3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
19 // Returns: arithmetic a >> b
21 // Precondition: 0 <= b < bits_in_tword
23 ti_int
__ashrti3(ti_int a
, si_int b
);
25 int test__ashrti3(ti_int a
, si_int b
, ti_int expected
)
27 ti_int x
= __ashrti3(a
, b
);
35 expectedt
.all
= expected
;
36 printf("error in __ashrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX,"
37 " expected 0x%llX%.16llX\n",
38 at
.s
.high
, at
.s
.low
, b
, xt
.s
.high
, xt
.s
.low
,
39 expectedt
.s
.high
, expectedt
.s
.low
);
44 char assumption_1
[sizeof(ti_int
) == 2*sizeof(di_int
)] = {0};
51 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 0,
52 make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
)))
54 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 1,
55 make_ti(0xFF6E5D4C3B2A190ALL
, 0xFF6E5D4C3B2A190ALL
)))
57 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 2,
58 make_ti(0xFFB72EA61D950C85LL
, 0x7FB72EA61D950C85LL
)))
60 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 3,
61 make_ti(0xFFDB97530ECA8642LL
, 0xBFDB97530ECA8642LL
)))
63 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 4,
64 make_ti(0xFFEDCBA987654321LL
, 0x5FEDCBA987654321LL
)))
67 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 28,
68 make_ti(0xFFFFFFFFEDCBA987LL
, 0x6543215FEDCBA987LL
)))
70 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 29,
71 make_ti(0xFFFFFFFFF6E5D4C3LL
, 0xB2A190AFF6E5D4C3LL
)))
73 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 30,
74 make_ti(0xFFFFFFFFFB72EA61LL
, 0xD950C857FB72EA61LL
)))
76 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 31,
77 make_ti(0xFFFFFFFFFDB97530LL
, 0xECA8642BFDB97530LL
)))
80 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 32,
81 make_ti(0xFFFFFFFFFEDCBA98LL
, 0x76543215FEDCBA98LL
)))
84 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 33,
85 make_ti(0xFFFFFFFFFF6E5D4CLL
, 0x3B2A190AFF6E5D4CLL
)))
87 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 34,
88 make_ti(0xFFFFFFFFFFB72EA6LL
, 0x1D950C857FB72EA6LL
)))
90 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 35,
91 make_ti(0xFFFFFFFFFFDB9753LL
, 0x0ECA8642BFDB9753LL
)))
93 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 36,
94 make_ti(0xFFFFFFFFFFEDCBA9LL
, 0x876543215FEDCBA9LL
)))
97 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 60,
98 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xEDCBA9876543215FLL
)))
100 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 61,
101 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xF6E5D4C3B2A190AFLL
)))
103 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 62,
104 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFB72EA61D950C857LL
)))
106 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 63,
107 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFDB97530ECA8642BLL
)))
110 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 64,
111 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFEDCBA9876543215LL
)))
114 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 65,
115 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFF6E5D4C3B2A190ALL
)))
117 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 66,
118 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFB72EA61D950C85LL
)))
120 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 67,
121 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFDB97530ECA8642LL
)))
123 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 68,
124 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFEDCBA987654321LL
)))
127 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 92,
128 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFEDCBA987LL
)))
130 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 93,
131 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFF6E5D4C3LL
)))
133 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 94,
134 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFB72EA61LL
)))
136 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 95,
137 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFDB97530LL
)))
140 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 96,
141 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFEDCBA98LL
)))
144 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 97,
145 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFF6E5D4CLL
)))
147 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 98,
148 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFB72EA6LL
)))
150 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 99,
151 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFDB9753LL
)))
153 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 100,
154 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFEDCBA9LL
)))
157 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 124,
158 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))
160 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 125,
161 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))
163 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 126,
164 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))
166 if (test__ashrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 127,
167 make_ti(0xFFFFFFFFFFFFFFFFLL
, 0xFFFFFFFFFFFFFFFFLL
)))