1 //===-- ashlti3_test.c - Test __ashlti3 -----------------------------------===//
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 __ashlti3 for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
21 // Precondition: 0 <= b < bits_in_tword
23 ti_int
__ashlti3(ti_int a
, si_int b
);
25 int test__ashlti3(ti_int a
, si_int b
, ti_int expected
)
27 ti_int x
= __ashlti3(a
, b
);
37 expectedt
.all
= expected
;
38 printf("error in __ashlti3: 0x%llX%.16llX << %d = 0x%llX%.16llX,"
39 " expected 0x%llX%.16llX\n",
40 at
.s
.high
, at
.s
.low
, b
, xt
.s
.high
, xt
.s
.low
,
41 expectedt
.s
.high
, expectedt
.s
.low
);
46 char assumption_1
[sizeof(ti_int
) == 2*sizeof(di_int
)] = {0};
53 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 0,
54 make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
)))
56 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 1,
57 make_ti(0xFDB97530ECA8642BLL
, 0xFDB97530ECA8642ALL
)))
59 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 2,
60 make_ti(0xFB72EA61D950C857LL
, 0XFB72EA61D950C854LL
)))
62 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 3,
63 make_ti(0xF6E5D4C3B2A190AFLL
, 0xF6E5D4C3B2A190A8LL
)))
65 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 4,
66 make_ti(0xEDCBA9876543215FLL
, 0xEDCBA98765432150LL
)))
69 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 28,
70 make_ti(0x876543215FEDCBA9LL
, 0x8765432150000000LL
)))
72 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 29,
73 make_ti(0x0ECA8642BFDB9753LL
, 0x0ECA8642A0000000LL
)))
75 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 30,
76 make_ti(0x1D950C857FB72EA6LL
, 0x1D950C8540000000LL
)))
78 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 31,
79 make_ti(0x3B2A190AFF6E5D4CLL
, 0x3B2A190A80000000LL
)))
82 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 32,
83 make_ti(0x76543215FEDCBA98LL
, 0x7654321500000000LL
)))
86 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 33,
87 make_ti(0xECA8642BFDB97530LL
, 0xECA8642A00000000LL
)))
89 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 34,
90 make_ti(0xD950C857FB72EA61LL
, 0xD950C85400000000LL
)))
92 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 35,
93 make_ti(0xB2A190AFF6E5D4C3LL
, 0xB2A190A800000000LL
)))
95 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 36,
96 make_ti(0x6543215FEDCBA987LL
, 0x6543215000000000LL
)))
99 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 60,
100 make_ti(0x5FEDCBA987654321LL
, 0x5000000000000000LL
)))
102 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 61,
103 make_ti(0xBFDB97530ECA8642LL
, 0xA000000000000000LL
)))
105 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 62,
106 make_ti(0x7FB72EA61D950C85LL
, 0x4000000000000000LL
)))
108 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 63,
109 make_ti(0xFF6E5D4C3B2A190ALL
, 0x8000000000000000LL
)))
112 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 64,
113 make_ti(0xFEDCBA9876543215LL
, 0x0000000000000000LL
)))
116 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 65,
117 make_ti(0xFDB97530ECA8642ALL
, 0x0000000000000000LL
)))
119 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 66,
120 make_ti(0xFB72EA61D950C854LL
, 0x0000000000000000LL
)))
122 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 67,
123 make_ti(0xF6E5D4C3B2A190A8LL
, 0x0000000000000000LL
)))
125 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 68,
126 make_ti(0xEDCBA98765432150LL
, 0x0000000000000000LL
)))
129 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 92,
130 make_ti(0x8765432150000000LL
, 0x0000000000000000LL
)))
132 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 93,
133 make_ti(0x0ECA8642A0000000LL
, 0x0000000000000000LL
)))
135 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 94,
136 make_ti(0x1D950C8540000000LL
, 0x0000000000000000LL
)))
138 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 95,
139 make_ti(0x3B2A190A80000000LL
, 0x0000000000000000LL
)))
142 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 96,
143 make_ti(0x7654321500000000LL
, 0x0000000000000000LL
)))
146 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 97,
147 make_ti(0xECA8642A00000000LL
, 0x0000000000000000LL
)))
149 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 98,
150 make_ti(0xD950C85400000000LL
, 0x0000000000000000LL
)))
152 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 99,
153 make_ti(0xB2A190A800000000LL
, 0x0000000000000000LL
)))
155 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 100,
156 make_ti(0x6543215000000000LL
, 0x0000000000000000LL
)))
159 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 124,
160 make_ti(0x5000000000000000LL
, 0x0000000000000000LL
)))
162 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 125,
163 make_ti(0xA000000000000000LL
, 0x0000000000000000LL
)))
165 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 126,
166 make_ti(0x4000000000000000LL
, 0x0000000000000000LL
)))
168 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 127,
169 make_ti(0x8000000000000000LL
, 0x0000000000000000LL
)))