1 // RUN: %clang_cc1 -triple arm64-windows -Wno-implicit-function-declaration -fms-compatibility -emit-llvm -o - %s \
2 // RUN: | FileCheck %s --check-prefix=CHECK-MSVC --check-prefix=CHECK-MSCOMPAT
4 // RUN: not %clang_cc1 -triple arm64-linux -Werror -S -o /dev/null %s 2>&1 \
5 // RUN: | FileCheck %s -check-prefix CHECK-LINUX
7 // RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration -fms-compatibility -emit-llvm -o - %s \
8 // RUN: | FileCheck %s -check-prefix CHECK-MSCOMPAT
10 long test_InterlockedAdd(long volatile *Addend
, long Value
) {
11 return _InterlockedAdd(Addend
, Value
);
14 long test_InterlockedAdd_constant(long volatile *Addend
) {
15 return _InterlockedAdd(Addend
, -1);
18 // CHECK-LABEL: define {{.*}} i32 @test_InterlockedAdd(ptr %Addend, i32 %Value) {{.*}} {
19 // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i32 %2 seq_cst, align 4
20 // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %2
21 // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
22 // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd'
24 __int64
test_InterlockedAdd64(__int64
volatile *Addend
, __int64 Value
) {
25 return _InterlockedAdd64(Addend
, Value
);
28 __int64
test_InterlockedAdd64_constant(__int64
volatile *Addend
) {
29 return _InterlockedAdd64(Addend
, -1);
32 // CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64(ptr %Addend, i64 %Value) {{.*}} {
33 // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 seq_cst, align 8
34 // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2
35 // CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]]
36 // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64'
38 void check__dmb(void) {
42 // CHECK-MSVC: @llvm.aarch64.dmb(i32 0)
43 // CHECK-LINUX: error: call to undeclared function '__dmb'
45 void check__dsb(void) {
49 // CHECK-MSVC: @llvm.aarch64.dsb(i32 0)
50 // CHECK-LINUX: error: call to undeclared function '__dsb'
52 void check__isb(void) {
56 // CHECK-MSVC: @llvm.aarch64.isb(i32 0)
57 // CHECK-LINUX: error: call to undeclared function '__isb'
59 void check__yield(void) {
63 // CHECK-MSVC: @llvm.aarch64.hint(i32 1)
64 // CHECK-LINUX: error: call to undeclared function '__yield'
66 void check__wfe(void) {
70 // CHECK-MSVC: @llvm.aarch64.hint(i32 2)
71 // CHECK-LINUX: error: call to undeclared function '__wfe'
73 void check__wfi(void) {
77 // CHECK-MSVC: @llvm.aarch64.hint(i32 3)
78 // CHECK-LINUX: error: call to undeclared function '__wfi'
80 void check__sev(void) {
84 // CHECK-MSVC: @llvm.aarch64.hint(i32 4)
85 // CHECK-LINUX: error: call to undeclared function '__sev'
87 void check__sevl(void) {
91 // CHECK-MSVC: @llvm.aarch64.hint(i32 5)
92 // CHECK-LINUX: error: call to undeclared function '__sevl'
94 void check_ReadWriteBarrier(void) {
98 // CHECK-MSVC: fence syncscope("singlethread")
99 // CHECK-LINUX: error: call to undeclared function '_ReadWriteBarrier'
101 long long check_mulh(long long a
, long long b
) {
105 // CHECK-MSVC: %[[ARG1:.*]] = sext i64 {{.*}} to i128
106 // CHECK-MSVC: %[[ARG2:.*]] = sext i64 {{.*}} to i128
107 // CHECK-MSVC: %[[PROD:.*]] = mul nsw i128 %[[ARG1]], %[[ARG2]]
108 // CHECK-MSVC: %[[HIGH:.*]] = ashr i128 %[[PROD]], 64
109 // CHECK-MSVC: %[[RES:.*]] = trunc i128 %[[HIGH]] to i64
110 // CHECK-LINUX: error: call to undeclared function '__mulh'
112 unsigned long long check_umulh(unsigned long long a
, unsigned long long b
) {
113 return __umulh(a
, b
);
116 // CHECK-MSVC: %[[ARG1:.*]] = zext i64 {{.*}} to i128
117 // CHECK-MSVC: %[[ARG2:.*]] = zext i64 {{.*}} to i128
118 // CHECK-MSVC: %[[PROD:.*]] = mul nuw i128 %[[ARG1]], %[[ARG2]]
119 // CHECK-MSVC: %[[HIGH:.*]] = lshr i128 %[[PROD]], 64
120 // CHECK-MSVC: %[[RES:.*]] = trunc i128 %[[HIGH]] to i64
121 // CHECK-LINUX: error: call to undeclared function '__umulh'
123 void check__break() {
127 // CHECK-MSVC: call void @llvm.aarch64.break(i32 0)
128 // CHECK-LINUX: error: call to undeclared function '__break'
132 __hlt(1, 2, 3, 4, 5);
136 // CHECK-MSVC: call void @llvm.aarch64.hlt(i32 0)
137 // CHECK-LINUX: error: call to undeclared function '__hlt'
139 unsigned __int64
check__getReg(void) {
140 unsigned volatile __int64 reg
;
146 // CHECK-MSCOMPAT: call i64 @llvm.read_register.i64(metadata ![[MD2:.*]])
147 // CHECK-MSCOMPAT: call i64 @llvm.read_register.i64(metadata ![[MD3:.*]])
156 void check__writex18byte(unsigned char data
, unsigned LONG offset
) {
158 void check__writex18byte(unsigned LONG offset
, unsigned char data
) {
160 __writex18byte(offset
, data
);
163 // CHECK-MSCOMPAT: %[[DATA_ADDR:.*]] = alloca i8, align 1
164 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
165 // CHECK-MSCOMPAT: store i8 %data, ptr %[[DATA_ADDR]], align 1
166 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
167 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
168 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
169 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
170 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
171 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
172 // CHECK-MSCOMPAT: %[[DATA:.*]] = load i8, ptr %[[DATA_ADDR]], align 1
173 // CHECK-MSCOMPAT: store i8 %[[DATA]], ptr %[[PTR]], align 1
176 void check__writex18word(unsigned short data
, unsigned LONG offset
) {
178 void check__writex18word(unsigned LONG offset
, unsigned short data
) {
180 __writex18word(offset
, data
);
183 // CHECK-MSCOMPAT: %[[DATA_ADDR:.*]] = alloca i16, align 2
184 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
185 // CHECK-MSCOMPAT: store i16 %data, ptr %[[DATA_ADDR]], align 2
186 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
187 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
188 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
189 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
190 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
191 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
192 // CHECK-MSCOMPAT: %[[DATA:.*]] = load i16, ptr %[[DATA_ADDR]], align 2
193 // CHECK-MSCOMPAT: store i16 %[[DATA]], ptr %[[PTR]], align 1
196 void check__writex18dword(unsigned LONG data
, unsigned LONG offset
) {
198 void check__writex18dword(unsigned LONG offset
, unsigned LONG data
) {
200 __writex18dword(offset
, data
);
203 // CHECK-MSCOMPAT: %[[DATA_ADDR:.*]] = alloca i32, align 4
204 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
205 // CHECK-MSCOMPAT: store i32 %data, ptr %[[DATA_ADDR]], align 4
206 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
207 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
208 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
209 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
210 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
211 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
212 // CHECK-MSCOMPAT: %[[DATA:.*]] = load i32, ptr %[[DATA_ADDR]], align 4
213 // CHECK-MSCOMPAT: store i32 %[[DATA]], ptr %[[PTR]], align 1
216 void check__writex18qword(unsigned __int64 data
, unsigned LONG offset
) {
218 void check__writex18qword(unsigned LONG offset
, unsigned __int64 data
) {
220 __writex18qword(offset
, data
);
223 // CHECK-MSCOMPAT: %[[DATA_ADDR:.*]] = alloca i64, align 8
224 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
225 // CHECK-MSCOMPAT: store i64 %data, ptr %[[DATA_ADDR]], align 8
226 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
227 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
228 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
229 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
230 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
231 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
232 // CHECK-MSCOMPAT: %[[DATA:.*]] = load i64, ptr %[[DATA_ADDR]], align 8
233 // CHECK-MSCOMPAT: store i64 %[[DATA]], ptr %[[PTR]], align 1
235 unsigned char check__readx18byte(unsigned LONG offset
) {
236 return __readx18byte(offset
);
239 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
240 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
241 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
242 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
243 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
244 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
245 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
246 // CHECK-MSCOMPAT: %[[RETVAL:.*]] = load i8, ptr %[[PTR]], align 1
247 // CHECK-MSCOMPAT: ret i8 %[[RETVAL]]
249 unsigned short check__readx18word(unsigned LONG offset
) {
250 return __readx18word(offset
);
253 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
254 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
255 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
256 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
257 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
258 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
259 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
260 // CHECK-MSCOMPAT: %[[RETVAL:.*]] = load i16, ptr %[[PTR]], align 1
261 // CHECK-MSCOMPAT: ret i16 %[[RETVAL]]
263 unsigned LONG
check__readx18dword(unsigned LONG offset
) {
264 return __readx18dword(offset
);
267 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
268 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
269 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
270 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
271 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
272 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
273 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
274 // CHECK-MSCOMPAT: %[[RETVAL:.*]] = load i32, ptr %[[PTR]], align 1
275 // CHECK-MSCOMPAT: ret i32 %[[RETVAL]]
277 unsigned __int64
check__readx18qword(unsigned LONG offset
) {
278 return __readx18qword(offset
);
281 // CHECK-MSCOMPAT: %[[OFFSET_ADDR:.*]] = alloca i32, align 4
282 // CHECK-MSCOMPAT: store i32 %offset, ptr %[[OFFSET_ADDR]], align 4
283 // CHECK-MSCOMPAT: %[[X18:.*]] = call i64 @llvm.read_register.i64(metadata ![[MD2]])
284 // CHECK-MSCOMPAT: %[[X18_AS_PTR:.*]] = inttoptr i64 %[[X18]] to ptr
285 // CHECK-MSCOMPAT: %[[OFFSET:.*]] = load i32, ptr %[[OFFSET_ADDR]], align 4
286 // CHECK-MSCOMPAT: %[[ZEXT_OFFSET:.*]] = zext i32 %[[OFFSET]] to i64
287 // CHECK-MSCOMPAT: %[[PTR:.*]] = getelementptr i8, ptr %[[X18_AS_PTR]], i64 %[[ZEXT_OFFSET]]
288 // CHECK-MSCOMPAT: %[[RETVAL:.*]] = load i64, ptr %[[PTR]], align 1
289 // CHECK-MSCOMPAT: ret i64 %[[RETVAL]]
291 double check__CopyDoubleFromInt64(__int64 arg1
) {
292 return _CopyDoubleFromInt64(arg1
);
295 // CHECK-MSCOMPAT: %[[ARG:.*]].addr = alloca i64, align 8
296 // CHECK-MSCOMPAT: store i64 %[[ARG]], ptr %[[ARG]].addr, align 8
297 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i64, ptr %[[ARG]].addr, align 8
298 // CHECK-MSCOMPAT: %[[VAR1:.*]] = bitcast i64 %[[VAR0]] to double
299 // CHECK-MSCOMPAT: ret double %[[VAR1]]
300 // CHECK-LINUX: error: call to undeclared function '_CopyDoubleFromInt64'
302 float check__CopyFloatFromInt32(__int32 arg1
) {
303 return _CopyFloatFromInt32(arg1
);
306 // CHECK-MSCOMPAT: %[[ARG:.*]].addr = alloca i32, align 4
307 // CHECK-MSCOMPAT: store i32 %[[ARG]], ptr %[[ARG]].addr, align 4
308 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i32, ptr %[[ARG]].addr, align 4
309 // CHECK-MSCOMPAT: %[[VAR1:.*]] = bitcast i32 %[[VAR0]] to float
310 // CHECK-MSCOMPAT: ret float %[[VAR1]]
311 // CHECK-LINUX: error: call to undeclared function '_CopyFloatFromInt32'
313 __int32
check__CopyInt32FromFloat(float arg1
) {
314 return _CopyInt32FromFloat(arg1
);
317 // CHECK-MSCOMPAT: %[[ARG:.*]].addr = alloca float, align 4
318 // CHECK-MSCOMPAT: store float %[[ARG]], ptr %[[ARG]].addr, align 4
319 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load float, ptr %[[ARG]].addr, align 4
320 // CHECK-MSCOMPAT: %[[VAR1:.*]] = bitcast float %[[VAR0]] to i32
321 // CHECK-MSCOMPAT: ret i32 %[[VAR1]]
322 // CHECK-LINUX: error: call to undeclared function '_CopyInt32FromFloat'
324 __int64
check__CopyInt64FromDouble(double arg1
) {
325 return _CopyInt64FromDouble(arg1
);
328 // CHECK-MSCOMPAT: %[[ARG:.*]].addr = alloca double, align 8
329 // CHECK-MSCOMPAT: store double %[[ARG]], ptr %[[ARG]].addr, align 8
330 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load double, ptr %[[ARG]].addr, align 8
331 // CHECK-MSCOMPAT: %[[VAR1:.*]] = bitcast double %[[VAR0]] to i64
332 // CHECK-MSCOMPAT: ret i64 %[[VAR1]]
333 // CHECK-LINUX: error: call to undeclared function '_CopyInt64FromDouble'
335 unsigned int check__CountLeadingOnes(unsigned LONG arg1
) {
336 return _CountLeadingOnes(arg1
);
339 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i32, align 4
340 // CHECK-MSCOMPAT: store i32 %[[ARG1]], ptr %[[ARG1]].addr, align 4
341 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i32, ptr %[[ARG1]].addr, align 4
342 // CHECK-MSCOMPAT: %[[VAR1:.*]] = xor i32 %[[VAR0]], -1
343 // CHECK-MSCOMPAT: %[[VAR2:.*]] = call i32 @llvm.ctlz.i32(i32 %1, i1 false)
344 // CHECK-MSCOMPAT: ret i32 %[[VAR2]]
345 // CHECK-LINUX: error: call to undeclared function '_CountLeadingOnes'
347 unsigned int check__CountLeadingOnes64(unsigned __int64 arg1
) {
348 return _CountLeadingOnes64(arg1
);
351 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i64, align 8
352 // CHECK-MSCOMPAT: store i64 %[[ARG1]], ptr %[[ARG1]].addr, align 8
353 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i64, ptr %[[ARG1]].addr, align 8
354 // CHECK-MSCOMPAT: %[[VAR1:.*]] = xor i64 %[[VAR0]], -1
355 // CHECK-MSCOMPAT: %[[VAR2:.*]] = call i64 @llvm.ctlz.i64(i64 %1, i1 false)
356 // CHECK-MSCOMPAT: %[[VAR3:.*]] = trunc i64 %2 to i32
357 // CHECK-MSCOMPAT: ret i32 %[[VAR3]]
358 // CHECK-LINUX: error: call to undeclared function '_CountLeadingOnes64'
360 unsigned int check__CountLeadingSigns(__int32 arg1
) {
361 return _CountLeadingSigns(arg1
);
364 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i32, align 4
365 // CHECK-MSCOMPAT: store i32 %[[ARG1]], ptr %[[ARG1]].addr, align 4
366 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i32, ptr %[[ARG1]].addr, align 4
367 // CHECK-MSCOMPAT: %[[CLS:.*]] = call i32 @llvm.aarch64.cls(i32 %[[VAR0]])
368 // CHECK-MSCOMPAT: ret i32 %[[CLS]]
369 // CHECK-LINUX: error: call to undeclared function '_CountLeadingSigns'
371 unsigned int check__CountLeadingSigns64(__int64 arg1
) {
372 return _CountLeadingSigns64(arg1
);
375 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i64, align 8
376 // CHECK-MSCOMPAT: store i64 %[[ARG1]], ptr %[[ARG1]].addr, align 8
377 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i64, ptr %[[ARG1]].addr, align 8
378 // CHECK-MSCOMPAT: %[[CLS:.*]] = call i32 @llvm.aarch64.cls64(i64 %[[VAR0]])
379 // CHECK-MSCOMPAT: ret i32 %[[CLS]]
380 // CHECK-LINUX: error: call to undeclared function '_CountLeadingSigns64'
382 unsigned int check__CountLeadingZeros(__int32 arg1
) {
383 return _CountLeadingZeros(arg1
);
386 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i32, align 4
387 // CHECK-MSCOMPAT: store i32 %[[ARG1]], ptr %[[ARG1]].addr, align 4
388 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i32, ptr %[[ARG1]].addr, align 4
389 // CHECK-MSCOMPAT: %[[VAR1:.*]] = call i32 @llvm.ctlz.i32(i32 %[[VAR0]], i1 false)
390 // CHECK-MSCOMPAT: ret i32 %[[VAR1]]
391 // CHECK-LINUX: error: call to undeclared function '_CountLeadingZeros'
393 unsigned int check__CountLeadingZeros64(__int64 arg1
) {
394 return _CountLeadingZeros64(arg1
);
397 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i64, align 8
398 // CHECK-MSCOMPAT: store i64 %[[ARG1]], ptr %[[ARG1]].addr, align 8
399 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i64, ptr %[[ARG1]].addr, align 8
400 // CHECK-MSCOMPAT: %[[VAR1:.*]] = call i64 @llvm.ctlz.i64(i64 %[[VAR0]], i1 false)
401 // CHECK-MSCOMPAT: %[[VAR2:.*]] = trunc i64 %[[VAR1]] to i32
402 // CHECK-MSCOMPAT: ret i32 %[[VAR2]]
403 // CHECK-LINUX: error: call to undeclared function '_CountLeadingZeros64'
405 unsigned int check_CountOneBits(unsigned LONG arg1
) {
406 return _CountOneBits(arg1
);
409 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i32, align 4
410 // CHECK-MSCOMPAT: store i32 %[[ARG1]], ptr %[[ARG1]].addr, align 4
411 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i32, ptr %[[ARG1]].addr, align 4
412 // CHECK-MSCOMPAT: %[[VAR1:.*]] = call i32 @llvm.ctpop.i32(i32 %0)
413 // CHECK-MSCOMPAT: ret i32 %[[VAR1]]
414 // CHECK-LINUX: error: call to undeclared function '_CountOneBits'
416 unsigned int check_CountOneBits64(unsigned __int64 arg1
) {
417 return _CountOneBits64(arg1
);
420 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca i64, align 8
421 // CHECK-MSCOMPAT: store i64 %[[ARG1]], ptr %[[ARG1]].addr, align 8
422 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load i64, ptr %[[ARG1]].addr, align 8
423 // CHECK-MSCOMPAT: %[[VAR1:.*]] = call i64 @llvm.ctpop.i64(i64 %0)
424 // CHECK-MSCOMPAT: %[[VAR2:.*]] = trunc i64 %1 to i32
425 // CHECK-MSCOMPAT: ret i32 %[[VAR2]]
426 // CHECK-LINUX: error: call to undeclared function '_CountOneBits64'
428 void check__prefetch(void *arg1
) {
429 return __prefetch(arg1
);
432 // CHECK-MSCOMPAT: %[[ARG1:.*]].addr = alloca ptr, align 8
433 // CHECK-MSCOMPAT: store ptr %[[ARG1]], ptr %[[ARG1]].addr, align 8
434 // CHECK-MSCOMPAT: %[[VAR0:.*]] = load ptr, ptr %[[ARG1]].addr, align 8
435 // CHECK-MSCOMPAT: call void @llvm.prefetch.p0(ptr %[[VAR0]], i32 0, i32 3, i32 1)
436 // CHECK-MSCOMPAT: ret void
439 // CHECK-MSCOMPAT: ![[MD2]] = !{!"x18"}
440 // CHECK-MSCOMPAT: ![[MD3]] = !{!"sp"}