1 ; RUN: llc -mtriple=aarch64-- -O0 -fast-isel -fast-isel-abort=4 -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-- -O0 -fast-isel=0 -global-isel=false -verify-machineinstrs < %s | FileCheck %s
4 ; Note that checking SelectionDAG output isn't strictly necessary, but they
5 ; currently match, so we might as well check both! Feel free to remove SDAG.
7 ; CHECK-LABEL: atomic_store_monotonic_8:
8 ; CHECK-NEXT: // %bb.0:
9 ; CHECK-NEXT: strb w1, [x0]
11 define void @atomic_store_monotonic_8(ptr %p, i8 %val) #0 {
12 store atomic i8 %val, ptr %p monotonic, align 1
16 ; CHECK-LABEL: atomic_store_monotonic_8_off:
17 ; CHECK-NEXT: // %bb.0:
18 ; CHECK-NEXT: strb w1, [x0, #1]
20 define void @atomic_store_monotonic_8_off(ptr %p, i8 %val) #0 {
21 %tmp0 = getelementptr i8, ptr %p, i32 1
22 store atomic i8 %val, ptr %tmp0 monotonic, align 1
26 ; CHECK-LABEL: atomic_store_monotonic_16:
27 ; CHECK-NEXT: // %bb.0:
28 ; CHECK-NEXT: strh w1, [x0]
30 define void @atomic_store_monotonic_16(ptr %p, i16 %val) #0 {
31 store atomic i16 %val, ptr %p monotonic, align 2
35 ; CHECK-LABEL: atomic_store_monotonic_16_off:
36 ; CHECK-NEXT: // %bb.0:
37 ; CHECK-NEXT: strh w1, [x0, #2]
39 define void @atomic_store_monotonic_16_off(ptr %p, i16 %val) #0 {
40 %tmp0 = getelementptr i16, ptr %p, i32 1
41 store atomic i16 %val, ptr %tmp0 monotonic, align 2
45 ; CHECK-LABEL: atomic_store_monotonic_32:
46 ; CHECK-NEXT: // %bb.0:
47 ; CHECK-NEXT: str w1, [x0]
49 define void @atomic_store_monotonic_32(ptr %p, i32 %val) #0 {
50 store atomic i32 %val, ptr %p monotonic, align 4
54 ; CHECK-LABEL: atomic_store_monotonic_32_off:
55 ; CHECK-NEXT: // %bb.0:
56 ; CHECK-NEXT: str w1, [x0, #4]
58 define void @atomic_store_monotonic_32_off(ptr %p, i32 %val) #0 {
59 %tmp0 = getelementptr i32, ptr %p, i32 1
60 store atomic i32 %val, ptr %tmp0 monotonic, align 4
64 ; CHECK-LABEL: atomic_store_monotonic_64:
65 ; CHECK-NEXT: // %bb.0:
66 ; CHECK-NEXT: str x1, [x0]
68 define void @atomic_store_monotonic_64(ptr %p, i64 %val) #0 {
69 store atomic i64 %val, ptr %p monotonic, align 8
73 ; CHECK-LABEL: atomic_store_monotonic_64_off:
74 ; CHECK-NEXT: // %bb.0:
75 ; CHECK-NEXT: str x1, [x0, #8]
77 define void @atomic_store_monotonic_64_off(ptr %p, i64 %val) #0 {
78 %tmp0 = getelementptr i64, ptr %p, i32 1
79 store atomic i64 %val, ptr %tmp0 monotonic, align 8
83 ; CHECK-LABEL: atomic_store_release_8:
84 ; CHECK-NEXT: // %bb.0:
85 ; CHECK-NEXT: stlrb w1, [x0]
87 define void @atomic_store_release_8(ptr %p, i8 %val) #0 {
88 store atomic i8 %val, ptr %p release, align 1
92 ; CHECK-LABEL: atomic_store_release_8_off:
93 ; CHECK-NEXT: // %bb.0:
94 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #1
95 ; CHECK-NEXT: stlrb w1, [[[REG0]]]
97 define void @atomic_store_release_8_off(ptr %p, i8 %val) #0 {
98 %tmp0 = getelementptr i8, ptr %p, i32 1
99 store atomic i8 %val, ptr %tmp0 release, align 1
103 ; CHECK-LABEL: atomic_store_release_16:
104 ; CHECK-NEXT: // %bb.0:
105 ; CHECK-NEXT: stlrh w1, [x0]
107 define void @atomic_store_release_16(ptr %p, i16 %val) #0 {
108 store atomic i16 %val, ptr %p release, align 2
112 ; CHECK-LABEL: atomic_store_release_16_off:
113 ; CHECK-NEXT: // %bb.0:
114 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #2
115 ; CHECK-NEXT: stlrh w1, [[[REG0]]]
117 define void @atomic_store_release_16_off(ptr %p, i16 %val) #0 {
118 %tmp0 = getelementptr i16, ptr %p, i32 1
119 store atomic i16 %val, ptr %tmp0 release, align 2
123 ; CHECK-LABEL: atomic_store_release_32:
124 ; CHECK-NEXT: // %bb.0:
125 ; CHECK-NEXT: stlr w1, [x0]
127 define void @atomic_store_release_32(ptr %p, i32 %val) #0 {
128 store atomic i32 %val, ptr %p release, align 4
132 ; CHECK-LABEL: atomic_store_release_32_off:
133 ; CHECK-NEXT: // %bb.0:
134 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #4
135 ; CHECK-NEXT: stlr w1, [[[REG0]]]
137 define void @atomic_store_release_32_off(ptr %p, i32 %val) #0 {
138 %tmp0 = getelementptr i32, ptr %p, i32 1
139 store atomic i32 %val, ptr %tmp0 release, align 4
143 ; CHECK-LABEL: atomic_store_release_64:
144 ; CHECK-NEXT: // %bb.0:
145 ; CHECK-NEXT: stlr x1, [x0]
147 define void @atomic_store_release_64(ptr %p, i64 %val) #0 {
148 store atomic i64 %val, ptr %p release, align 8
152 ; CHECK-LABEL: atomic_store_release_64_off:
153 ; CHECK-NEXT: // %bb.0:
154 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #8
155 ; CHECK-NEXT: stlr x1, [[[REG0]]]
157 define void @atomic_store_release_64_off(ptr %p, i64 %val) #0 {
158 %tmp0 = getelementptr i64, ptr %p, i32 1
159 store atomic i64 %val, ptr %tmp0 release, align 8
164 ; CHECK-LABEL: atomic_store_seq_cst_8:
165 ; CHECK-NEXT: // %bb.0:
166 ; CHECK-NEXT: stlrb w1, [x0]
168 define void @atomic_store_seq_cst_8(ptr %p, i8 %val) #0 {
169 store atomic i8 %val, ptr %p seq_cst, align 1
173 ; CHECK-LABEL: atomic_store_seq_cst_8_off:
174 ; CHECK-NEXT: // %bb.0:
175 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #1
176 ; CHECK-NEXT: stlrb w1, [[[REG0]]]
178 define void @atomic_store_seq_cst_8_off(ptr %p, i8 %val) #0 {
179 %tmp0 = getelementptr i8, ptr %p, i32 1
180 store atomic i8 %val, ptr %tmp0 seq_cst, align 1
184 ; CHECK-LABEL: atomic_store_seq_cst_16:
185 ; CHECK-NEXT: // %bb.0:
186 ; CHECK-NEXT: stlrh w1, [x0]
188 define void @atomic_store_seq_cst_16(ptr %p, i16 %val) #0 {
189 store atomic i16 %val, ptr %p seq_cst, align 2
193 ; CHECK-LABEL: atomic_store_seq_cst_16_off:
194 ; CHECK-NEXT: // %bb.0:
195 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #2
196 ; CHECK-NEXT: stlrh w1, [[[REG0]]]
198 define void @atomic_store_seq_cst_16_off(ptr %p, i16 %val) #0 {
199 %tmp0 = getelementptr i16, ptr %p, i32 1
200 store atomic i16 %val, ptr %tmp0 seq_cst, align 2
204 ; CHECK-LABEL: atomic_store_seq_cst_32:
205 ; CHECK-NEXT: // %bb.0:
206 ; CHECK-NEXT: stlr w1, [x0]
208 define void @atomic_store_seq_cst_32(ptr %p, i32 %val) #0 {
209 store atomic i32 %val, ptr %p seq_cst, align 4
213 ; CHECK-LABEL: atomic_store_seq_cst_32_off:
214 ; CHECK-NEXT: // %bb.0:
215 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #4
216 ; CHECK-NEXT: stlr w1, [[[REG0]]]
218 define void @atomic_store_seq_cst_32_off(ptr %p, i32 %val) #0 {
219 %tmp0 = getelementptr i32, ptr %p, i32 1
220 store atomic i32 %val, ptr %tmp0 seq_cst, align 4
224 ; CHECK-LABEL: atomic_store_seq_cst_64:
225 ; CHECK-NEXT: // %bb.0:
226 ; CHECK-NEXT: stlr x1, [x0]
228 define void @atomic_store_seq_cst_64(ptr %p, i64 %val) #0 {
229 store atomic i64 %val, ptr %p seq_cst, align 8
233 ; CHECK-LABEL: atomic_store_seq_cst_64_off:
234 ; CHECK-NEXT: // %bb.0:
235 ; CHECK-NEXT: add [[REG0:x[0-9]+]], x0, #8
236 ; CHECK-NEXT: stlr x1, [[[REG0]]]
238 define void @atomic_store_seq_cst_64_off(ptr %p, i64 %val) #0 {
239 %tmp0 = getelementptr i64, ptr %p, i32 1
240 store atomic i64 %val, ptr %tmp0 seq_cst, align 8
244 attributes #0 = { nounwind }