Skip to content

Commit 1d663df

Browse files
committed
test for 64bit versions of interlockedbittestandset_* and interlockedbittestandreset_*
1 parent 605604e commit 1d663df

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

clang/test/CodeGen/bittest-intrin.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 -fms-extensions -triple x86_64-windows-msvc %s -emit-llvm -o - | FileCheck %s --check-prefix=X64
22
// RUN: %clang_cc1 -fms-extensions -triple thumbv7-windows-msvc %s -emit-llvm -o - | FileCheck %s --check-prefix=ARM
3-
// RUN: %clang_cc1 -fms-extensions -triple aarch64-windows-msvc %s -emit-llvm -o - | FileCheck %s --check-prefix=ARM
3+
// RUN: %clang_cc1 -fms-extensions -triple aarch64-windows-msvc %s -emit-llvm -o - | FileCheck %s --check-prefix=ARM64 -check-prefix=ARM
44

55
volatile unsigned char sink = 0;
66
void test32(long *base, long idx) {
@@ -33,6 +33,17 @@ void test_arm(long *base, long idx) {
3333
}
3434
#endif
3535

36+
#if defined(_M_ARM64)
37+
void test_arm64(__int64 *base, __int64 idx) {
38+
sink = _interlockedbittestandreset64_acq(base, idx);
39+
sink = _interlockedbittestandreset64_rel(base, idx);
40+
sink = _interlockedbittestandreset64_nf(base, idx);
41+
sink = _interlockedbittestandset64_acq(base, idx);
42+
sink = _interlockedbittestandset64_rel(base, idx);
43+
sink = _interlockedbittestandset64_nf(base, idx);
44+
}
45+
#endif
46+
3647
// X64-LABEL: define dso_local void @test32(ptr noundef %base, i32 noundef %idx)
3748
// X64: call i8 asm sideeffect "btl $2, ($1)", "={@ccc},r,r,~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(ptr %{{.*}}, i32 {{.*}})
3849
// X64: call i8 asm sideeffect "btcl $2, ($1)", "={@ccc},r,r,~{cc},~{memory},~{dirflag},~{fpsr},~{flags}"(ptr %{{.*}}, i32 {{.*}})
@@ -127,3 +138,11 @@ void test_arm(long *base, long idx) {
127138
// ARM: atomicrmw or ptr %{{.*}}, i8 {{.*}} acquire, align 1
128139
// ARM: atomicrmw or ptr %{{.*}}, i8 {{.*}} release, align 1
129140
// ARM: atomicrmw or ptr %{{.*}}, i8 {{.*}} monotonic, align 1
141+
142+
// ARM64-LABEL: define dso_local void @test_arm64(ptr noundef %base, i64 noundef %idx)
143+
// ARM64: atomicrmw and ptr %{{.*}}, i8 {{.*}} acquire, align 1
144+
// ARM64: atomicrmw and ptr %{{.*}}, i8 {{.*}} release, align 1
145+
// ARM64: atomicrmw and ptr %{{.*}}, i8 {{.*}} monotonic, align 1
146+
// ARM64: atomicrmw or ptr %{{.*}}, i8 {{.*}} acquire, align 1
147+
// ARM64: atomicrmw or ptr %{{.*}}, i8 {{.*}} release, align 1
148+
// ARM64: atomicrmw or ptr %{{.*}}, i8 {{.*}} monotonic, align 1

0 commit comments

Comments
 (0)