1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_lshrti3
10 // Returns: logical a >> b
12 // Precondition: 0 <= b < bits_in_dword
14 COMPILER_RT_ABI ti_int
__lshrti3(ti_int a
, int b
);
16 int test__lshrti3(ti_int a
, int b
, ti_int expected
) {
17 ti_int x
= __lshrti3(a
, b
);
24 expectedt
.all
= expected
;
25 printf("error in __lshrti3: 0x%llX%.16llX >> %d = 0x%llX%.16llX,"
26 " expected 0x%llX%.16llX\n",
27 at
.s
.high
, at
.s
.low
, b
, xt
.s
.high
, xt
.s
.low
, expectedt
.s
.high
,
33 char assumption_1
[sizeof(ti_int
) == 2*sizeof(di_int
)] = {0};
40 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 0,
41 make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
)))
43 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 1,
44 make_ti(0x7F6E5D4C3B2A190ALL
, 0xFF6E5D4C3B2A190ALL
)))
46 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 2,
47 make_ti(0x3FB72EA61D950C85LL
, 0x7FB72EA61D950C85LL
)))
49 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 3,
50 make_ti(0x1FDB97530ECA8642LL
, 0xBFDB97530ECA8642LL
)))
52 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 4,
53 make_ti(0x0FEDCBA987654321LL
, 0x5FEDCBA987654321LL
)))
56 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 28,
57 make_ti(0x0000000FEDCBA987LL
, 0x6543215FEDCBA987LL
)))
59 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 29,
60 make_ti(0x00000007F6E5D4C3LL
, 0xB2A190AFF6E5D4C3LL
)))
62 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 30,
63 make_ti(0x00000003FB72EA61LL
, 0xD950C857FB72EA61LL
)))
65 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 31,
66 make_ti(0x00000001FDB97530LL
, 0xECA8642BFDB97530LL
)))
69 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 32,
70 make_ti(0x00000000FEDCBA98LL
, 0x76543215FEDCBA98LL
)))
73 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 33,
74 make_ti(0x000000007F6E5D4CLL
, 0x3B2A190AFF6E5D4CLL
)))
76 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 34,
77 make_ti(0x000000003FB72EA6LL
, 0x1D950C857FB72EA6LL
)))
79 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 35,
80 make_ti(0x000000001FDB9753LL
, 0x0ECA8642BFDB9753LL
)))
82 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 36,
83 make_ti(0x000000000FEDCBA9LL
, 0x876543215FEDCBA9LL
)))
86 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 60,
87 make_ti(0x000000000000000FLL
, 0xEDCBA9876543215FLL
)))
89 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 61,
90 make_ti(0x0000000000000007LL
, 0xF6E5D4C3B2A190AFLL
)))
92 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 62,
93 make_ti(0x0000000000000003LL
, 0xFB72EA61D950C857LL
)))
95 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 63,
96 make_ti(0x0000000000000001LL
, 0xFDB97530ECA8642BLL
)))
99 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 64,
100 make_ti(0x0000000000000000LL
, 0xFEDCBA9876543215LL
)))
103 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 65,
104 make_ti(0x0000000000000000LL
, 0x7F6E5D4C3B2A190ALL
)))
106 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 66,
107 make_ti(0x0000000000000000LL
, 0x3FB72EA61D950C85LL
)))
109 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 67,
110 make_ti(0x0000000000000000LL
, 0x1FDB97530ECA8642LL
)))
112 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 68,
113 make_ti(0x0000000000000000LL
, 0x0FEDCBA987654321LL
)))
116 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 92,
117 make_ti(0x0000000000000000LL
, 0x0000000FEDCBA987LL
)))
119 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 93,
120 make_ti(0x0000000000000000LL
, 0x00000007F6E5D4C3LL
)))
122 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 94,
123 make_ti(0x0000000000000000LL
, 0x00000003FB72EA61LL
)))
125 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 95,
126 make_ti(0x0000000000000000LL
, 0x00000001FDB97530LL
)))
129 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 96,
130 make_ti(0x0000000000000000LL
, 0x00000000FEDCBA98LL
)))
133 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 97,
134 make_ti(0x0000000000000000LL
, 0x000000007F6E5D4CLL
)))
136 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 98,
137 make_ti(0x0000000000000000LL
, 0x000000003FB72EA6LL
)))
139 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 99,
140 make_ti(0x0000000000000000LL
, 0x000000001FDB9753LL
)))
142 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 100,
143 make_ti(0x0000000000000000LL
, 0x000000000FEDCBA9LL
)))
146 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 124,
147 make_ti(0x0000000000000000LL
, 0x000000000000000FLL
)))
149 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 125,
150 make_ti(0x0000000000000000LL
, 0x0000000000000007LL
)))
152 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 126,
153 make_ti(0x0000000000000000LL
, 0x0000000000000003LL
)))
155 if (test__lshrti3(make_ti(0xFEDCBA9876543215LL
, 0xFEDCBA9876543215LL
), 127,
156 make_ti(0x0000000000000000LL
, 0x0000000000000001LL
)))