7
7
// RUN: %clang_cc1 -triple riscv64 -target-feature +a -O1 -emit-llvm %s -o - \
8
8
// RUN: | FileCheck %s -check-prefix=RV64IA
9
9
10
- // This test demonstrates that MaxAtomicInlineWidth is set appropriately when
11
- // the atomics instruction set extension is enabled.
12
-
13
10
#include <stdatomic.h>
14
11
#include <stdint.h>
15
12
16
13
void test_i8_atomics (_Atomic (int8_t ) * a , int8_t b ) {
17
- // RV32I: call zeroext i8 @__atomic_load_1
18
- // RV32I: call void @__atomic_store_1
19
- // RV32I: call zeroext i8 @__atomic_fetch_add_1
14
+ // RV32I: load atomic i8, ptr %a seq_cst, align 1
15
+ // RV32I: store atomic i8 %b, ptr %a seq_cst, align 1
16
+ // RV32I: atomicrmw add ptr %a, i8 %b seq_cst, align 1
20
17
// RV32IA: load atomic i8, ptr %a seq_cst, align 1
21
18
// RV32IA: store atomic i8 %b, ptr %a seq_cst, align 1
22
19
// RV32IA: atomicrmw add ptr %a, i8 %b seq_cst, align 1
23
- // RV64I: call zeroext i8 @__atomic_load_1
24
- // RV64I: call void @__atomic_store_1
25
- // RV64I: call zeroext i8 @__atomic_fetch_add_1
20
+ // RV64I: load atomic i8, ptr %a seq_cst, align 1
21
+ // RV64I: store atomic i8 %b, ptr %a seq_cst, align 1
22
+ // RV64I: atomicrmw add ptr %a, i8 %b seq_cst, align 1
26
23
// RV64IA: load atomic i8, ptr %a seq_cst, align 1
27
24
// RV64IA: store atomic i8 %b, ptr %a seq_cst, align 1
28
25
// RV64IA: atomicrmw add ptr %a, i8 %b seq_cst, align 1
@@ -32,15 +29,15 @@ void test_i8_atomics(_Atomic(int8_t) * a, int8_t b) {
32
29
}
33
30
34
31
void test_i32_atomics (_Atomic (int32_t ) * a , int32_t b ) {
35
- // RV32I: call i32 @__atomic_load_4
36
- // RV32I: call void @__atomic_store_4
37
- // RV32I: call i32 @__atomic_fetch_add_4
32
+ // RV32I: load atomic i32, ptr %a seq_cst, align 4
33
+ // RV32I: store atomic i32 %b, ptr %a seq_cst, align 4
34
+ // RV32I: atomicrmw add ptr %a, i32 %b seq_cst, align 4
38
35
// RV32IA: load atomic i32, ptr %a seq_cst, align 4
39
36
// RV32IA: store atomic i32 %b, ptr %a seq_cst, align 4
40
37
// RV32IA: atomicrmw add ptr %a, i32 %b seq_cst, align 4
41
- // RV64I: call signext i32 @__atomic_load_4
42
- // RV64I: call void @__atomic_store_4
43
- // RV64I: call signext i32 @__atomic_fetch_add_4
38
+ // RV64I: load atomic i32, ptr %a seq_cst, align 4
39
+ // RV64I: store atomic i32 %b, ptr %a seq_cst, align 4
40
+ // RV64I: atomicrmw add ptr %a, i32 %b seq_cst, align 4
44
41
// RV64IA: load atomic i32, ptr %a seq_cst, align 4
45
42
// RV64IA: store atomic i32 %b, ptr %a seq_cst, align 4
46
43
// RV64IA: atomicrmw add ptr %a, i32 %b seq_cst, align 4
@@ -50,15 +47,15 @@ void test_i32_atomics(_Atomic(int32_t) * a, int32_t b) {
50
47
}
51
48
52
49
void test_i64_atomics (_Atomic (int64_t ) * a , int64_t b ) {
53
- // RV32I: call i64 @__atomic_load_8
54
- // RV32I: call void @__atomic_store_8
55
- // RV32I: call i64 @__atomic_fetch_add_8
56
- // RV32IA: call i64 @__atomic_load_8
57
- // RV32IA: call void @__atomic_store_8
58
- // RV32IA: call i64 @__atomic_fetch_add_8
59
- // RV64I: call i64 @__atomic_load_8
60
- // RV64I: call void @__atomic_store_8
61
- // RV64I: call i64 @__atomic_fetch_add_8
50
+ // RV32I: load atomic i64, ptr %a seq_cst, align 8
51
+ // RV32I: store atomic i64 %b, ptr %a seq_cst, align 8
52
+ // RV32I: atomicrmw add ptr %a, i64 %b seq_cst, align 8
53
+ // RV32IA: load atomic i64, ptr %a seq_cst, align 8
54
+ // RV32IA: store atomic i64 %b, ptr %a seq_cst, align 8
55
+ // RV32IA: atomicrmw add ptr %a, i64 %b seq_cst, align 8
56
+ // RV64I: load atomic i64, ptr %a seq_cst, align 8
57
+ // RV64I: store atomic i64 %b, ptr %a seq_cst, align 8
58
+ // RV64I: atomicrmw add ptr %a, i64 %b seq_cst, align 8
62
59
// RV64IA: load atomic i64, ptr %a seq_cst, align 8
63
60
// RV64IA: store atomic i64 %b, ptr %a seq_cst, align 8
64
61
// RV64IA: atomicrmw add ptr %a, i64 %b seq_cst, align 8
0 commit comments