1 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+v8.4a %s -o - -global-isel=1 -global-isel-abort=1 | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+lse2 %s -o - -global-isel=1 -global-isel-abort=1 | FileCheck %s
4 define void @test_atomic_load(ptr %addr) {
5 ; CHECK-LABEL: test_atomic_load:
7 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0]
8 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
9 ; CHECK: mov v[[Q]].d[1], [[HI]]
10 ; CHECK: str q[[Q]], [x0]
11 %res.0 = load atomic i128, ptr %addr monotonic, align 16
12 store i128 %res.0, ptr %addr
14 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0]
15 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
16 ; CHECK: mov v[[Q]].d[1], [[HI]]
17 ; CHECK: str q[[Q]], [x0]
18 %res.1 = load atomic i128, ptr %addr unordered, align 16
19 store i128 %res.1, ptr %addr
21 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0]
23 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
24 ; CHECK: mov v[[Q]].d[1], [[HI]]
25 ; CHECK: str q[[Q]], [x0]
26 %res.2 = load atomic i128, ptr %addr acquire, align 16
27 store i128 %res.2, ptr %addr
29 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0]
31 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
32 ; CHECK: mov v[[Q]].d[1], [[HI]]
33 ; CHECK: str q[[Q]], [x0]
34 %res.3 = load atomic i128, ptr %addr seq_cst, align 16
35 store i128 %res.3, ptr %addr
38 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0, #8]
39 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
40 ; CHECK: mov v[[Q]].d[1], [[HI]]
41 ; CHECK: str q[[Q]], [x0]
42 %addr8.1 = getelementptr i8, ptr %addr, i32 8
43 %res.5 = load atomic i128, ptr %addr8.1 monotonic, align 16
44 store i128 %res.5, ptr %addr
46 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0, #504]
47 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
48 ; CHECK: mov v[[Q]].d[1], [[HI]]
49 ; CHECK: str q[[Q]], [x0]
50 %addr8.2 = getelementptr i8, ptr %addr, i32 504
51 %res.6 = load atomic i128, ptr %addr8.2 monotonic, align 16
52 store i128 %res.6, ptr %addr
54 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x0, #-512]
55 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
56 ; CHECK: mov v[[Q]].d[1], [[HI]]
57 ; CHECK: str q[[Q]], [x0]
58 %addr8.3 = getelementptr i8, ptr %addr, i32 -512
59 %res.7 = load atomic i128, ptr %addr8.3 monotonic, align 16
60 store i128 %res.7, ptr %addr
65 define void @test_libcall_load(ptr %addr) {
66 ; CHECK-LABEL: test_libcall_load:
67 ; CHECK: bl __atomic_load
68 %res.8 = load atomic i128, ptr %addr unordered, align 8
69 store i128 %res.8, ptr %addr
74 define void @test_nonfolded_load1(ptr %addr) {
75 ; CHECK-LABEL: test_nonfolded_load1:
77 ; CHECK: add x[[ADDR:[0-9]+]], x0, #4
78 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x[[ADDR]]]
79 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
80 ; CHECK: mov v[[Q]].d[1], [[HI]]
81 ; CHECK: str q[[Q]], [x0]
82 %addr8.1 = getelementptr i8, ptr %addr, i32 4
83 %res.1 = load atomic i128, ptr %addr8.1 monotonic, align 16
84 store i128 %res.1, ptr %addr
89 define void @test_nonfolded_load2(ptr %addr) {
90 ; CHECK-LABEL: test_nonfolded_load2:
92 ; CHECK: add x[[ADDR:[0-9]+]], x0, #512
93 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x[[ADDR]]]
94 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
95 ; CHECK: mov v[[Q]].d[1], [[HI]]
96 ; CHECK: str q[[Q]], [x0]
97 %addr8.1 = getelementptr i8, ptr %addr, i32 512
98 %res.1 = load atomic i128, ptr %addr8.1 monotonic, align 16
99 store i128 %res.1, ptr %addr
104 define void @test_nonfolded_load3(ptr %addr) {
105 ; CHECK-LABEL: test_nonfolded_load3:
107 ; CHECK: sub x[[ADDR:[0-9]+]], x0, #520
108 ; CHECK: ldp [[LO:x[0-9]+]], [[HI:x[0-9]+]], [x[[ADDR]]]
109 ; CHECK: mov v[[Q:[0-9]+]].d[0], [[LO]]
110 ; CHECK: mov v[[Q]].d[1], [[HI]]
111 ; CHECK: str q[[Q]], [x0]
112 %addr8.1 = getelementptr i8, ptr %addr, i32 -520
113 %res.1 = load atomic i128, ptr %addr8.1 monotonic, align 16
114 store i128 %res.1, ptr %addr
119 define void @test_atomic_store(ptr %addr, i128 %val) {
120 ; CHECK-LABEL: test_atomic_store:
122 ; CHECK: stp x2, x3, [x0]
123 store atomic i128 %val, ptr %addr monotonic, align 16
125 ; CHECK: stp x2, x3, [x0]
126 store atomic i128 %val, ptr %addr unordered, align 16
129 ; CHECK: stp x2, x3, [x0]
130 store atomic i128 %val, ptr %addr release, align 16
133 ; CHECK: stp x2, x3, [x0]
135 store atomic i128 %val, ptr %addr seq_cst, align 16
138 ; CHECK: stp x2, x3, [x0, #8]
139 %addr8.1 = getelementptr i8, ptr %addr, i32 8
140 store atomic i128 %val, ptr %addr8.1 monotonic, align 16
142 ; CHECK: stp x2, x3, [x0, #504]
143 %addr8.2 = getelementptr i8, ptr %addr, i32 504
144 store atomic i128 %val, ptr %addr8.2 monotonic, align 16
146 ; CHECK: stp x2, x3, [x0, #-512]
147 %addr8.3 = getelementptr i8, ptr %addr, i32 -512
148 store atomic i128 %val, ptr %addr8.3 monotonic, align 16
153 define void @test_libcall_store(ptr %addr, i128 %val) {
154 ; CHECK-LABEL: test_libcall_store:
155 ; CHECK: bl __atomic_store
156 store atomic i128 %val, ptr %addr unordered, align 8
161 define void @test_nonfolded_store1(ptr %addr, i128 %val) {
162 ; CHECK-LABEL: test_nonfolded_store1:
164 ; CHECK: add x[[ADDR:[0-9]+]], x0, #4
165 ; CHECK: stp x2, x3, [x[[ADDR]]]
166 %addr8.1 = getelementptr i8, ptr %addr, i32 4
167 store atomic i128 %val, ptr %addr8.1 monotonic, align 16
172 define void @test_nonfolded_store2(ptr %addr, i128 %val) {
173 ; CHECK-LABEL: test_nonfolded_store2:
175 ; CHECK: add x[[ADDR:[0-9]+]], x0, #512
176 ; CHECK: stp x2, x3, [x[[ADDR]]]
177 %addr8.1 = getelementptr i8, ptr %addr, i32 512
178 store atomic i128 %val, ptr %addr8.1 monotonic, align 16
183 define void @test_nonfolded_store3(ptr %addr, i128 %val) {
184 ; CHECK-LABEL: test_nonfolded_store3:
186 ; CHECK: sub x[[ADDR:[0-9]+]], x0, #520
187 ; CHECK: stp x2, x3, [x[[ADDR]]]
188 %addr8.1 = getelementptr i8, ptr %addr, i32 -520
189 store atomic i128 %val, ptr %addr8.1 monotonic, align 16