@@ -21,6 +21,36 @@ long test_InterlockedAdd_constant(long volatile *Addend) {
2121// CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
2222// CHECK-LINUX: error: call to undeclared function '_InterlockedAdd'
2323
24+ long test_InterlockedAdd_acq (long volatile * Addend , long Value ) {
25+ return _InterlockedAdd_acq (Addend , Value );
26+ }
27+
28+ // CHECK-LABEL: define {{.*}} i32 @test_InterlockedAdd_acq(ptr %Addend, i32 %Value) {{.*}} {
29+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i32 %2 acquire, align 4
30+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %2
31+ // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
32+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_acq'
33+
34+ long test_InterlockedAdd_nf (long volatile * Addend , long Value ) {
35+ return _InterlockedAdd_nf (Addend , Value );
36+ }
37+
38+ // CHECK-LABEL: define {{.*}} i32 @test_InterlockedAdd_nf(ptr %Addend, i32 %Value) {{.*}} {
39+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i32 %2 monotonic, align 4
40+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %2
41+ // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
42+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_nf'
43+
44+ long test_InterlockedAdd_rel (long volatile * Addend , long Value ) {
45+ return _InterlockedAdd_rel (Addend , Value );
46+ }
47+
48+ // CHECK-LABEL: define {{.*}} i32 @test_InterlockedAdd_rel(ptr %Addend, i32 %Value) {{.*}} {
49+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i32 %2 release, align 4
50+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i32 %[[OLDVAL:[0-9]+]], %2
51+ // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
52+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_rel'
53+
2454__int64 test_InterlockedAdd64 (__int64 volatile * Addend , __int64 Value ) {
2555 return _InterlockedAdd64 (Addend , Value );
2656}
@@ -35,6 +65,36 @@ __int64 test_InterlockedAdd64_constant(__int64 volatile *Addend) {
3565// CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]]
3666// CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64'
3767
68+ __int64 test_InterlockedAdd64_acq (__int64 volatile * Addend , __int64 Value ) {
69+ return _InterlockedAdd64_acq (Addend , Value );
70+ }
71+
72+ // CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64_acq(ptr %Addend, i64 %Value) {{.*}} {
73+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 acquire, align 8
74+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2
75+ // CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]]
76+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64_acq'
77+
78+ __int64 test_InterlockedAdd64_nf (__int64 volatile * Addend , __int64 Value ) {
79+ return _InterlockedAdd64_nf (Addend , Value );
80+ }
81+
82+ // CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64_nf(ptr %Addend, i64 %Value) {{.*}} {
83+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 monotonic, align 8
84+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2
85+ // CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]]
86+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64_nf'
87+
88+ __int64 test_InterlockedAdd64_rel (__int64 volatile * Addend , __int64 Value ) {
89+ return _InterlockedAdd64_rel (Addend , Value );
90+ }
91+
92+ // CHECK-LABEL: define {{.*}} i64 @test_InterlockedAdd64_rel(ptr %Addend, i64 %Value) {{.*}} {
93+ // CHECK-MSVC: %[[OLDVAL:[0-9]+]] = atomicrmw add ptr %1, i64 %2 release, align 8
94+ // CHECK-MSVC: %[[NEWVAL:[0-9]+]] = add i64 %[[OLDVAL:[0-9]+]], %2
95+ // CHECK-MSVC: ret i64 %[[NEWVAL:[0-9]+]]
96+ // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd64_rel'
97+
3898void check_ReadWriteBarrier (void ) {
3999 _ReadWriteBarrier ();
40100}
0 commit comments