1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_ashlti3
12 // Precondition: 0 <= b < bits_in_tword
14 COMPILER_RT_ABI ti_int
__ashlti3(ti_int a
, int b
);
16 int test__ashlti3(ti_int a
, int b
, ti_int expected
) {
17 ti_int x
= __ashlti3(a
, b
);
26 expectedt
.all
= expected
;
27 printf("error in __ashlti3: 0x%llX%.16llX << %d = 0x%llX%.16llX,"
28 " expected 0x%llX%.16llX\n",
29 at
.s
.high
, at
.s
.low
, b
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
,
35 char assumption_1
[sizeof(ti_int
) == 2*sizeof(di_int
)] = {0};
42 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 0,
43 make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
)))
45 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 1,
46 make_ti(0xFDB97530ECA8642BLL
, 0xFDB97530ECA8642ALL
)))
48 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 2,
49 make_ti(0xFB72EA61D950C857LL
, 0XFB72EA61D950C854LL
)))
51 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 3,
52 make_ti(0xF6E5D4C3B2A190AFLL
, 0xF6E5D4C3B2A190A8LL
)))
54 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 4,
55 make_ti(0xEDCBA9876543215FLL
, 0xEDCBA98765432150LL
)))
58 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 28,
59 make_ti(0x876543215FEDCBA9LL
, 0x8765432150000000LL
)))
61 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 29,
62 make_ti(0x0ECA8642BFDB9753LL
, 0x0ECA8642A0000000LL
)))
64 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 30,
65 make_ti(0x1D950C857FB72EA6LL
, 0x1D950C8540000000LL
)))
67 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 31,
68 make_ti(0x3B2A190AFF6E5D4CLL
, 0x3B2A190A80000000LL
)))
71 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 32,
72 make_ti(0x76543215FEDCBA98LL
, 0x7654321500000000LL
)))
75 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 33,
76 make_ti(0xECA8642BFDB97530LL
, 0xECA8642A00000000LL
)))
78 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 34,
79 make_ti(0xD950C857FB72EA61LL
, 0xD950C85400000000LL
)))
81 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 35,
82 make_ti(0xB2A190AFF6E5D4C3LL
, 0xB2A190A800000000LL
)))
84 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 36,
85 make_ti(0x6543215FEDCBA987LL
, 0x6543215000000000LL
)))
88 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 60,
89 make_ti(0x5FEDCBA987654321LL
, 0x5000000000000000LL
)))
91 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 61,
92 make_ti(0xBFDB97530ECA8642LL
, 0xA000000000000000LL
)))
94 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 62,
95 make_ti(0x7FB72EA61D950C85LL
, 0x4000000000000000LL
)))
97 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 63,
98 make_ti(0xFF6E5D4C3B2A190ALL
, 0x8000000000000000LL
)))
101 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 64,
102 make_ti(0xFEDCBA9876543215LL
, 0x0000000000000000LL
)))
105 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 65,
106 make_ti(0xFDB97530ECA8642ALL
, 0x0000000000000000LL
)))
108 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 66,
109 make_ti(0xFB72EA61D950C854LL
, 0x0000000000000000LL
)))
111 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 67,
112 make_ti(0xF6E5D4C3B2A190A8LL
, 0x0000000000000000LL
)))
114 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 68,
115 make_ti(0xEDCBA98765432150LL
, 0x0000000000000000LL
)))
118 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 92,
119 make_ti(0x8765432150000000LL
, 0x0000000000000000LL
)))
121 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 93,
122 make_ti(0x0ECA8642A0000000LL
, 0x0000000000000000LL
)))
124 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 94,
125 make_ti(0x1D950C8540000000LL
, 0x0000000000000000LL
)))
127 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 95,
128 make_ti(0x3B2A190A80000000LL
, 0x0000000000000000LL
)))
131 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 96,
132 make_ti(0x7654321500000000LL
, 0x0000000000000000LL
)))
135 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 97,
136 make_ti(0xECA8642A00000000LL
, 0x0000000000000000LL
)))
138 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 98,
139 make_ti(0xD950C85400000000LL
, 0x0000000000000000LL
)))
141 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 99,
142 make_ti(0xB2A190A800000000LL
, 0x0000000000000000LL
)))
144 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 100,
145 make_ti(0x6543215000000000LL
, 0x0000000000000000LL
)))
148 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 124,
149 make_ti(0x5000000000000000LL
, 0x0000000000000000LL
)))
151 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 125,
152 make_ti(0xA000000000000000LL
, 0x0000000000000000LL
)))
154 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 126,
155 make_ti(0x4000000000000000LL
, 0x0000000000000000LL
)))
157 if (test__ashlti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 127,
158 make_ti(0x8000000000000000LL
, 0x0000000000000000LL
)))