xref: /llvm-project/llvm/test/CodeGen/X86/pcsections-atomics.ll (revision e6bf48d11047e970cb24554a01b65b566d6b5d22)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2;
3; Test that atomic ops in IR marked with !pcsections end up in a PC section in
4; asm. All functions start with a non-atomic access, continue with an atomic
5; access, and end with another non-atomic access; this is to test that the
6; !pcsections propagation doesn't accidentally touch adjacent instructions.
7;
8; RUN: llc -O0 -mattr=cx16 < %s | FileCheck %s --check-prefixes=O0
9; RUN: llc -O1 -mattr=cx16 < %s | FileCheck %s --check-prefixes=O1
10; RUN: llc -O2 -mattr=cx16 < %s | FileCheck %s --check-prefixes=O2
11; RUN: llc -O3 -mattr=cx16 < %s | FileCheck %s --check-prefixes=O3
12
13target triple = "x86_64-unknown-linux-gnu"
14
15@foo = dso_local global i64 0, align 8
16
17define void @mixed_atomic_non_atomic(ptr %a) {
18; O0-LABEL: mixed_atomic_non_atomic:
19; O0:       # %bb.0: # %entry
20; O0-NEXT:    movl (%rdi), %eax
21; O0-NEXT:    incl %eax
22; O0-NEXT:    movl %eax, (%rdi)
23; O0-NEXT:  .Lpcsection0:
24; O0-NEXT:    movl $1, (%rdi)
25; O0-NEXT:    movl (%rdi), %eax
26; O0-NEXT:    addl $-1, %eax
27; O0-NEXT:    movl %eax, (%rdi)
28; O0-NEXT:    retq
29;
30; O1-LABEL: mixed_atomic_non_atomic:
31; O1:       # %bb.0: # %entry
32; O1-NEXT:    incl (%rdi)
33; O1-NEXT:  .Lpcsection0:
34; O1-NEXT:    movl $1, (%rdi)
35; O1-NEXT:    decl (%rdi)
36; O1-NEXT:    retq
37;
38; O2-LABEL: mixed_atomic_non_atomic:
39; O2:       # %bb.0: # %entry
40; O2-NEXT:    incl (%rdi)
41; O2-NEXT:  .Lpcsection0:
42; O2-NEXT:    movl $1, (%rdi)
43; O2-NEXT:    decl (%rdi)
44; O2-NEXT:    retq
45;
46; O3-LABEL: mixed_atomic_non_atomic:
47; O3:       # %bb.0: # %entry
48; O3-NEXT:    incl (%rdi)
49; O3-NEXT:  .Lpcsection0:
50; O3-NEXT:    movl $1, (%rdi)
51; O3-NEXT:    decl (%rdi)
52; O3-NEXT:    retq
53entry:
54  ; Accesses the same location atomically and non-atomically.
55  %0 = load volatile i32, ptr %a, align 4
56  %inc = add nsw i32 %0, 1
57  store volatile i32 %inc, ptr %a, align 4
58  store atomic volatile i32 1, ptr %a monotonic, align 4, !pcsections !0
59  %1 = load volatile i32, ptr %a, align 4
60  %dec = add nsw i32 %1, -1
61  store volatile i32 %dec, ptr %a, align 4
62  ret void
63}
64
65define i64 @mixed_complex_atomic_non_atomic(ptr %a, ptr %b) {
66; O0-LABEL: mixed_complex_atomic_non_atomic:
67; O0:       # %bb.0: # %entry
68; O0-NEXT:    movl $1, %ecx
69; O0-NEXT:  .Lpcsection1:
70; O0-NEXT:    lock xaddq %rcx, (%rdi)
71; O0-NEXT:    movq (%rsi), %rax
72; O0-NEXT:    movq %rax, %rdx
73; O0-NEXT:    addq $1, %rdx
74; O0-NEXT:    movq %rdx, (%rsi)
75; O0-NEXT:    addq %rcx, %rax
76; O0-NEXT:    retq
77;
78; O1-LABEL: mixed_complex_atomic_non_atomic:
79; O1:       # %bb.0: # %entry
80; O1-NEXT:    movl $1, %eax
81; O1-NEXT:  .Lpcsection1:
82; O1-NEXT:    lock xaddq %rax, (%rdi)
83; O1-NEXT:    movq (%rsi), %rcx
84; O1-NEXT:    leaq 1(%rcx), %rdx
85; O1-NEXT:    movq %rdx, (%rsi)
86; O1-NEXT:    addq %rcx, %rax
87; O1-NEXT:    retq
88;
89; O2-LABEL: mixed_complex_atomic_non_atomic:
90; O2:       # %bb.0: # %entry
91; O2-NEXT:    movl $1, %eax
92; O2-NEXT:  .Lpcsection1:
93; O2-NEXT:    lock xaddq %rax, (%rdi)
94; O2-NEXT:    movq (%rsi), %rcx
95; O2-NEXT:    leaq 1(%rcx), %rdx
96; O2-NEXT:    movq %rdx, (%rsi)
97; O2-NEXT:    addq %rcx, %rax
98; O2-NEXT:    retq
99;
100; O3-LABEL: mixed_complex_atomic_non_atomic:
101; O3:       # %bb.0: # %entry
102; O3-NEXT:    movl $1, %eax
103; O3-NEXT:  .Lpcsection1:
104; O3-NEXT:    lock xaddq %rax, (%rdi)
105; O3-NEXT:    movq (%rsi), %rcx
106; O3-NEXT:    leaq 1(%rcx), %rdx
107; O3-NEXT:    movq %rdx, (%rsi)
108; O3-NEXT:    addq %rcx, %rax
109; O3-NEXT:    retq
110entry:
111  %0 = atomicrmw add ptr %a, i64 1 monotonic, align 8, !pcsections !0
112  %1 = load i64, ptr %b, align 8
113  %inc = add nsw i64 %1, 1
114  store i64 %inc, ptr %b, align 8
115  %add = add nsw i64 %1, %0
116  ret i64 %add
117}
118
119define i8 @atomic8_load_unordered(ptr %a) {
120; O0-LABEL: atomic8_load_unordered:
121; O0:       # %bb.0: # %entry
122; O0-NEXT:    movq foo(%rip), %rax
123; O0-NEXT:  .Lpcsection2:
124; O0-NEXT:    movb (%rdi), %al
125; O0-NEXT:    movq $1, foo
126; O0-NEXT:    retq
127;
128; O1-LABEL: atomic8_load_unordered:
129; O1:       # %bb.0: # %entry
130; O1-NEXT:    movq foo(%rip), %rax
131; O1-NEXT:  .Lpcsection2:
132; O1-NEXT:    movzbl (%rdi), %eax
133; O1-NEXT:    movq $1, foo(%rip)
134; O1-NEXT:    retq
135;
136; O2-LABEL: atomic8_load_unordered:
137; O2:       # %bb.0: # %entry
138; O2-NEXT:    movq foo(%rip), %rax
139; O2-NEXT:  .Lpcsection2:
140; O2-NEXT:    movzbl (%rdi), %eax
141; O2-NEXT:    movq $1, foo(%rip)
142; O2-NEXT:    retq
143;
144; O3-LABEL: atomic8_load_unordered:
145; O3:       # %bb.0: # %entry
146; O3-NEXT:    movq foo(%rip), %rax
147; O3-NEXT:  .Lpcsection2:
148; O3-NEXT:    movzbl (%rdi), %eax
149; O3-NEXT:    movq $1, foo(%rip)
150; O3-NEXT:    retq
151entry:
152  load volatile i64, ptr @foo, align 8
153  %x = load atomic i8, ptr %a unordered, align 1, !pcsections !0
154  store volatile i64 1, ptr @foo, align 8
155  ret i8 %x
156}
157
158define i8 @atomic8_load_monotonic(ptr %a) {
159; O0-LABEL: atomic8_load_monotonic:
160; O0:       # %bb.0: # %entry
161; O0-NEXT:    movq foo(%rip), %rax
162; O0-NEXT:  .Lpcsection3:
163; O0-NEXT:    movb (%rdi), %al
164; O0-NEXT:    movq $1, foo
165; O0-NEXT:    retq
166;
167; O1-LABEL: atomic8_load_monotonic:
168; O1:       # %bb.0: # %entry
169; O1-NEXT:    movq foo(%rip), %rax
170; O1-NEXT:  .Lpcsection3:
171; O1-NEXT:    movzbl (%rdi), %eax
172; O1-NEXT:    movq $1, foo(%rip)
173; O1-NEXT:    retq
174;
175; O2-LABEL: atomic8_load_monotonic:
176; O2:       # %bb.0: # %entry
177; O2-NEXT:    movq foo(%rip), %rax
178; O2-NEXT:  .Lpcsection3:
179; O2-NEXT:    movzbl (%rdi), %eax
180; O2-NEXT:    movq $1, foo(%rip)
181; O2-NEXT:    retq
182;
183; O3-LABEL: atomic8_load_monotonic:
184; O3:       # %bb.0: # %entry
185; O3-NEXT:    movq foo(%rip), %rax
186; O3-NEXT:  .Lpcsection3:
187; O3-NEXT:    movzbl (%rdi), %eax
188; O3-NEXT:    movq $1, foo(%rip)
189; O3-NEXT:    retq
190entry:
191  load volatile i64, ptr @foo, align 8
192  %x = load atomic i8, ptr %a monotonic, align 1, !pcsections !0
193  store volatile i64 1, ptr @foo, align 8
194  ret i8 %x
195}
196
197define i8 @atomic8_load_acquire(ptr %a) {
198; O0-LABEL: atomic8_load_acquire:
199; O0:       # %bb.0: # %entry
200; O0-NEXT:    movq foo(%rip), %rax
201; O0-NEXT:  .Lpcsection4:
202; O0-NEXT:    movb (%rdi), %al
203; O0-NEXT:    movq $1, foo
204; O0-NEXT:    retq
205;
206; O1-LABEL: atomic8_load_acquire:
207; O1:       # %bb.0: # %entry
208; O1-NEXT:    movq foo(%rip), %rax
209; O1-NEXT:  .Lpcsection4:
210; O1-NEXT:    movzbl (%rdi), %eax
211; O1-NEXT:    movq $1, foo(%rip)
212; O1-NEXT:    retq
213;
214; O2-LABEL: atomic8_load_acquire:
215; O2:       # %bb.0: # %entry
216; O2-NEXT:    movq foo(%rip), %rax
217; O2-NEXT:  .Lpcsection4:
218; O2-NEXT:    movzbl (%rdi), %eax
219; O2-NEXT:    movq $1, foo(%rip)
220; O2-NEXT:    retq
221;
222; O3-LABEL: atomic8_load_acquire:
223; O3:       # %bb.0: # %entry
224; O3-NEXT:    movq foo(%rip), %rax
225; O3-NEXT:  .Lpcsection4:
226; O3-NEXT:    movzbl (%rdi), %eax
227; O3-NEXT:    movq $1, foo(%rip)
228; O3-NEXT:    retq
229entry:
230  load volatile i64, ptr @foo, align 8
231  %x = load atomic i8, ptr %a acquire, align 1, !pcsections !0
232  store volatile i64 1, ptr @foo, align 8
233  ret i8 %x
234}
235
236define i8 @atomic8_load_seq_cst(ptr %a) {
237; O0-LABEL: atomic8_load_seq_cst:
238; O0:       # %bb.0: # %entry
239; O0-NEXT:    movq foo(%rip), %rax
240; O0-NEXT:  .Lpcsection5:
241; O0-NEXT:    movb (%rdi), %al
242; O0-NEXT:    movq $1, foo
243; O0-NEXT:    retq
244;
245; O1-LABEL: atomic8_load_seq_cst:
246; O1:       # %bb.0: # %entry
247; O1-NEXT:    movq foo(%rip), %rax
248; O1-NEXT:  .Lpcsection5:
249; O1-NEXT:    movzbl (%rdi), %eax
250; O1-NEXT:    movq $1, foo(%rip)
251; O1-NEXT:    retq
252;
253; O2-LABEL: atomic8_load_seq_cst:
254; O2:       # %bb.0: # %entry
255; O2-NEXT:    movq foo(%rip), %rax
256; O2-NEXT:  .Lpcsection5:
257; O2-NEXT:    movzbl (%rdi), %eax
258; O2-NEXT:    movq $1, foo(%rip)
259; O2-NEXT:    retq
260;
261; O3-LABEL: atomic8_load_seq_cst:
262; O3:       # %bb.0: # %entry
263; O3-NEXT:    movq foo(%rip), %rax
264; O3-NEXT:  .Lpcsection5:
265; O3-NEXT:    movzbl (%rdi), %eax
266; O3-NEXT:    movq $1, foo(%rip)
267; O3-NEXT:    retq
268entry:
269  load volatile i64, ptr @foo, align 8
270  %x = load atomic i8, ptr %a seq_cst, align 1, !pcsections !0
271  store volatile i64 1, ptr @foo, align 8
272  ret i8 %x
273}
274
275define void @atomic8_store_unordered(ptr %a) {
276; O0-LABEL: atomic8_store_unordered:
277; O0:       # %bb.0: # %entry
278; O0-NEXT:    movq foo(%rip), %rax
279; O0-NEXT:  .Lpcsection6:
280; O0-NEXT:    movb $42, (%rdi)
281; O0-NEXT:    movq $1, foo
282; O0-NEXT:    retq
283;
284; O1-LABEL: atomic8_store_unordered:
285; O1:       # %bb.0: # %entry
286; O1-NEXT:    movq foo(%rip), %rax
287; O1-NEXT:  .Lpcsection6:
288; O1-NEXT:    movb $42, (%rdi)
289; O1-NEXT:    movq $1, foo(%rip)
290; O1-NEXT:    retq
291;
292; O2-LABEL: atomic8_store_unordered:
293; O2:       # %bb.0: # %entry
294; O2-NEXT:    movq foo(%rip), %rax
295; O2-NEXT:  .Lpcsection6:
296; O2-NEXT:    movb $42, (%rdi)
297; O2-NEXT:    movq $1, foo(%rip)
298; O2-NEXT:    retq
299;
300; O3-LABEL: atomic8_store_unordered:
301; O3:       # %bb.0: # %entry
302; O3-NEXT:    movq foo(%rip), %rax
303; O3-NEXT:  .Lpcsection6:
304; O3-NEXT:    movb $42, (%rdi)
305; O3-NEXT:    movq $1, foo(%rip)
306; O3-NEXT:    retq
307entry:
308  load volatile i64, ptr @foo, align 8
309  store atomic i8 42, ptr %a unordered, align 1, !pcsections !0
310  store volatile i64 1, ptr @foo, align 8
311  ret void
312}
313
314define void @atomic8_store_monotonic(ptr %a) {
315; O0-LABEL: atomic8_store_monotonic:
316; O0:       # %bb.0: # %entry
317; O0-NEXT:    movq foo(%rip), %rax
318; O0-NEXT:  .Lpcsection7:
319; O0-NEXT:    movb $42, (%rdi)
320; O0-NEXT:    movq $1, foo
321; O0-NEXT:    retq
322;
323; O1-LABEL: atomic8_store_monotonic:
324; O1:       # %bb.0: # %entry
325; O1-NEXT:    movq foo(%rip), %rax
326; O1-NEXT:  .Lpcsection7:
327; O1-NEXT:    movb $42, (%rdi)
328; O1-NEXT:    movq $1, foo(%rip)
329; O1-NEXT:    retq
330;
331; O2-LABEL: atomic8_store_monotonic:
332; O2:       # %bb.0: # %entry
333; O2-NEXT:    movq foo(%rip), %rax
334; O2-NEXT:  .Lpcsection7:
335; O2-NEXT:    movb $42, (%rdi)
336; O2-NEXT:    movq $1, foo(%rip)
337; O2-NEXT:    retq
338;
339; O3-LABEL: atomic8_store_monotonic:
340; O3:       # %bb.0: # %entry
341; O3-NEXT:    movq foo(%rip), %rax
342; O3-NEXT:  .Lpcsection7:
343; O3-NEXT:    movb $42, (%rdi)
344; O3-NEXT:    movq $1, foo(%rip)
345; O3-NEXT:    retq
346entry:
347  load volatile i64, ptr @foo, align 8
348  store atomic i8 42, ptr %a monotonic, align 1, !pcsections !0
349  store volatile i64 1, ptr @foo, align 8
350  ret void
351}
352
353define void @atomic8_store_release(ptr %a) {
354; O0-LABEL: atomic8_store_release:
355; O0:       # %bb.0: # %entry
356; O0-NEXT:    movq foo(%rip), %rax
357; O0-NEXT:  .Lpcsection8:
358; O0-NEXT:    movb $42, (%rdi)
359; O0-NEXT:    movq $1, foo
360; O0-NEXT:    retq
361;
362; O1-LABEL: atomic8_store_release:
363; O1:       # %bb.0: # %entry
364; O1-NEXT:    movq foo(%rip), %rax
365; O1-NEXT:  .Lpcsection8:
366; O1-NEXT:    movb $42, (%rdi)
367; O1-NEXT:    movq $1, foo(%rip)
368; O1-NEXT:    retq
369;
370; O2-LABEL: atomic8_store_release:
371; O2:       # %bb.0: # %entry
372; O2-NEXT:    movq foo(%rip), %rax
373; O2-NEXT:  .Lpcsection8:
374; O2-NEXT:    movb $42, (%rdi)
375; O2-NEXT:    movq $1, foo(%rip)
376; O2-NEXT:    retq
377;
378; O3-LABEL: atomic8_store_release:
379; O3:       # %bb.0: # %entry
380; O3-NEXT:    movq foo(%rip), %rax
381; O3-NEXT:  .Lpcsection8:
382; O3-NEXT:    movb $42, (%rdi)
383; O3-NEXT:    movq $1, foo(%rip)
384; O3-NEXT:    retq
385entry:
386  load volatile i64, ptr @foo, align 8
387  store atomic i8 42, ptr %a release, align 1, !pcsections !0
388  store volatile i64 1, ptr @foo, align 8
389  ret void
390}
391
392define void @atomic8_store_seq_cst(ptr %a) {
393; O0-LABEL: atomic8_store_seq_cst:
394; O0:       # %bb.0: # %entry
395; O0-NEXT:    movq foo(%rip), %rax
396; O0-NEXT:    movb $42, %al
397; O0-NEXT:  .Lpcsection9:
398; O0-NEXT:    xchgb %al, (%rdi)
399; O0-NEXT:    movq $1, foo
400; O0-NEXT:    retq
401;
402; O1-LABEL: atomic8_store_seq_cst:
403; O1:       # %bb.0: # %entry
404; O1-NEXT:    movq foo(%rip), %rax
405; O1-NEXT:    movb $42, %al
406; O1-NEXT:  .Lpcsection9:
407; O1-NEXT:    xchgb %al, (%rdi)
408; O1-NEXT:    movq $1, foo(%rip)
409; O1-NEXT:    retq
410;
411; O2-LABEL: atomic8_store_seq_cst:
412; O2:       # %bb.0: # %entry
413; O2-NEXT:    movq foo(%rip), %rax
414; O2-NEXT:    movb $42, %al
415; O2-NEXT:  .Lpcsection9:
416; O2-NEXT:    xchgb %al, (%rdi)
417; O2-NEXT:    movq $1, foo(%rip)
418; O2-NEXT:    retq
419;
420; O3-LABEL: atomic8_store_seq_cst:
421; O3:       # %bb.0: # %entry
422; O3-NEXT:    movq foo(%rip), %rax
423; O3-NEXT:    movb $42, %al
424; O3-NEXT:  .Lpcsection9:
425; O3-NEXT:    xchgb %al, (%rdi)
426; O3-NEXT:    movq $1, foo(%rip)
427; O3-NEXT:    retq
428entry:
429  load volatile i64, ptr @foo, align 8
430  store atomic i8 42, ptr %a seq_cst, align 1, !pcsections !0
431  store volatile i64 1, ptr @foo, align 8
432  ret void
433}
434
435define void @atomic8_xchg_monotonic(ptr %a) {
436; O0-LABEL: atomic8_xchg_monotonic:
437; O0:       # %bb.0: # %entry
438; O0-NEXT:    movq foo(%rip), %rax
439; O0-NEXT:    movb $42, %al
440; O0-NEXT:  .Lpcsection10:
441; O0-NEXT:    xchgb %al, (%rdi)
442; O0-NEXT:    movq $1, foo
443; O0-NEXT:    retq
444;
445; O1-LABEL: atomic8_xchg_monotonic:
446; O1:       # %bb.0: # %entry
447; O1-NEXT:    movq foo(%rip), %rax
448; O1-NEXT:    movb $42, %al
449; O1-NEXT:  .Lpcsection10:
450; O1-NEXT:    xchgb %al, (%rdi)
451; O1-NEXT:    movq $1, foo(%rip)
452; O1-NEXT:    retq
453;
454; O2-LABEL: atomic8_xchg_monotonic:
455; O2:       # %bb.0: # %entry
456; O2-NEXT:    movq foo(%rip), %rax
457; O2-NEXT:    movb $42, %al
458; O2-NEXT:  .Lpcsection10:
459; O2-NEXT:    xchgb %al, (%rdi)
460; O2-NEXT:    movq $1, foo(%rip)
461; O2-NEXT:    retq
462;
463; O3-LABEL: atomic8_xchg_monotonic:
464; O3:       # %bb.0: # %entry
465; O3-NEXT:    movq foo(%rip), %rax
466; O3-NEXT:    movb $42, %al
467; O3-NEXT:  .Lpcsection10:
468; O3-NEXT:    xchgb %al, (%rdi)
469; O3-NEXT:    movq $1, foo(%rip)
470; O3-NEXT:    retq
471entry:
472  load volatile i64, ptr @foo, align 8
473  %x = atomicrmw xchg ptr %a, i8 42 monotonic, align 1, !pcsections !0
474  store volatile i64 1, ptr @foo, align 8
475  ret void
476}
477
478define void @atomic8_add_monotonic(ptr %a) {
479; O0-LABEL: atomic8_add_monotonic:
480; O0:       # %bb.0: # %entry
481; O0-NEXT:    movq foo(%rip), %rax
482; O0-NEXT:  .Lpcsection11:
483; O0-NEXT:    lock addb $42, (%rdi)
484; O0-NEXT:    movq $1, foo
485; O0-NEXT:    retq
486;
487; O1-LABEL: atomic8_add_monotonic:
488; O1:       # %bb.0: # %entry
489; O1-NEXT:    movq foo(%rip), %rax
490; O1-NEXT:  .Lpcsection11:
491; O1-NEXT:    lock addb $42, (%rdi)
492; O1-NEXT:    movq $1, foo(%rip)
493; O1-NEXT:    retq
494;
495; O2-LABEL: atomic8_add_monotonic:
496; O2:       # %bb.0: # %entry
497; O2-NEXT:    movq foo(%rip), %rax
498; O2-NEXT:  .Lpcsection11:
499; O2-NEXT:    lock addb $42, (%rdi)
500; O2-NEXT:    movq $1, foo(%rip)
501; O2-NEXT:    retq
502;
503; O3-LABEL: atomic8_add_monotonic:
504; O3:       # %bb.0: # %entry
505; O3-NEXT:    movq foo(%rip), %rax
506; O3-NEXT:  .Lpcsection11:
507; O3-NEXT:    lock addb $42, (%rdi)
508; O3-NEXT:    movq $1, foo(%rip)
509; O3-NEXT:    retq
510entry:
511  load volatile i64, ptr @foo, align 8
512  %x = atomicrmw add ptr %a, i8 42 monotonic, align 1, !pcsections !0
513  store volatile i64 1, ptr @foo, align 8
514  ret void
515}
516
517define void @atomic8_sub_monotonic(ptr %a) {
518; O0-LABEL: atomic8_sub_monotonic:
519; O0:       # %bb.0: # %entry
520; O0-NEXT:    movq foo(%rip), %rax
521; O0-NEXT:  .Lpcsection12:
522; O0-NEXT:    lock subb $42, (%rdi)
523; O0-NEXT:    movq $1, foo
524; O0-NEXT:    retq
525;
526; O1-LABEL: atomic8_sub_monotonic:
527; O1:       # %bb.0: # %entry
528; O1-NEXT:    movq foo(%rip), %rax
529; O1-NEXT:  .Lpcsection12:
530; O1-NEXT:    lock subb $42, (%rdi)
531; O1-NEXT:    movq $1, foo(%rip)
532; O1-NEXT:    retq
533;
534; O2-LABEL: atomic8_sub_monotonic:
535; O2:       # %bb.0: # %entry
536; O2-NEXT:    movq foo(%rip), %rax
537; O2-NEXT:  .Lpcsection12:
538; O2-NEXT:    lock subb $42, (%rdi)
539; O2-NEXT:    movq $1, foo(%rip)
540; O2-NEXT:    retq
541;
542; O3-LABEL: atomic8_sub_monotonic:
543; O3:       # %bb.0: # %entry
544; O3-NEXT:    movq foo(%rip), %rax
545; O3-NEXT:  .Lpcsection12:
546; O3-NEXT:    lock subb $42, (%rdi)
547; O3-NEXT:    movq $1, foo(%rip)
548; O3-NEXT:    retq
549entry:
550  load volatile i64, ptr @foo, align 8
551  %x = atomicrmw sub ptr %a, i8 42 monotonic, align 1, !pcsections !0
552  store volatile i64 1, ptr @foo, align 8
553  ret void
554}
555
556define void @atomic8_and_monotonic(ptr %a) {
557; O0-LABEL: atomic8_and_monotonic:
558; O0:       # %bb.0: # %entry
559; O0-NEXT:    movq foo(%rip), %rax
560; O0-NEXT:  .Lpcsection13:
561; O0-NEXT:    lock andb $42, (%rdi)
562; O0-NEXT:    movq $1, foo
563; O0-NEXT:    retq
564;
565; O1-LABEL: atomic8_and_monotonic:
566; O1:       # %bb.0: # %entry
567; O1-NEXT:    movq foo(%rip), %rax
568; O1-NEXT:  .Lpcsection13:
569; O1-NEXT:    lock andb $42, (%rdi)
570; O1-NEXT:    movq $1, foo(%rip)
571; O1-NEXT:    retq
572;
573; O2-LABEL: atomic8_and_monotonic:
574; O2:       # %bb.0: # %entry
575; O2-NEXT:    movq foo(%rip), %rax
576; O2-NEXT:  .Lpcsection13:
577; O2-NEXT:    lock andb $42, (%rdi)
578; O2-NEXT:    movq $1, foo(%rip)
579; O2-NEXT:    retq
580;
581; O3-LABEL: atomic8_and_monotonic:
582; O3:       # %bb.0: # %entry
583; O3-NEXT:    movq foo(%rip), %rax
584; O3-NEXT:  .Lpcsection13:
585; O3-NEXT:    lock andb $42, (%rdi)
586; O3-NEXT:    movq $1, foo(%rip)
587; O3-NEXT:    retq
588entry:
589  load volatile i64, ptr @foo, align 8
590  %x = atomicrmw and ptr %a, i8 42 monotonic, align 1, !pcsections !0
591  store volatile i64 1, ptr @foo, align 8
592  ret void
593}
594
595define void @atomic8_or_monotonic(ptr %a) {
596; O0-LABEL: atomic8_or_monotonic:
597; O0:       # %bb.0: # %entry
598; O0-NEXT:    movq foo(%rip), %rax
599; O0-NEXT:  .Lpcsection14:
600; O0-NEXT:    lock orb $42, (%rdi)
601; O0-NEXT:    movq $1, foo
602; O0-NEXT:    retq
603;
604; O1-LABEL: atomic8_or_monotonic:
605; O1:       # %bb.0: # %entry
606; O1-NEXT:    movq foo(%rip), %rax
607; O1-NEXT:  .Lpcsection14:
608; O1-NEXT:    lock orb $42, (%rdi)
609; O1-NEXT:    movq $1, foo(%rip)
610; O1-NEXT:    retq
611;
612; O2-LABEL: atomic8_or_monotonic:
613; O2:       # %bb.0: # %entry
614; O2-NEXT:    movq foo(%rip), %rax
615; O2-NEXT:  .Lpcsection14:
616; O2-NEXT:    lock orb $42, (%rdi)
617; O2-NEXT:    movq $1, foo(%rip)
618; O2-NEXT:    retq
619;
620; O3-LABEL: atomic8_or_monotonic:
621; O3:       # %bb.0: # %entry
622; O3-NEXT:    movq foo(%rip), %rax
623; O3-NEXT:  .Lpcsection14:
624; O3-NEXT:    lock orb $42, (%rdi)
625; O3-NEXT:    movq $1, foo(%rip)
626; O3-NEXT:    retq
627entry:
628  load volatile i64, ptr @foo, align 8
629  %x = atomicrmw or ptr %a, i8 42 monotonic, align 1, !pcsections !0
630  store volatile i64 1, ptr @foo, align 8
631  ret void
632}
633
634define void @atomic8_xor_monotonic(ptr %a) {
635; O0-LABEL: atomic8_xor_monotonic:
636; O0:       # %bb.0: # %entry
637; O0-NEXT:    movq foo(%rip), %rax
638; O0-NEXT:  .Lpcsection15:
639; O0-NEXT:    lock xorb $42, (%rdi)
640; O0-NEXT:    movq $1, foo
641; O0-NEXT:    retq
642;
643; O1-LABEL: atomic8_xor_monotonic:
644; O1:       # %bb.0: # %entry
645; O1-NEXT:    movq foo(%rip), %rax
646; O1-NEXT:  .Lpcsection15:
647; O1-NEXT:    lock xorb $42, (%rdi)
648; O1-NEXT:    movq $1, foo(%rip)
649; O1-NEXT:    retq
650;
651; O2-LABEL: atomic8_xor_monotonic:
652; O2:       # %bb.0: # %entry
653; O2-NEXT:    movq foo(%rip), %rax
654; O2-NEXT:  .Lpcsection15:
655; O2-NEXT:    lock xorb $42, (%rdi)
656; O2-NEXT:    movq $1, foo(%rip)
657; O2-NEXT:    retq
658;
659; O3-LABEL: atomic8_xor_monotonic:
660; O3:       # %bb.0: # %entry
661; O3-NEXT:    movq foo(%rip), %rax
662; O3-NEXT:  .Lpcsection15:
663; O3-NEXT:    lock xorb $42, (%rdi)
664; O3-NEXT:    movq $1, foo(%rip)
665; O3-NEXT:    retq
666entry:
667  load volatile i64, ptr @foo, align 8
668  %x = atomicrmw xor ptr %a, i8 42 monotonic, align 1, !pcsections !0
669  store volatile i64 1, ptr @foo, align 8
670  ret void
671}
672
673define void @atomic8_nand_monotonic(ptr %a) {
674; O0-LABEL: atomic8_nand_monotonic:
675; O0:       # %bb.0: # %entry
676; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
677; O0-NEXT:    movq foo, %rax
678; O0-NEXT:  .Lpcsection16:
679; O0-NEXT:    movb (%rdi), %al
680; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
681; O0-NEXT:  .LBB16_1: # %atomicrmw.start
682; O0-NEXT:    # =>This Inner Loop Header: Depth=1
683; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
684; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
685; O0-NEXT:    movb %al, %dl
686; O0-NEXT:  .Lpcsection17:
687; O0-NEXT:    notb %dl
688; O0-NEXT:  .Lpcsection18:
689; O0-NEXT:    orb $-43, %dl
690; O0-NEXT:  .Lpcsection19:
691; O0-NEXT:    lock cmpxchgb %dl, (%rcx)
692; O0-NEXT:  .Lpcsection20:
693; O0-NEXT:    sete %cl
694; O0-NEXT:  .Lpcsection21:
695; O0-NEXT:    testb $1, %cl
696; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
697; O0-NEXT:  .Lpcsection22:
698; O0-NEXT:    jne .LBB16_2
699; O0-NEXT:    jmp .LBB16_1
700; O0-NEXT:  .LBB16_2: # %atomicrmw.end
701; O0-NEXT:    movq $1, foo
702; O0-NEXT:    retq
703;
704; O1-LABEL: atomic8_nand_monotonic:
705; O1:       # %bb.0: # %entry
706; O1-NEXT:    movq foo(%rip), %rax
707; O1-NEXT:  .Lpcsection16:
708; O1-NEXT:    movzbl (%rdi), %eax
709; O1-NEXT:    .p2align 4
710; O1-NEXT:  .LBB16_1: # %atomicrmw.start
711; O1-NEXT:    # =>This Inner Loop Header: Depth=1
712; O1-NEXT:    movl %eax, %ecx
713; O1-NEXT:  .Lpcsection17:
714; O1-NEXT:    notb %cl
715; O1-NEXT:  .Lpcsection18:
716; O1-NEXT:    orb $-43, %cl
717; O1-NEXT:  .Lpcsection19:
718; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
719; O1-NEXT:  .Lpcsection20:
720; O1-NEXT:    jne .LBB16_1
721; O1-NEXT:  # %bb.2: # %atomicrmw.end
722; O1-NEXT:    movq $1, foo(%rip)
723; O1-NEXT:    retq
724;
725; O2-LABEL: atomic8_nand_monotonic:
726; O2:       # %bb.0: # %entry
727; O2-NEXT:    movq foo(%rip), %rax
728; O2-NEXT:  .Lpcsection16:
729; O2-NEXT:    movzbl (%rdi), %eax
730; O2-NEXT:    .p2align 4
731; O2-NEXT:  .LBB16_1: # %atomicrmw.start
732; O2-NEXT:    # =>This Inner Loop Header: Depth=1
733; O2-NEXT:    movl %eax, %ecx
734; O2-NEXT:  .Lpcsection17:
735; O2-NEXT:    notb %cl
736; O2-NEXT:  .Lpcsection18:
737; O2-NEXT:    orb $-43, %cl
738; O2-NEXT:  .Lpcsection19:
739; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
740; O2-NEXT:  .Lpcsection20:
741; O2-NEXT:    jne .LBB16_1
742; O2-NEXT:  # %bb.2: # %atomicrmw.end
743; O2-NEXT:    movq $1, foo(%rip)
744; O2-NEXT:    retq
745;
746; O3-LABEL: atomic8_nand_monotonic:
747; O3:       # %bb.0: # %entry
748; O3-NEXT:    movq foo(%rip), %rax
749; O3-NEXT:  .Lpcsection16:
750; O3-NEXT:    movzbl (%rdi), %eax
751; O3-NEXT:    .p2align 4
752; O3-NEXT:  .LBB16_1: # %atomicrmw.start
753; O3-NEXT:    # =>This Inner Loop Header: Depth=1
754; O3-NEXT:    movl %eax, %ecx
755; O3-NEXT:  .Lpcsection17:
756; O3-NEXT:    notb %cl
757; O3-NEXT:  .Lpcsection18:
758; O3-NEXT:    orb $-43, %cl
759; O3-NEXT:  .Lpcsection19:
760; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
761; O3-NEXT:  .Lpcsection20:
762; O3-NEXT:    jne .LBB16_1
763; O3-NEXT:  # %bb.2: # %atomicrmw.end
764; O3-NEXT:    movq $1, foo(%rip)
765; O3-NEXT:    retq
766entry:
767  load volatile i64, ptr @foo, align 8
768  %x = atomicrmw nand ptr %a, i8 42 monotonic, align 1, !pcsections !0
769  store volatile i64 1, ptr @foo, align 8
770  ret void
771}
772
773define void @atomic8_xchg_acquire(ptr %a) {
774; O0-LABEL: atomic8_xchg_acquire:
775; O0:       # %bb.0: # %entry
776; O0-NEXT:    movq foo(%rip), %rax
777; O0-NEXT:    movb $42, %al
778; O0-NEXT:  .Lpcsection23:
779; O0-NEXT:    xchgb %al, (%rdi)
780; O0-NEXT:    movq $1, foo
781; O0-NEXT:    retq
782;
783; O1-LABEL: atomic8_xchg_acquire:
784; O1:       # %bb.0: # %entry
785; O1-NEXT:    movq foo(%rip), %rax
786; O1-NEXT:    movb $42, %al
787; O1-NEXT:  .Lpcsection21:
788; O1-NEXT:    xchgb %al, (%rdi)
789; O1-NEXT:    movq $1, foo(%rip)
790; O1-NEXT:    retq
791;
792; O2-LABEL: atomic8_xchg_acquire:
793; O2:       # %bb.0: # %entry
794; O2-NEXT:    movq foo(%rip), %rax
795; O2-NEXT:    movb $42, %al
796; O2-NEXT:  .Lpcsection21:
797; O2-NEXT:    xchgb %al, (%rdi)
798; O2-NEXT:    movq $1, foo(%rip)
799; O2-NEXT:    retq
800;
801; O3-LABEL: atomic8_xchg_acquire:
802; O3:       # %bb.0: # %entry
803; O3-NEXT:    movq foo(%rip), %rax
804; O3-NEXT:    movb $42, %al
805; O3-NEXT:  .Lpcsection21:
806; O3-NEXT:    xchgb %al, (%rdi)
807; O3-NEXT:    movq $1, foo(%rip)
808; O3-NEXT:    retq
809entry:
810  load volatile i64, ptr @foo, align 8
811  %x = atomicrmw xchg ptr %a, i8 42 acquire, align 1, !pcsections !0
812  store volatile i64 1, ptr @foo, align 8
813  ret void
814}
815
816define void @atomic8_add_acquire(ptr %a) {
817; O0-LABEL: atomic8_add_acquire:
818; O0:       # %bb.0: # %entry
819; O0-NEXT:    movq foo(%rip), %rax
820; O0-NEXT:  .Lpcsection24:
821; O0-NEXT:    lock addb $42, (%rdi)
822; O0-NEXT:    movq $1, foo
823; O0-NEXT:    retq
824;
825; O1-LABEL: atomic8_add_acquire:
826; O1:       # %bb.0: # %entry
827; O1-NEXT:    movq foo(%rip), %rax
828; O1-NEXT:  .Lpcsection22:
829; O1-NEXT:    lock addb $42, (%rdi)
830; O1-NEXT:    movq $1, foo(%rip)
831; O1-NEXT:    retq
832;
833; O2-LABEL: atomic8_add_acquire:
834; O2:       # %bb.0: # %entry
835; O2-NEXT:    movq foo(%rip), %rax
836; O2-NEXT:  .Lpcsection22:
837; O2-NEXT:    lock addb $42, (%rdi)
838; O2-NEXT:    movq $1, foo(%rip)
839; O2-NEXT:    retq
840;
841; O3-LABEL: atomic8_add_acquire:
842; O3:       # %bb.0: # %entry
843; O3-NEXT:    movq foo(%rip), %rax
844; O3-NEXT:  .Lpcsection22:
845; O3-NEXT:    lock addb $42, (%rdi)
846; O3-NEXT:    movq $1, foo(%rip)
847; O3-NEXT:    retq
848entry:
849  load volatile i64, ptr @foo, align 8
850  %x = atomicrmw add ptr %a, i8 42 acquire, align 1, !pcsections !0
851  store volatile i64 1, ptr @foo, align 8
852  ret void
853}
854
855define void @atomic8_sub_acquire(ptr %a) {
856; O0-LABEL: atomic8_sub_acquire:
857; O0:       # %bb.0: # %entry
858; O0-NEXT:    movq foo(%rip), %rax
859; O0-NEXT:  .Lpcsection25:
860; O0-NEXT:    lock subb $42, (%rdi)
861; O0-NEXT:    movq $1, foo
862; O0-NEXT:    retq
863;
864; O1-LABEL: atomic8_sub_acquire:
865; O1:       # %bb.0: # %entry
866; O1-NEXT:    movq foo(%rip), %rax
867; O1-NEXT:  .Lpcsection23:
868; O1-NEXT:    lock subb $42, (%rdi)
869; O1-NEXT:    movq $1, foo(%rip)
870; O1-NEXT:    retq
871;
872; O2-LABEL: atomic8_sub_acquire:
873; O2:       # %bb.0: # %entry
874; O2-NEXT:    movq foo(%rip), %rax
875; O2-NEXT:  .Lpcsection23:
876; O2-NEXT:    lock subb $42, (%rdi)
877; O2-NEXT:    movq $1, foo(%rip)
878; O2-NEXT:    retq
879;
880; O3-LABEL: atomic8_sub_acquire:
881; O3:       # %bb.0: # %entry
882; O3-NEXT:    movq foo(%rip), %rax
883; O3-NEXT:  .Lpcsection23:
884; O3-NEXT:    lock subb $42, (%rdi)
885; O3-NEXT:    movq $1, foo(%rip)
886; O3-NEXT:    retq
887entry:
888  load volatile i64, ptr @foo, align 8
889  %x = atomicrmw sub ptr %a, i8 42 acquire, align 1, !pcsections !0
890  store volatile i64 1, ptr @foo, align 8
891  ret void
892}
893
894define void @atomic8_and_acquire(ptr %a) {
895; O0-LABEL: atomic8_and_acquire:
896; O0:       # %bb.0: # %entry
897; O0-NEXT:    movq foo(%rip), %rax
898; O0-NEXT:  .Lpcsection26:
899; O0-NEXT:    lock andb $42, (%rdi)
900; O0-NEXT:    movq $1, foo
901; O0-NEXT:    retq
902;
903; O1-LABEL: atomic8_and_acquire:
904; O1:       # %bb.0: # %entry
905; O1-NEXT:    movq foo(%rip), %rax
906; O1-NEXT:  .Lpcsection24:
907; O1-NEXT:    lock andb $42, (%rdi)
908; O1-NEXT:    movq $1, foo(%rip)
909; O1-NEXT:    retq
910;
911; O2-LABEL: atomic8_and_acquire:
912; O2:       # %bb.0: # %entry
913; O2-NEXT:    movq foo(%rip), %rax
914; O2-NEXT:  .Lpcsection24:
915; O2-NEXT:    lock andb $42, (%rdi)
916; O2-NEXT:    movq $1, foo(%rip)
917; O2-NEXT:    retq
918;
919; O3-LABEL: atomic8_and_acquire:
920; O3:       # %bb.0: # %entry
921; O3-NEXT:    movq foo(%rip), %rax
922; O3-NEXT:  .Lpcsection24:
923; O3-NEXT:    lock andb $42, (%rdi)
924; O3-NEXT:    movq $1, foo(%rip)
925; O3-NEXT:    retq
926entry:
927  load volatile i64, ptr @foo, align 8
928  %x = atomicrmw and ptr %a, i8 42 acquire, align 1, !pcsections !0
929  store volatile i64 1, ptr @foo, align 8
930  ret void
931}
932
933define void @atomic8_or_acquire(ptr %a) {
934; O0-LABEL: atomic8_or_acquire:
935; O0:       # %bb.0: # %entry
936; O0-NEXT:    movq foo(%rip), %rax
937; O0-NEXT:  .Lpcsection27:
938; O0-NEXT:    lock orb $42, (%rdi)
939; O0-NEXT:    movq $1, foo
940; O0-NEXT:    retq
941;
942; O1-LABEL: atomic8_or_acquire:
943; O1:       # %bb.0: # %entry
944; O1-NEXT:    movq foo(%rip), %rax
945; O1-NEXT:  .Lpcsection25:
946; O1-NEXT:    lock orb $42, (%rdi)
947; O1-NEXT:    movq $1, foo(%rip)
948; O1-NEXT:    retq
949;
950; O2-LABEL: atomic8_or_acquire:
951; O2:       # %bb.0: # %entry
952; O2-NEXT:    movq foo(%rip), %rax
953; O2-NEXT:  .Lpcsection25:
954; O2-NEXT:    lock orb $42, (%rdi)
955; O2-NEXT:    movq $1, foo(%rip)
956; O2-NEXT:    retq
957;
958; O3-LABEL: atomic8_or_acquire:
959; O3:       # %bb.0: # %entry
960; O3-NEXT:    movq foo(%rip), %rax
961; O3-NEXT:  .Lpcsection25:
962; O3-NEXT:    lock orb $42, (%rdi)
963; O3-NEXT:    movq $1, foo(%rip)
964; O3-NEXT:    retq
965entry:
966  load volatile i64, ptr @foo, align 8
967  %x = atomicrmw or ptr %a, i8 42 acquire, align 1, !pcsections !0
968  store volatile i64 1, ptr @foo, align 8
969  ret void
970}
971
972define void @atomic8_xor_acquire(ptr %a) {
973; O0-LABEL: atomic8_xor_acquire:
974; O0:       # %bb.0: # %entry
975; O0-NEXT:    movq foo(%rip), %rax
976; O0-NEXT:  .Lpcsection28:
977; O0-NEXT:    lock xorb $42, (%rdi)
978; O0-NEXT:    movq $1, foo
979; O0-NEXT:    retq
980;
981; O1-LABEL: atomic8_xor_acquire:
982; O1:       # %bb.0: # %entry
983; O1-NEXT:    movq foo(%rip), %rax
984; O1-NEXT:  .Lpcsection26:
985; O1-NEXT:    lock xorb $42, (%rdi)
986; O1-NEXT:    movq $1, foo(%rip)
987; O1-NEXT:    retq
988;
989; O2-LABEL: atomic8_xor_acquire:
990; O2:       # %bb.0: # %entry
991; O2-NEXT:    movq foo(%rip), %rax
992; O2-NEXT:  .Lpcsection26:
993; O2-NEXT:    lock xorb $42, (%rdi)
994; O2-NEXT:    movq $1, foo(%rip)
995; O2-NEXT:    retq
996;
997; O3-LABEL: atomic8_xor_acquire:
998; O3:       # %bb.0: # %entry
999; O3-NEXT:    movq foo(%rip), %rax
1000; O3-NEXT:  .Lpcsection26:
1001; O3-NEXT:    lock xorb $42, (%rdi)
1002; O3-NEXT:    movq $1, foo(%rip)
1003; O3-NEXT:    retq
1004entry:
1005  load volatile i64, ptr @foo, align 8
1006  %x = atomicrmw xor ptr %a, i8 42 acquire, align 1, !pcsections !0
1007  store volatile i64 1, ptr @foo, align 8
1008  ret void
1009}
1010
1011define void @atomic8_nand_acquire(ptr %a) {
1012; O0-LABEL: atomic8_nand_acquire:
1013; O0:       # %bb.0: # %entry
1014; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
1015; O0-NEXT:    movq foo, %rax
1016; O0-NEXT:  .Lpcsection29:
1017; O0-NEXT:    movb (%rdi), %al
1018; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1019; O0-NEXT:  .LBB23_1: # %atomicrmw.start
1020; O0-NEXT:    # =>This Inner Loop Header: Depth=1
1021; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
1022; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
1023; O0-NEXT:    movb %al, %dl
1024; O0-NEXT:  .Lpcsection30:
1025; O0-NEXT:    notb %dl
1026; O0-NEXT:  .Lpcsection31:
1027; O0-NEXT:    orb $-43, %dl
1028; O0-NEXT:  .Lpcsection32:
1029; O0-NEXT:    lock cmpxchgb %dl, (%rcx)
1030; O0-NEXT:  .Lpcsection33:
1031; O0-NEXT:    sete %cl
1032; O0-NEXT:  .Lpcsection34:
1033; O0-NEXT:    testb $1, %cl
1034; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1035; O0-NEXT:  .Lpcsection35:
1036; O0-NEXT:    jne .LBB23_2
1037; O0-NEXT:    jmp .LBB23_1
1038; O0-NEXT:  .LBB23_2: # %atomicrmw.end
1039; O0-NEXT:    movq $1, foo
1040; O0-NEXT:    retq
1041;
1042; O1-LABEL: atomic8_nand_acquire:
1043; O1:       # %bb.0: # %entry
1044; O1-NEXT:    movq foo(%rip), %rax
1045; O1-NEXT:  .Lpcsection27:
1046; O1-NEXT:    movzbl (%rdi), %eax
1047; O1-NEXT:    .p2align 4
1048; O1-NEXT:  .LBB23_1: # %atomicrmw.start
1049; O1-NEXT:    # =>This Inner Loop Header: Depth=1
1050; O1-NEXT:    movl %eax, %ecx
1051; O1-NEXT:  .Lpcsection28:
1052; O1-NEXT:    notb %cl
1053; O1-NEXT:  .Lpcsection29:
1054; O1-NEXT:    orb $-43, %cl
1055; O1-NEXT:  .Lpcsection30:
1056; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
1057; O1-NEXT:  .Lpcsection31:
1058; O1-NEXT:    jne .LBB23_1
1059; O1-NEXT:  # %bb.2: # %atomicrmw.end
1060; O1-NEXT:    movq $1, foo(%rip)
1061; O1-NEXT:    retq
1062;
1063; O2-LABEL: atomic8_nand_acquire:
1064; O2:       # %bb.0: # %entry
1065; O2-NEXT:    movq foo(%rip), %rax
1066; O2-NEXT:  .Lpcsection27:
1067; O2-NEXT:    movzbl (%rdi), %eax
1068; O2-NEXT:    .p2align 4
1069; O2-NEXT:  .LBB23_1: # %atomicrmw.start
1070; O2-NEXT:    # =>This Inner Loop Header: Depth=1
1071; O2-NEXT:    movl %eax, %ecx
1072; O2-NEXT:  .Lpcsection28:
1073; O2-NEXT:    notb %cl
1074; O2-NEXT:  .Lpcsection29:
1075; O2-NEXT:    orb $-43, %cl
1076; O2-NEXT:  .Lpcsection30:
1077; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
1078; O2-NEXT:  .Lpcsection31:
1079; O2-NEXT:    jne .LBB23_1
1080; O2-NEXT:  # %bb.2: # %atomicrmw.end
1081; O2-NEXT:    movq $1, foo(%rip)
1082; O2-NEXT:    retq
1083;
1084; O3-LABEL: atomic8_nand_acquire:
1085; O3:       # %bb.0: # %entry
1086; O3-NEXT:    movq foo(%rip), %rax
1087; O3-NEXT:  .Lpcsection27:
1088; O3-NEXT:    movzbl (%rdi), %eax
1089; O3-NEXT:    .p2align 4
1090; O3-NEXT:  .LBB23_1: # %atomicrmw.start
1091; O3-NEXT:    # =>This Inner Loop Header: Depth=1
1092; O3-NEXT:    movl %eax, %ecx
1093; O3-NEXT:  .Lpcsection28:
1094; O3-NEXT:    notb %cl
1095; O3-NEXT:  .Lpcsection29:
1096; O3-NEXT:    orb $-43, %cl
1097; O3-NEXT:  .Lpcsection30:
1098; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
1099; O3-NEXT:  .Lpcsection31:
1100; O3-NEXT:    jne .LBB23_1
1101; O3-NEXT:  # %bb.2: # %atomicrmw.end
1102; O3-NEXT:    movq $1, foo(%rip)
1103; O3-NEXT:    retq
1104entry:
1105  load volatile i64, ptr @foo, align 8
1106  %x = atomicrmw nand ptr %a, i8 42 acquire, align 1, !pcsections !0
1107  store volatile i64 1, ptr @foo, align 8
1108  ret void
1109}
1110
1111define void @atomic8_xchg_release(ptr %a) {
1112; O0-LABEL: atomic8_xchg_release:
1113; O0:       # %bb.0: # %entry
1114; O0-NEXT:    movq foo(%rip), %rax
1115; O0-NEXT:    movb $42, %al
1116; O0-NEXT:  .Lpcsection36:
1117; O0-NEXT:    xchgb %al, (%rdi)
1118; O0-NEXT:    movq $1, foo
1119; O0-NEXT:    retq
1120;
1121; O1-LABEL: atomic8_xchg_release:
1122; O1:       # %bb.0: # %entry
1123; O1-NEXT:    movq foo(%rip), %rax
1124; O1-NEXT:    movb $42, %al
1125; O1-NEXT:  .Lpcsection32:
1126; O1-NEXT:    xchgb %al, (%rdi)
1127; O1-NEXT:    movq $1, foo(%rip)
1128; O1-NEXT:    retq
1129;
1130; O2-LABEL: atomic8_xchg_release:
1131; O2:       # %bb.0: # %entry
1132; O2-NEXT:    movq foo(%rip), %rax
1133; O2-NEXT:    movb $42, %al
1134; O2-NEXT:  .Lpcsection32:
1135; O2-NEXT:    xchgb %al, (%rdi)
1136; O2-NEXT:    movq $1, foo(%rip)
1137; O2-NEXT:    retq
1138;
1139; O3-LABEL: atomic8_xchg_release:
1140; O3:       # %bb.0: # %entry
1141; O3-NEXT:    movq foo(%rip), %rax
1142; O3-NEXT:    movb $42, %al
1143; O3-NEXT:  .Lpcsection32:
1144; O3-NEXT:    xchgb %al, (%rdi)
1145; O3-NEXT:    movq $1, foo(%rip)
1146; O3-NEXT:    retq
1147entry:
1148  load volatile i64, ptr @foo, align 8
1149  %x = atomicrmw xchg ptr %a, i8 42 release, align 1, !pcsections !0
1150  store volatile i64 1, ptr @foo, align 8
1151  ret void
1152}
1153
1154define void @atomic8_add_release(ptr %a) {
1155; O0-LABEL: atomic8_add_release:
1156; O0:       # %bb.0: # %entry
1157; O0-NEXT:    movq foo(%rip), %rax
1158; O0-NEXT:  .Lpcsection37:
1159; O0-NEXT:    lock addb $42, (%rdi)
1160; O0-NEXT:    movq $1, foo
1161; O0-NEXT:    retq
1162;
1163; O1-LABEL: atomic8_add_release:
1164; O1:       # %bb.0: # %entry
1165; O1-NEXT:    movq foo(%rip), %rax
1166; O1-NEXT:  .Lpcsection33:
1167; O1-NEXT:    lock addb $42, (%rdi)
1168; O1-NEXT:    movq $1, foo(%rip)
1169; O1-NEXT:    retq
1170;
1171; O2-LABEL: atomic8_add_release:
1172; O2:       # %bb.0: # %entry
1173; O2-NEXT:    movq foo(%rip), %rax
1174; O2-NEXT:  .Lpcsection33:
1175; O2-NEXT:    lock addb $42, (%rdi)
1176; O2-NEXT:    movq $1, foo(%rip)
1177; O2-NEXT:    retq
1178;
1179; O3-LABEL: atomic8_add_release:
1180; O3:       # %bb.0: # %entry
1181; O3-NEXT:    movq foo(%rip), %rax
1182; O3-NEXT:  .Lpcsection33:
1183; O3-NEXT:    lock addb $42, (%rdi)
1184; O3-NEXT:    movq $1, foo(%rip)
1185; O3-NEXT:    retq
1186entry:
1187  load volatile i64, ptr @foo, align 8
1188  %x = atomicrmw add ptr %a, i8 42 release, align 1, !pcsections !0
1189  store volatile i64 1, ptr @foo, align 8
1190  ret void
1191}
1192
1193define void @atomic8_sub_release(ptr %a) {
1194; O0-LABEL: atomic8_sub_release:
1195; O0:       # %bb.0: # %entry
1196; O0-NEXT:    movq foo(%rip), %rax
1197; O0-NEXT:  .Lpcsection38:
1198; O0-NEXT:    lock subb $42, (%rdi)
1199; O0-NEXT:    movq $1, foo
1200; O0-NEXT:    retq
1201;
1202; O1-LABEL: atomic8_sub_release:
1203; O1:       # %bb.0: # %entry
1204; O1-NEXT:    movq foo(%rip), %rax
1205; O1-NEXT:  .Lpcsection34:
1206; O1-NEXT:    lock subb $42, (%rdi)
1207; O1-NEXT:    movq $1, foo(%rip)
1208; O1-NEXT:    retq
1209;
1210; O2-LABEL: atomic8_sub_release:
1211; O2:       # %bb.0: # %entry
1212; O2-NEXT:    movq foo(%rip), %rax
1213; O2-NEXT:  .Lpcsection34:
1214; O2-NEXT:    lock subb $42, (%rdi)
1215; O2-NEXT:    movq $1, foo(%rip)
1216; O2-NEXT:    retq
1217;
1218; O3-LABEL: atomic8_sub_release:
1219; O3:       # %bb.0: # %entry
1220; O3-NEXT:    movq foo(%rip), %rax
1221; O3-NEXT:  .Lpcsection34:
1222; O3-NEXT:    lock subb $42, (%rdi)
1223; O3-NEXT:    movq $1, foo(%rip)
1224; O3-NEXT:    retq
1225entry:
1226  load volatile i64, ptr @foo, align 8
1227  %x = atomicrmw sub ptr %a, i8 42 release, align 1, !pcsections !0
1228  store volatile i64 1, ptr @foo, align 8
1229  ret void
1230}
1231
1232define void @atomic8_and_release(ptr %a) {
1233; O0-LABEL: atomic8_and_release:
1234; O0:       # %bb.0: # %entry
1235; O0-NEXT:    movq foo(%rip), %rax
1236; O0-NEXT:  .Lpcsection39:
1237; O0-NEXT:    lock andb $42, (%rdi)
1238; O0-NEXT:    movq $1, foo
1239; O0-NEXT:    retq
1240;
1241; O1-LABEL: atomic8_and_release:
1242; O1:       # %bb.0: # %entry
1243; O1-NEXT:    movq foo(%rip), %rax
1244; O1-NEXT:  .Lpcsection35:
1245; O1-NEXT:    lock andb $42, (%rdi)
1246; O1-NEXT:    movq $1, foo(%rip)
1247; O1-NEXT:    retq
1248;
1249; O2-LABEL: atomic8_and_release:
1250; O2:       # %bb.0: # %entry
1251; O2-NEXT:    movq foo(%rip), %rax
1252; O2-NEXT:  .Lpcsection35:
1253; O2-NEXT:    lock andb $42, (%rdi)
1254; O2-NEXT:    movq $1, foo(%rip)
1255; O2-NEXT:    retq
1256;
1257; O3-LABEL: atomic8_and_release:
1258; O3:       # %bb.0: # %entry
1259; O3-NEXT:    movq foo(%rip), %rax
1260; O3-NEXT:  .Lpcsection35:
1261; O3-NEXT:    lock andb $42, (%rdi)
1262; O3-NEXT:    movq $1, foo(%rip)
1263; O3-NEXT:    retq
1264entry:
1265  load volatile i64, ptr @foo, align 8
1266  %x = atomicrmw and ptr %a, i8 42 release, align 1, !pcsections !0
1267  store volatile i64 1, ptr @foo, align 8
1268  ret void
1269}
1270
1271define void @atomic8_or_release(ptr %a) {
1272; O0-LABEL: atomic8_or_release:
1273; O0:       # %bb.0: # %entry
1274; O0-NEXT:    movq foo(%rip), %rax
1275; O0-NEXT:  .Lpcsection40:
1276; O0-NEXT:    lock orb $42, (%rdi)
1277; O0-NEXT:    movq $1, foo
1278; O0-NEXT:    retq
1279;
1280; O1-LABEL: atomic8_or_release:
1281; O1:       # %bb.0: # %entry
1282; O1-NEXT:    movq foo(%rip), %rax
1283; O1-NEXT:  .Lpcsection36:
1284; O1-NEXT:    lock orb $42, (%rdi)
1285; O1-NEXT:    movq $1, foo(%rip)
1286; O1-NEXT:    retq
1287;
1288; O2-LABEL: atomic8_or_release:
1289; O2:       # %bb.0: # %entry
1290; O2-NEXT:    movq foo(%rip), %rax
1291; O2-NEXT:  .Lpcsection36:
1292; O2-NEXT:    lock orb $42, (%rdi)
1293; O2-NEXT:    movq $1, foo(%rip)
1294; O2-NEXT:    retq
1295;
1296; O3-LABEL: atomic8_or_release:
1297; O3:       # %bb.0: # %entry
1298; O3-NEXT:    movq foo(%rip), %rax
1299; O3-NEXT:  .Lpcsection36:
1300; O3-NEXT:    lock orb $42, (%rdi)
1301; O3-NEXT:    movq $1, foo(%rip)
1302; O3-NEXT:    retq
1303entry:
1304  load volatile i64, ptr @foo, align 8
1305  %x = atomicrmw or ptr %a, i8 42 release, align 1, !pcsections !0
1306  store volatile i64 1, ptr @foo, align 8
1307  ret void
1308}
1309
1310define void @atomic8_xor_release(ptr %a) {
1311; O0-LABEL: atomic8_xor_release:
1312; O0:       # %bb.0: # %entry
1313; O0-NEXT:    movq foo(%rip), %rax
1314; O0-NEXT:  .Lpcsection41:
1315; O0-NEXT:    lock xorb $42, (%rdi)
1316; O0-NEXT:    movq $1, foo
1317; O0-NEXT:    retq
1318;
1319; O1-LABEL: atomic8_xor_release:
1320; O1:       # %bb.0: # %entry
1321; O1-NEXT:    movq foo(%rip), %rax
1322; O1-NEXT:  .Lpcsection37:
1323; O1-NEXT:    lock xorb $42, (%rdi)
1324; O1-NEXT:    movq $1, foo(%rip)
1325; O1-NEXT:    retq
1326;
1327; O2-LABEL: atomic8_xor_release:
1328; O2:       # %bb.0: # %entry
1329; O2-NEXT:    movq foo(%rip), %rax
1330; O2-NEXT:  .Lpcsection37:
1331; O2-NEXT:    lock xorb $42, (%rdi)
1332; O2-NEXT:    movq $1, foo(%rip)
1333; O2-NEXT:    retq
1334;
1335; O3-LABEL: atomic8_xor_release:
1336; O3:       # %bb.0: # %entry
1337; O3-NEXT:    movq foo(%rip), %rax
1338; O3-NEXT:  .Lpcsection37:
1339; O3-NEXT:    lock xorb $42, (%rdi)
1340; O3-NEXT:    movq $1, foo(%rip)
1341; O3-NEXT:    retq
1342entry:
1343  load volatile i64, ptr @foo, align 8
1344  %x = atomicrmw xor ptr %a, i8 42 release, align 1, !pcsections !0
1345  store volatile i64 1, ptr @foo, align 8
1346  ret void
1347}
1348
1349define void @atomic8_nand_release(ptr %a) {
1350; O0-LABEL: atomic8_nand_release:
1351; O0:       # %bb.0: # %entry
1352; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
1353; O0-NEXT:    movq foo, %rax
1354; O0-NEXT:  .Lpcsection42:
1355; O0-NEXT:    movb (%rdi), %al
1356; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1357; O0-NEXT:  .LBB30_1: # %atomicrmw.start
1358; O0-NEXT:    # =>This Inner Loop Header: Depth=1
1359; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
1360; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
1361; O0-NEXT:    movb %al, %dl
1362; O0-NEXT:  .Lpcsection43:
1363; O0-NEXT:    notb %dl
1364; O0-NEXT:  .Lpcsection44:
1365; O0-NEXT:    orb $-43, %dl
1366; O0-NEXT:  .Lpcsection45:
1367; O0-NEXT:    lock cmpxchgb %dl, (%rcx)
1368; O0-NEXT:  .Lpcsection46:
1369; O0-NEXT:    sete %cl
1370; O0-NEXT:  .Lpcsection47:
1371; O0-NEXT:    testb $1, %cl
1372; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1373; O0-NEXT:  .Lpcsection48:
1374; O0-NEXT:    jne .LBB30_2
1375; O0-NEXT:    jmp .LBB30_1
1376; O0-NEXT:  .LBB30_2: # %atomicrmw.end
1377; O0-NEXT:    movq $1, foo
1378; O0-NEXT:    retq
1379;
1380; O1-LABEL: atomic8_nand_release:
1381; O1:       # %bb.0: # %entry
1382; O1-NEXT:    movq foo(%rip), %rax
1383; O1-NEXT:  .Lpcsection38:
1384; O1-NEXT:    movzbl (%rdi), %eax
1385; O1-NEXT:    .p2align 4
1386; O1-NEXT:  .LBB30_1: # %atomicrmw.start
1387; O1-NEXT:    # =>This Inner Loop Header: Depth=1
1388; O1-NEXT:    movl %eax, %ecx
1389; O1-NEXT:  .Lpcsection39:
1390; O1-NEXT:    notb %cl
1391; O1-NEXT:  .Lpcsection40:
1392; O1-NEXT:    orb $-43, %cl
1393; O1-NEXT:  .Lpcsection41:
1394; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
1395; O1-NEXT:  .Lpcsection42:
1396; O1-NEXT:    jne .LBB30_1
1397; O1-NEXT:  # %bb.2: # %atomicrmw.end
1398; O1-NEXT:    movq $1, foo(%rip)
1399; O1-NEXT:    retq
1400;
1401; O2-LABEL: atomic8_nand_release:
1402; O2:       # %bb.0: # %entry
1403; O2-NEXT:    movq foo(%rip), %rax
1404; O2-NEXT:  .Lpcsection38:
1405; O2-NEXT:    movzbl (%rdi), %eax
1406; O2-NEXT:    .p2align 4
1407; O2-NEXT:  .LBB30_1: # %atomicrmw.start
1408; O2-NEXT:    # =>This Inner Loop Header: Depth=1
1409; O2-NEXT:    movl %eax, %ecx
1410; O2-NEXT:  .Lpcsection39:
1411; O2-NEXT:    notb %cl
1412; O2-NEXT:  .Lpcsection40:
1413; O2-NEXT:    orb $-43, %cl
1414; O2-NEXT:  .Lpcsection41:
1415; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
1416; O2-NEXT:  .Lpcsection42:
1417; O2-NEXT:    jne .LBB30_1
1418; O2-NEXT:  # %bb.2: # %atomicrmw.end
1419; O2-NEXT:    movq $1, foo(%rip)
1420; O2-NEXT:    retq
1421;
1422; O3-LABEL: atomic8_nand_release:
1423; O3:       # %bb.0: # %entry
1424; O3-NEXT:    movq foo(%rip), %rax
1425; O3-NEXT:  .Lpcsection38:
1426; O3-NEXT:    movzbl (%rdi), %eax
1427; O3-NEXT:    .p2align 4
1428; O3-NEXT:  .LBB30_1: # %atomicrmw.start
1429; O3-NEXT:    # =>This Inner Loop Header: Depth=1
1430; O3-NEXT:    movl %eax, %ecx
1431; O3-NEXT:  .Lpcsection39:
1432; O3-NEXT:    notb %cl
1433; O3-NEXT:  .Lpcsection40:
1434; O3-NEXT:    orb $-43, %cl
1435; O3-NEXT:  .Lpcsection41:
1436; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
1437; O3-NEXT:  .Lpcsection42:
1438; O3-NEXT:    jne .LBB30_1
1439; O3-NEXT:  # %bb.2: # %atomicrmw.end
1440; O3-NEXT:    movq $1, foo(%rip)
1441; O3-NEXT:    retq
1442entry:
1443  load volatile i64, ptr @foo, align 8
1444  %x = atomicrmw nand ptr %a, i8 42 release, align 1, !pcsections !0
1445  store volatile i64 1, ptr @foo, align 8
1446  ret void
1447}
1448
1449define void @atomic8_xchg_acq_rel(ptr %a) {
1450; O0-LABEL: atomic8_xchg_acq_rel:
1451; O0:       # %bb.0: # %entry
1452; O0-NEXT:    movq foo(%rip), %rax
1453; O0-NEXT:    movb $42, %al
1454; O0-NEXT:  .Lpcsection49:
1455; O0-NEXT:    xchgb %al, (%rdi)
1456; O0-NEXT:    movq $1, foo
1457; O0-NEXT:    retq
1458;
1459; O1-LABEL: atomic8_xchg_acq_rel:
1460; O1:       # %bb.0: # %entry
1461; O1-NEXT:    movq foo(%rip), %rax
1462; O1-NEXT:    movb $42, %al
1463; O1-NEXT:  .Lpcsection43:
1464; O1-NEXT:    xchgb %al, (%rdi)
1465; O1-NEXT:    movq $1, foo(%rip)
1466; O1-NEXT:    retq
1467;
1468; O2-LABEL: atomic8_xchg_acq_rel:
1469; O2:       # %bb.0: # %entry
1470; O2-NEXT:    movq foo(%rip), %rax
1471; O2-NEXT:    movb $42, %al
1472; O2-NEXT:  .Lpcsection43:
1473; O2-NEXT:    xchgb %al, (%rdi)
1474; O2-NEXT:    movq $1, foo(%rip)
1475; O2-NEXT:    retq
1476;
1477; O3-LABEL: atomic8_xchg_acq_rel:
1478; O3:       # %bb.0: # %entry
1479; O3-NEXT:    movq foo(%rip), %rax
1480; O3-NEXT:    movb $42, %al
1481; O3-NEXT:  .Lpcsection43:
1482; O3-NEXT:    xchgb %al, (%rdi)
1483; O3-NEXT:    movq $1, foo(%rip)
1484; O3-NEXT:    retq
1485entry:
1486  load volatile i64, ptr @foo, align 8
1487  %x = atomicrmw xchg ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1488  store volatile i64 1, ptr @foo, align 8
1489  ret void
1490}
1491
1492define void @atomic8_add_acq_rel(ptr %a) {
1493; O0-LABEL: atomic8_add_acq_rel:
1494; O0:       # %bb.0: # %entry
1495; O0-NEXT:    movq foo(%rip), %rax
1496; O0-NEXT:  .Lpcsection50:
1497; O0-NEXT:    lock addb $42, (%rdi)
1498; O0-NEXT:    movq $1, foo
1499; O0-NEXT:    retq
1500;
1501; O1-LABEL: atomic8_add_acq_rel:
1502; O1:       # %bb.0: # %entry
1503; O1-NEXT:    movq foo(%rip), %rax
1504; O1-NEXT:  .Lpcsection44:
1505; O1-NEXT:    lock addb $42, (%rdi)
1506; O1-NEXT:    movq $1, foo(%rip)
1507; O1-NEXT:    retq
1508;
1509; O2-LABEL: atomic8_add_acq_rel:
1510; O2:       # %bb.0: # %entry
1511; O2-NEXT:    movq foo(%rip), %rax
1512; O2-NEXT:  .Lpcsection44:
1513; O2-NEXT:    lock addb $42, (%rdi)
1514; O2-NEXT:    movq $1, foo(%rip)
1515; O2-NEXT:    retq
1516;
1517; O3-LABEL: atomic8_add_acq_rel:
1518; O3:       # %bb.0: # %entry
1519; O3-NEXT:    movq foo(%rip), %rax
1520; O3-NEXT:  .Lpcsection44:
1521; O3-NEXT:    lock addb $42, (%rdi)
1522; O3-NEXT:    movq $1, foo(%rip)
1523; O3-NEXT:    retq
1524entry:
1525  load volatile i64, ptr @foo, align 8
1526  %x = atomicrmw add ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1527  store volatile i64 1, ptr @foo, align 8
1528  ret void
1529}
1530
1531define void @atomic8_sub_acq_rel(ptr %a) {
1532; O0-LABEL: atomic8_sub_acq_rel:
1533; O0:       # %bb.0: # %entry
1534; O0-NEXT:    movq foo(%rip), %rax
1535; O0-NEXT:  .Lpcsection51:
1536; O0-NEXT:    lock subb $42, (%rdi)
1537; O0-NEXT:    movq $1, foo
1538; O0-NEXT:    retq
1539;
1540; O1-LABEL: atomic8_sub_acq_rel:
1541; O1:       # %bb.0: # %entry
1542; O1-NEXT:    movq foo(%rip), %rax
1543; O1-NEXT:  .Lpcsection45:
1544; O1-NEXT:    lock subb $42, (%rdi)
1545; O1-NEXT:    movq $1, foo(%rip)
1546; O1-NEXT:    retq
1547;
1548; O2-LABEL: atomic8_sub_acq_rel:
1549; O2:       # %bb.0: # %entry
1550; O2-NEXT:    movq foo(%rip), %rax
1551; O2-NEXT:  .Lpcsection45:
1552; O2-NEXT:    lock subb $42, (%rdi)
1553; O2-NEXT:    movq $1, foo(%rip)
1554; O2-NEXT:    retq
1555;
1556; O3-LABEL: atomic8_sub_acq_rel:
1557; O3:       # %bb.0: # %entry
1558; O3-NEXT:    movq foo(%rip), %rax
1559; O3-NEXT:  .Lpcsection45:
1560; O3-NEXT:    lock subb $42, (%rdi)
1561; O3-NEXT:    movq $1, foo(%rip)
1562; O3-NEXT:    retq
1563entry:
1564  load volatile i64, ptr @foo, align 8
1565  %x = atomicrmw sub ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1566  store volatile i64 1, ptr @foo, align 8
1567  ret void
1568}
1569
1570define void @atomic8_and_acq_rel(ptr %a) {
1571; O0-LABEL: atomic8_and_acq_rel:
1572; O0:       # %bb.0: # %entry
1573; O0-NEXT:    movq foo(%rip), %rax
1574; O0-NEXT:  .Lpcsection52:
1575; O0-NEXT:    lock andb $42, (%rdi)
1576; O0-NEXT:    movq $1, foo
1577; O0-NEXT:    retq
1578;
1579; O1-LABEL: atomic8_and_acq_rel:
1580; O1:       # %bb.0: # %entry
1581; O1-NEXT:    movq foo(%rip), %rax
1582; O1-NEXT:  .Lpcsection46:
1583; O1-NEXT:    lock andb $42, (%rdi)
1584; O1-NEXT:    movq $1, foo(%rip)
1585; O1-NEXT:    retq
1586;
1587; O2-LABEL: atomic8_and_acq_rel:
1588; O2:       # %bb.0: # %entry
1589; O2-NEXT:    movq foo(%rip), %rax
1590; O2-NEXT:  .Lpcsection46:
1591; O2-NEXT:    lock andb $42, (%rdi)
1592; O2-NEXT:    movq $1, foo(%rip)
1593; O2-NEXT:    retq
1594;
1595; O3-LABEL: atomic8_and_acq_rel:
1596; O3:       # %bb.0: # %entry
1597; O3-NEXT:    movq foo(%rip), %rax
1598; O3-NEXT:  .Lpcsection46:
1599; O3-NEXT:    lock andb $42, (%rdi)
1600; O3-NEXT:    movq $1, foo(%rip)
1601; O3-NEXT:    retq
1602entry:
1603  load volatile i64, ptr @foo, align 8
1604  %x = atomicrmw and ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1605  store volatile i64 1, ptr @foo, align 8
1606  ret void
1607}
1608
1609define void @atomic8_or_acq_rel(ptr %a) {
1610; O0-LABEL: atomic8_or_acq_rel:
1611; O0:       # %bb.0: # %entry
1612; O0-NEXT:    movq foo(%rip), %rax
1613; O0-NEXT:  .Lpcsection53:
1614; O0-NEXT:    lock orb $42, (%rdi)
1615; O0-NEXT:    movq $1, foo
1616; O0-NEXT:    retq
1617;
1618; O1-LABEL: atomic8_or_acq_rel:
1619; O1:       # %bb.0: # %entry
1620; O1-NEXT:    movq foo(%rip), %rax
1621; O1-NEXT:  .Lpcsection47:
1622; O1-NEXT:    lock orb $42, (%rdi)
1623; O1-NEXT:    movq $1, foo(%rip)
1624; O1-NEXT:    retq
1625;
1626; O2-LABEL: atomic8_or_acq_rel:
1627; O2:       # %bb.0: # %entry
1628; O2-NEXT:    movq foo(%rip), %rax
1629; O2-NEXT:  .Lpcsection47:
1630; O2-NEXT:    lock orb $42, (%rdi)
1631; O2-NEXT:    movq $1, foo(%rip)
1632; O2-NEXT:    retq
1633;
1634; O3-LABEL: atomic8_or_acq_rel:
1635; O3:       # %bb.0: # %entry
1636; O3-NEXT:    movq foo(%rip), %rax
1637; O3-NEXT:  .Lpcsection47:
1638; O3-NEXT:    lock orb $42, (%rdi)
1639; O3-NEXT:    movq $1, foo(%rip)
1640; O3-NEXT:    retq
1641entry:
1642  load volatile i64, ptr @foo, align 8
1643  %x = atomicrmw or ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1644  store volatile i64 1, ptr @foo, align 8
1645  ret void
1646}
1647
1648define void @atomic8_xor_acq_rel(ptr %a) {
1649; O0-LABEL: atomic8_xor_acq_rel:
1650; O0:       # %bb.0: # %entry
1651; O0-NEXT:    movq foo(%rip), %rax
1652; O0-NEXT:  .Lpcsection54:
1653; O0-NEXT:    lock xorb $42, (%rdi)
1654; O0-NEXT:    movq $1, foo
1655; O0-NEXT:    retq
1656;
1657; O1-LABEL: atomic8_xor_acq_rel:
1658; O1:       # %bb.0: # %entry
1659; O1-NEXT:    movq foo(%rip), %rax
1660; O1-NEXT:  .Lpcsection48:
1661; O1-NEXT:    lock xorb $42, (%rdi)
1662; O1-NEXT:    movq $1, foo(%rip)
1663; O1-NEXT:    retq
1664;
1665; O2-LABEL: atomic8_xor_acq_rel:
1666; O2:       # %bb.0: # %entry
1667; O2-NEXT:    movq foo(%rip), %rax
1668; O2-NEXT:  .Lpcsection48:
1669; O2-NEXT:    lock xorb $42, (%rdi)
1670; O2-NEXT:    movq $1, foo(%rip)
1671; O2-NEXT:    retq
1672;
1673; O3-LABEL: atomic8_xor_acq_rel:
1674; O3:       # %bb.0: # %entry
1675; O3-NEXT:    movq foo(%rip), %rax
1676; O3-NEXT:  .Lpcsection48:
1677; O3-NEXT:    lock xorb $42, (%rdi)
1678; O3-NEXT:    movq $1, foo(%rip)
1679; O3-NEXT:    retq
1680entry:
1681  load volatile i64, ptr @foo, align 8
1682  %x = atomicrmw xor ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1683  store volatile i64 1, ptr @foo, align 8
1684  ret void
1685}
1686
1687define void @atomic8_nand_acq_rel(ptr %a) {
1688; O0-LABEL: atomic8_nand_acq_rel:
1689; O0:       # %bb.0: # %entry
1690; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
1691; O0-NEXT:    movq foo, %rax
1692; O0-NEXT:  .Lpcsection55:
1693; O0-NEXT:    movb (%rdi), %al
1694; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1695; O0-NEXT:  .LBB37_1: # %atomicrmw.start
1696; O0-NEXT:    # =>This Inner Loop Header: Depth=1
1697; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
1698; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
1699; O0-NEXT:    movb %al, %dl
1700; O0-NEXT:  .Lpcsection56:
1701; O0-NEXT:    notb %dl
1702; O0-NEXT:  .Lpcsection57:
1703; O0-NEXT:    orb $-43, %dl
1704; O0-NEXT:  .Lpcsection58:
1705; O0-NEXT:    lock cmpxchgb %dl, (%rcx)
1706; O0-NEXT:  .Lpcsection59:
1707; O0-NEXT:    sete %cl
1708; O0-NEXT:  .Lpcsection60:
1709; O0-NEXT:    testb $1, %cl
1710; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
1711; O0-NEXT:  .Lpcsection61:
1712; O0-NEXT:    jne .LBB37_2
1713; O0-NEXT:    jmp .LBB37_1
1714; O0-NEXT:  .LBB37_2: # %atomicrmw.end
1715; O0-NEXT:    movq $1, foo
1716; O0-NEXT:    retq
1717;
1718; O1-LABEL: atomic8_nand_acq_rel:
1719; O1:       # %bb.0: # %entry
1720; O1-NEXT:    movq foo(%rip), %rax
1721; O1-NEXT:  .Lpcsection49:
1722; O1-NEXT:    movzbl (%rdi), %eax
1723; O1-NEXT:    .p2align 4
1724; O1-NEXT:  .LBB37_1: # %atomicrmw.start
1725; O1-NEXT:    # =>This Inner Loop Header: Depth=1
1726; O1-NEXT:    movl %eax, %ecx
1727; O1-NEXT:  .Lpcsection50:
1728; O1-NEXT:    notb %cl
1729; O1-NEXT:  .Lpcsection51:
1730; O1-NEXT:    orb $-43, %cl
1731; O1-NEXT:  .Lpcsection52:
1732; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
1733; O1-NEXT:  .Lpcsection53:
1734; O1-NEXT:    jne .LBB37_1
1735; O1-NEXT:  # %bb.2: # %atomicrmw.end
1736; O1-NEXT:    movq $1, foo(%rip)
1737; O1-NEXT:    retq
1738;
1739; O2-LABEL: atomic8_nand_acq_rel:
1740; O2:       # %bb.0: # %entry
1741; O2-NEXT:    movq foo(%rip), %rax
1742; O2-NEXT:  .Lpcsection49:
1743; O2-NEXT:    movzbl (%rdi), %eax
1744; O2-NEXT:    .p2align 4
1745; O2-NEXT:  .LBB37_1: # %atomicrmw.start
1746; O2-NEXT:    # =>This Inner Loop Header: Depth=1
1747; O2-NEXT:    movl %eax, %ecx
1748; O2-NEXT:  .Lpcsection50:
1749; O2-NEXT:    notb %cl
1750; O2-NEXT:  .Lpcsection51:
1751; O2-NEXT:    orb $-43, %cl
1752; O2-NEXT:  .Lpcsection52:
1753; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
1754; O2-NEXT:  .Lpcsection53:
1755; O2-NEXT:    jne .LBB37_1
1756; O2-NEXT:  # %bb.2: # %atomicrmw.end
1757; O2-NEXT:    movq $1, foo(%rip)
1758; O2-NEXT:    retq
1759;
1760; O3-LABEL: atomic8_nand_acq_rel:
1761; O3:       # %bb.0: # %entry
1762; O3-NEXT:    movq foo(%rip), %rax
1763; O3-NEXT:  .Lpcsection49:
1764; O3-NEXT:    movzbl (%rdi), %eax
1765; O3-NEXT:    .p2align 4
1766; O3-NEXT:  .LBB37_1: # %atomicrmw.start
1767; O3-NEXT:    # =>This Inner Loop Header: Depth=1
1768; O3-NEXT:    movl %eax, %ecx
1769; O3-NEXT:  .Lpcsection50:
1770; O3-NEXT:    notb %cl
1771; O3-NEXT:  .Lpcsection51:
1772; O3-NEXT:    orb $-43, %cl
1773; O3-NEXT:  .Lpcsection52:
1774; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
1775; O3-NEXT:  .Lpcsection53:
1776; O3-NEXT:    jne .LBB37_1
1777; O3-NEXT:  # %bb.2: # %atomicrmw.end
1778; O3-NEXT:    movq $1, foo(%rip)
1779; O3-NEXT:    retq
1780entry:
1781  load volatile i64, ptr @foo, align 8
1782  %x = atomicrmw nand ptr %a, i8 42 acq_rel, align 1, !pcsections !0
1783  store volatile i64 1, ptr @foo, align 8
1784  ret void
1785}
1786
1787define void @atomic8_xchg_seq_cst(ptr %a) {
1788; O0-LABEL: atomic8_xchg_seq_cst:
1789; O0:       # %bb.0: # %entry
1790; O0-NEXT:    movq foo(%rip), %rax
1791; O0-NEXT:    movb $42, %al
1792; O0-NEXT:  .Lpcsection62:
1793; O0-NEXT:    xchgb %al, (%rdi)
1794; O0-NEXT:    movq $1, foo
1795; O0-NEXT:    retq
1796;
1797; O1-LABEL: atomic8_xchg_seq_cst:
1798; O1:       # %bb.0: # %entry
1799; O1-NEXT:    movq foo(%rip), %rax
1800; O1-NEXT:    movb $42, %al
1801; O1-NEXT:  .Lpcsection54:
1802; O1-NEXT:    xchgb %al, (%rdi)
1803; O1-NEXT:    movq $1, foo(%rip)
1804; O1-NEXT:    retq
1805;
1806; O2-LABEL: atomic8_xchg_seq_cst:
1807; O2:       # %bb.0: # %entry
1808; O2-NEXT:    movq foo(%rip), %rax
1809; O2-NEXT:    movb $42, %al
1810; O2-NEXT:  .Lpcsection54:
1811; O2-NEXT:    xchgb %al, (%rdi)
1812; O2-NEXT:    movq $1, foo(%rip)
1813; O2-NEXT:    retq
1814;
1815; O3-LABEL: atomic8_xchg_seq_cst:
1816; O3:       # %bb.0: # %entry
1817; O3-NEXT:    movq foo(%rip), %rax
1818; O3-NEXT:    movb $42, %al
1819; O3-NEXT:  .Lpcsection54:
1820; O3-NEXT:    xchgb %al, (%rdi)
1821; O3-NEXT:    movq $1, foo(%rip)
1822; O3-NEXT:    retq
1823entry:
1824  load volatile i64, ptr @foo, align 8
1825  %x = atomicrmw xchg ptr %a, i8 42 seq_cst, align 1, !pcsections !0
1826  store volatile i64 1, ptr @foo, align 8
1827  ret void
1828}
1829
1830define void @atomic8_add_seq_cst(ptr %a) {
1831; O0-LABEL: atomic8_add_seq_cst:
1832; O0:       # %bb.0: # %entry
1833; O0-NEXT:    movq foo(%rip), %rax
1834; O0-NEXT:  .Lpcsection63:
1835; O0-NEXT:    lock addb $42, (%rdi)
1836; O0-NEXT:    movq $1, foo
1837; O0-NEXT:    retq
1838;
1839; O1-LABEL: atomic8_add_seq_cst:
1840; O1:       # %bb.0: # %entry
1841; O1-NEXT:    movq foo(%rip), %rax
1842; O1-NEXT:  .Lpcsection55:
1843; O1-NEXT:    lock addb $42, (%rdi)
1844; O1-NEXT:    movq $1, foo(%rip)
1845; O1-NEXT:    retq
1846;
1847; O2-LABEL: atomic8_add_seq_cst:
1848; O2:       # %bb.0: # %entry
1849; O2-NEXT:    movq foo(%rip), %rax
1850; O2-NEXT:  .Lpcsection55:
1851; O2-NEXT:    lock addb $42, (%rdi)
1852; O2-NEXT:    movq $1, foo(%rip)
1853; O2-NEXT:    retq
1854;
1855; O3-LABEL: atomic8_add_seq_cst:
1856; O3:       # %bb.0: # %entry
1857; O3-NEXT:    movq foo(%rip), %rax
1858; O3-NEXT:  .Lpcsection55:
1859; O3-NEXT:    lock addb $42, (%rdi)
1860; O3-NEXT:    movq $1, foo(%rip)
1861; O3-NEXT:    retq
1862entry:
1863  load volatile i64, ptr @foo, align 8
1864  %x = atomicrmw add ptr %a, i8 42 seq_cst, align 1, !pcsections !0
1865  store volatile i64 1, ptr @foo, align 8
1866  ret void
1867}
1868
1869define void @atomic8_sub_seq_cst(ptr %a) {
1870; O0-LABEL: atomic8_sub_seq_cst:
1871; O0:       # %bb.0: # %entry
1872; O0-NEXT:    movq foo(%rip), %rax
1873; O0-NEXT:  .Lpcsection64:
1874; O0-NEXT:    lock subb $42, (%rdi)
1875; O0-NEXT:    movq $1, foo
1876; O0-NEXT:    retq
1877;
1878; O1-LABEL: atomic8_sub_seq_cst:
1879; O1:       # %bb.0: # %entry
1880; O1-NEXT:    movq foo(%rip), %rax
1881; O1-NEXT:  .Lpcsection56:
1882; O1-NEXT:    lock subb $42, (%rdi)
1883; O1-NEXT:    movq $1, foo(%rip)
1884; O1-NEXT:    retq
1885;
1886; O2-LABEL: atomic8_sub_seq_cst:
1887; O2:       # %bb.0: # %entry
1888; O2-NEXT:    movq foo(%rip), %rax
1889; O2-NEXT:  .Lpcsection56:
1890; O2-NEXT:    lock subb $42, (%rdi)
1891; O2-NEXT:    movq $1, foo(%rip)
1892; O2-NEXT:    retq
1893;
1894; O3-LABEL: atomic8_sub_seq_cst:
1895; O3:       # %bb.0: # %entry
1896; O3-NEXT:    movq foo(%rip), %rax
1897; O3-NEXT:  .Lpcsection56:
1898; O3-NEXT:    lock subb $42, (%rdi)
1899; O3-NEXT:    movq $1, foo(%rip)
1900; O3-NEXT:    retq
1901entry:
1902  load volatile i64, ptr @foo, align 8
1903  %x = atomicrmw sub ptr %a, i8 42 seq_cst, align 1, !pcsections !0
1904  store volatile i64 1, ptr @foo, align 8
1905  ret void
1906}
1907
1908define void @atomic8_and_seq_cst(ptr %a) {
1909; O0-LABEL: atomic8_and_seq_cst:
1910; O0:       # %bb.0: # %entry
1911; O0-NEXT:    movq foo(%rip), %rax
1912; O0-NEXT:  .Lpcsection65:
1913; O0-NEXT:    lock andb $42, (%rdi)
1914; O0-NEXT:    movq $1, foo
1915; O0-NEXT:    retq
1916;
1917; O1-LABEL: atomic8_and_seq_cst:
1918; O1:       # %bb.0: # %entry
1919; O1-NEXT:    movq foo(%rip), %rax
1920; O1-NEXT:  .Lpcsection57:
1921; O1-NEXT:    lock andb $42, (%rdi)
1922; O1-NEXT:    movq $1, foo(%rip)
1923; O1-NEXT:    retq
1924;
1925; O2-LABEL: atomic8_and_seq_cst:
1926; O2:       # %bb.0: # %entry
1927; O2-NEXT:    movq foo(%rip), %rax
1928; O2-NEXT:  .Lpcsection57:
1929; O2-NEXT:    lock andb $42, (%rdi)
1930; O2-NEXT:    movq $1, foo(%rip)
1931; O2-NEXT:    retq
1932;
1933; O3-LABEL: atomic8_and_seq_cst:
1934; O3:       # %bb.0: # %entry
1935; O3-NEXT:    movq foo(%rip), %rax
1936; O3-NEXT:  .Lpcsection57:
1937; O3-NEXT:    lock andb $42, (%rdi)
1938; O3-NEXT:    movq $1, foo(%rip)
1939; O3-NEXT:    retq
1940entry:
1941  load volatile i64, ptr @foo, align 8
1942  %x = atomicrmw and ptr %a, i8 42 seq_cst, align 1, !pcsections !0
1943  store volatile i64 1, ptr @foo, align 8
1944  ret void
1945}
1946
1947define void @atomic8_or_seq_cst(ptr %a) {
1948; O0-LABEL: atomic8_or_seq_cst:
1949; O0:       # %bb.0: # %entry
1950; O0-NEXT:    movq foo(%rip), %rax
1951; O0-NEXT:  .Lpcsection66:
1952; O0-NEXT:    lock orb $42, (%rdi)
1953; O0-NEXT:    movq $1, foo
1954; O0-NEXT:    retq
1955;
1956; O1-LABEL: atomic8_or_seq_cst:
1957; O1:       # %bb.0: # %entry
1958; O1-NEXT:    movq foo(%rip), %rax
1959; O1-NEXT:  .Lpcsection58:
1960; O1-NEXT:    lock orb $42, (%rdi)
1961; O1-NEXT:    movq $1, foo(%rip)
1962; O1-NEXT:    retq
1963;
1964; O2-LABEL: atomic8_or_seq_cst:
1965; O2:       # %bb.0: # %entry
1966; O2-NEXT:    movq foo(%rip), %rax
1967; O2-NEXT:  .Lpcsection58:
1968; O2-NEXT:    lock orb $42, (%rdi)
1969; O2-NEXT:    movq $1, foo(%rip)
1970; O2-NEXT:    retq
1971;
1972; O3-LABEL: atomic8_or_seq_cst:
1973; O3:       # %bb.0: # %entry
1974; O3-NEXT:    movq foo(%rip), %rax
1975; O3-NEXT:  .Lpcsection58:
1976; O3-NEXT:    lock orb $42, (%rdi)
1977; O3-NEXT:    movq $1, foo(%rip)
1978; O3-NEXT:    retq
1979entry:
1980  load volatile i64, ptr @foo, align 8
1981  %x = atomicrmw or ptr %a, i8 42 seq_cst, align 1, !pcsections !0
1982  store volatile i64 1, ptr @foo, align 8
1983  ret void
1984}
1985
1986define void @atomic8_xor_seq_cst(ptr %a) {
1987; O0-LABEL: atomic8_xor_seq_cst:
1988; O0:       # %bb.0: # %entry
1989; O0-NEXT:    movq foo(%rip), %rax
1990; O0-NEXT:  .Lpcsection67:
1991; O0-NEXT:    lock xorb $42, (%rdi)
1992; O0-NEXT:    movq $1, foo
1993; O0-NEXT:    retq
1994;
1995; O1-LABEL: atomic8_xor_seq_cst:
1996; O1:       # %bb.0: # %entry
1997; O1-NEXT:    movq foo(%rip), %rax
1998; O1-NEXT:  .Lpcsection59:
1999; O1-NEXT:    lock xorb $42, (%rdi)
2000; O1-NEXT:    movq $1, foo(%rip)
2001; O1-NEXT:    retq
2002;
2003; O2-LABEL: atomic8_xor_seq_cst:
2004; O2:       # %bb.0: # %entry
2005; O2-NEXT:    movq foo(%rip), %rax
2006; O2-NEXT:  .Lpcsection59:
2007; O2-NEXT:    lock xorb $42, (%rdi)
2008; O2-NEXT:    movq $1, foo(%rip)
2009; O2-NEXT:    retq
2010;
2011; O3-LABEL: atomic8_xor_seq_cst:
2012; O3:       # %bb.0: # %entry
2013; O3-NEXT:    movq foo(%rip), %rax
2014; O3-NEXT:  .Lpcsection59:
2015; O3-NEXT:    lock xorb $42, (%rdi)
2016; O3-NEXT:    movq $1, foo(%rip)
2017; O3-NEXT:    retq
2018entry:
2019  load volatile i64, ptr @foo, align 8
2020  %x = atomicrmw xor ptr %a, i8 42 seq_cst, align 1, !pcsections !0
2021  store volatile i64 1, ptr @foo, align 8
2022  ret void
2023}
2024
2025define void @atomic8_nand_seq_cst(ptr %a) {
2026; O0-LABEL: atomic8_nand_seq_cst:
2027; O0:       # %bb.0: # %entry
2028; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
2029; O0-NEXT:    movq foo, %rax
2030; O0-NEXT:  .Lpcsection68:
2031; O0-NEXT:    movb (%rdi), %al
2032; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2033; O0-NEXT:  .LBB44_1: # %atomicrmw.start
2034; O0-NEXT:    # =>This Inner Loop Header: Depth=1
2035; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2036; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
2037; O0-NEXT:    movb %al, %dl
2038; O0-NEXT:  .Lpcsection69:
2039; O0-NEXT:    notb %dl
2040; O0-NEXT:  .Lpcsection70:
2041; O0-NEXT:    orb $-43, %dl
2042; O0-NEXT:  .Lpcsection71:
2043; O0-NEXT:    lock cmpxchgb %dl, (%rcx)
2044; O0-NEXT:  .Lpcsection72:
2045; O0-NEXT:    sete %cl
2046; O0-NEXT:  .Lpcsection73:
2047; O0-NEXT:    testb $1, %cl
2048; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2049; O0-NEXT:  .Lpcsection74:
2050; O0-NEXT:    jne .LBB44_2
2051; O0-NEXT:    jmp .LBB44_1
2052; O0-NEXT:  .LBB44_2: # %atomicrmw.end
2053; O0-NEXT:    movq $1, foo
2054; O0-NEXT:    retq
2055;
2056; O1-LABEL: atomic8_nand_seq_cst:
2057; O1:       # %bb.0: # %entry
2058; O1-NEXT:    movq foo(%rip), %rax
2059; O1-NEXT:  .Lpcsection60:
2060; O1-NEXT:    movzbl (%rdi), %eax
2061; O1-NEXT:    .p2align 4
2062; O1-NEXT:  .LBB44_1: # %atomicrmw.start
2063; O1-NEXT:    # =>This Inner Loop Header: Depth=1
2064; O1-NEXT:    movl %eax, %ecx
2065; O1-NEXT:  .Lpcsection61:
2066; O1-NEXT:    notb %cl
2067; O1-NEXT:  .Lpcsection62:
2068; O1-NEXT:    orb $-43, %cl
2069; O1-NEXT:  .Lpcsection63:
2070; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2071; O1-NEXT:  .Lpcsection64:
2072; O1-NEXT:    jne .LBB44_1
2073; O1-NEXT:  # %bb.2: # %atomicrmw.end
2074; O1-NEXT:    movq $1, foo(%rip)
2075; O1-NEXT:    retq
2076;
2077; O2-LABEL: atomic8_nand_seq_cst:
2078; O2:       # %bb.0: # %entry
2079; O2-NEXT:    movq foo(%rip), %rax
2080; O2-NEXT:  .Lpcsection60:
2081; O2-NEXT:    movzbl (%rdi), %eax
2082; O2-NEXT:    .p2align 4
2083; O2-NEXT:  .LBB44_1: # %atomicrmw.start
2084; O2-NEXT:    # =>This Inner Loop Header: Depth=1
2085; O2-NEXT:    movl %eax, %ecx
2086; O2-NEXT:  .Lpcsection61:
2087; O2-NEXT:    notb %cl
2088; O2-NEXT:  .Lpcsection62:
2089; O2-NEXT:    orb $-43, %cl
2090; O2-NEXT:  .Lpcsection63:
2091; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2092; O2-NEXT:  .Lpcsection64:
2093; O2-NEXT:    jne .LBB44_1
2094; O2-NEXT:  # %bb.2: # %atomicrmw.end
2095; O2-NEXT:    movq $1, foo(%rip)
2096; O2-NEXT:    retq
2097;
2098; O3-LABEL: atomic8_nand_seq_cst:
2099; O3:       # %bb.0: # %entry
2100; O3-NEXT:    movq foo(%rip), %rax
2101; O3-NEXT:  .Lpcsection60:
2102; O3-NEXT:    movzbl (%rdi), %eax
2103; O3-NEXT:    .p2align 4
2104; O3-NEXT:  .LBB44_1: # %atomicrmw.start
2105; O3-NEXT:    # =>This Inner Loop Header: Depth=1
2106; O3-NEXT:    movl %eax, %ecx
2107; O3-NEXT:  .Lpcsection61:
2108; O3-NEXT:    notb %cl
2109; O3-NEXT:  .Lpcsection62:
2110; O3-NEXT:    orb $-43, %cl
2111; O3-NEXT:  .Lpcsection63:
2112; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2113; O3-NEXT:  .Lpcsection64:
2114; O3-NEXT:    jne .LBB44_1
2115; O3-NEXT:  # %bb.2: # %atomicrmw.end
2116; O3-NEXT:    movq $1, foo(%rip)
2117; O3-NEXT:    retq
2118entry:
2119  load volatile i64, ptr @foo, align 8
2120  %x = atomicrmw nand ptr %a, i8 42 seq_cst, align 1, !pcsections !0
2121  store volatile i64 1, ptr @foo, align 8
2122  ret void
2123}
2124
2125define void @atomic8_cas_monotonic(ptr %a) {
2126; O0-LABEL: atomic8_cas_monotonic:
2127; O0:       # %bb.0: # %entry
2128; O0-NEXT:    movq foo(%rip), %rax
2129; O0-NEXT:    movb $42, %al
2130; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2131; O0-NEXT:    movb $1, %cl
2132; O0-NEXT:  .Lpcsection75:
2133; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2134; O0-NEXT:  .Lpcsection76:
2135; O0-NEXT:    # kill: def $dl killed $al
2136; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2137; O0-NEXT:  .Lpcsection77:
2138; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2139; O0-NEXT:  .Lpcsection78:
2140; O0-NEXT:    # kill: def $dl killed $al
2141; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2142; O0-NEXT:  .Lpcsection79:
2143; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2144; O0-NEXT:    movq $1, foo
2145; O0-NEXT:    retq
2146;
2147; O1-LABEL: atomic8_cas_monotonic:
2148; O1:       # %bb.0: # %entry
2149; O1-NEXT:    movq foo(%rip), %rax
2150; O1-NEXT:    movb $1, %cl
2151; O1-NEXT:  .Lpcsection65:
2152; O1-NEXT:    movb $42, %al
2153; O1-NEXT:  .Lpcsection66:
2154; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2155; O1-NEXT:  .Lpcsection67:
2156; O1-NEXT:    movb $42, %al
2157; O1-NEXT:  .Lpcsection68:
2158; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2159; O1-NEXT:  .Lpcsection69:
2160; O1-NEXT:    movb $42, %al
2161; O1-NEXT:  .Lpcsection70:
2162; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2163; O1-NEXT:    movq $1, foo(%rip)
2164; O1-NEXT:    retq
2165;
2166; O2-LABEL: atomic8_cas_monotonic:
2167; O2:       # %bb.0: # %entry
2168; O2-NEXT:    movq foo(%rip), %rax
2169; O2-NEXT:    movb $1, %cl
2170; O2-NEXT:  .Lpcsection65:
2171; O2-NEXT:    movb $42, %al
2172; O2-NEXT:  .Lpcsection66:
2173; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2174; O2-NEXT:  .Lpcsection67:
2175; O2-NEXT:    movb $42, %al
2176; O2-NEXT:  .Lpcsection68:
2177; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2178; O2-NEXT:  .Lpcsection69:
2179; O2-NEXT:    movb $42, %al
2180; O2-NEXT:  .Lpcsection70:
2181; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2182; O2-NEXT:    movq $1, foo(%rip)
2183; O2-NEXT:    retq
2184;
2185; O3-LABEL: atomic8_cas_monotonic:
2186; O3:       # %bb.0: # %entry
2187; O3-NEXT:    movq foo(%rip), %rax
2188; O3-NEXT:    movb $1, %cl
2189; O3-NEXT:  .Lpcsection65:
2190; O3-NEXT:    movb $42, %al
2191; O3-NEXT:  .Lpcsection66:
2192; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2193; O3-NEXT:  .Lpcsection67:
2194; O3-NEXT:    movb $42, %al
2195; O3-NEXT:  .Lpcsection68:
2196; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2197; O3-NEXT:  .Lpcsection69:
2198; O3-NEXT:    movb $42, %al
2199; O3-NEXT:  .Lpcsection70:
2200; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2201; O3-NEXT:    movq $1, foo(%rip)
2202; O3-NEXT:    retq
2203entry:
2204  load volatile i64, ptr @foo, align 8
2205  %x = cmpxchg ptr %a, i8 42, i8 1 monotonic monotonic, align 1, !pcsections !0
2206  %y = cmpxchg ptr %a, i8 42, i8 1 monotonic acquire, align 1, !pcsections !0
2207  %z = cmpxchg ptr %a, i8 42, i8 1 monotonic seq_cst, align 1, !pcsections !0
2208  store volatile i64 1, ptr @foo, align 8
2209  ret void
2210}
2211
2212define void @atomic8_cas_acquire(ptr %a) {
2213; O0-LABEL: atomic8_cas_acquire:
2214; O0:       # %bb.0: # %entry
2215; O0-NEXT:    movq foo(%rip), %rax
2216; O0-NEXT:    movb $42, %al
2217; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2218; O0-NEXT:    movb $1, %cl
2219; O0-NEXT:  .Lpcsection80:
2220; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2221; O0-NEXT:  .Lpcsection81:
2222; O0-NEXT:    # kill: def $dl killed $al
2223; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2224; O0-NEXT:  .Lpcsection82:
2225; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2226; O0-NEXT:  .Lpcsection83:
2227; O0-NEXT:    # kill: def $dl killed $al
2228; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2229; O0-NEXT:  .Lpcsection84:
2230; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2231; O0-NEXT:    movq $1, foo
2232; O0-NEXT:    retq
2233;
2234; O1-LABEL: atomic8_cas_acquire:
2235; O1:       # %bb.0: # %entry
2236; O1-NEXT:    movq foo(%rip), %rax
2237; O1-NEXT:    movb $1, %cl
2238; O1-NEXT:  .Lpcsection71:
2239; O1-NEXT:    movb $42, %al
2240; O1-NEXT:  .Lpcsection72:
2241; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2242; O1-NEXT:  .Lpcsection73:
2243; O1-NEXT:    movb $42, %al
2244; O1-NEXT:  .Lpcsection74:
2245; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2246; O1-NEXT:  .Lpcsection75:
2247; O1-NEXT:    movb $42, %al
2248; O1-NEXT:  .Lpcsection76:
2249; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2250; O1-NEXT:    movq $1, foo(%rip)
2251; O1-NEXT:    retq
2252;
2253; O2-LABEL: atomic8_cas_acquire:
2254; O2:       # %bb.0: # %entry
2255; O2-NEXT:    movq foo(%rip), %rax
2256; O2-NEXT:    movb $1, %cl
2257; O2-NEXT:  .Lpcsection71:
2258; O2-NEXT:    movb $42, %al
2259; O2-NEXT:  .Lpcsection72:
2260; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2261; O2-NEXT:  .Lpcsection73:
2262; O2-NEXT:    movb $42, %al
2263; O2-NEXT:  .Lpcsection74:
2264; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2265; O2-NEXT:  .Lpcsection75:
2266; O2-NEXT:    movb $42, %al
2267; O2-NEXT:  .Lpcsection76:
2268; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2269; O2-NEXT:    movq $1, foo(%rip)
2270; O2-NEXT:    retq
2271;
2272; O3-LABEL: atomic8_cas_acquire:
2273; O3:       # %bb.0: # %entry
2274; O3-NEXT:    movq foo(%rip), %rax
2275; O3-NEXT:    movb $1, %cl
2276; O3-NEXT:  .Lpcsection71:
2277; O3-NEXT:    movb $42, %al
2278; O3-NEXT:  .Lpcsection72:
2279; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2280; O3-NEXT:  .Lpcsection73:
2281; O3-NEXT:    movb $42, %al
2282; O3-NEXT:  .Lpcsection74:
2283; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2284; O3-NEXT:  .Lpcsection75:
2285; O3-NEXT:    movb $42, %al
2286; O3-NEXT:  .Lpcsection76:
2287; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2288; O3-NEXT:    movq $1, foo(%rip)
2289; O3-NEXT:    retq
2290entry:
2291  load volatile i64, ptr @foo, align 8
2292  %x = cmpxchg ptr %a, i8 42, i8 1 acquire monotonic, align 1, !pcsections !0
2293  %y = cmpxchg ptr %a, i8 42, i8 1 acquire acquire, align 1, !pcsections !0
2294  %z = cmpxchg ptr %a, i8 42, i8 1 acquire seq_cst, align 1, !pcsections !0
2295  store volatile i64 1, ptr @foo, align 8
2296  ret void
2297}
2298
2299define void @atomic8_cas_release(ptr %a) {
2300; O0-LABEL: atomic8_cas_release:
2301; O0:       # %bb.0: # %entry
2302; O0-NEXT:    movq foo(%rip), %rax
2303; O0-NEXT:    movb $42, %al
2304; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2305; O0-NEXT:    movb $1, %cl
2306; O0-NEXT:  .Lpcsection85:
2307; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2308; O0-NEXT:  .Lpcsection86:
2309; O0-NEXT:    # kill: def $dl killed $al
2310; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2311; O0-NEXT:  .Lpcsection87:
2312; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2313; O0-NEXT:  .Lpcsection88:
2314; O0-NEXT:    # kill: def $dl killed $al
2315; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2316; O0-NEXT:  .Lpcsection89:
2317; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2318; O0-NEXT:    movq $1, foo
2319; O0-NEXT:    retq
2320;
2321; O1-LABEL: atomic8_cas_release:
2322; O1:       # %bb.0: # %entry
2323; O1-NEXT:    movq foo(%rip), %rax
2324; O1-NEXT:    movb $1, %cl
2325; O1-NEXT:  .Lpcsection77:
2326; O1-NEXT:    movb $42, %al
2327; O1-NEXT:  .Lpcsection78:
2328; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2329; O1-NEXT:  .Lpcsection79:
2330; O1-NEXT:    movb $42, %al
2331; O1-NEXT:  .Lpcsection80:
2332; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2333; O1-NEXT:  .Lpcsection81:
2334; O1-NEXT:    movb $42, %al
2335; O1-NEXT:  .Lpcsection82:
2336; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2337; O1-NEXT:    movq $1, foo(%rip)
2338; O1-NEXT:    retq
2339;
2340; O2-LABEL: atomic8_cas_release:
2341; O2:       # %bb.0: # %entry
2342; O2-NEXT:    movq foo(%rip), %rax
2343; O2-NEXT:    movb $1, %cl
2344; O2-NEXT:  .Lpcsection77:
2345; O2-NEXT:    movb $42, %al
2346; O2-NEXT:  .Lpcsection78:
2347; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2348; O2-NEXT:  .Lpcsection79:
2349; O2-NEXT:    movb $42, %al
2350; O2-NEXT:  .Lpcsection80:
2351; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2352; O2-NEXT:  .Lpcsection81:
2353; O2-NEXT:    movb $42, %al
2354; O2-NEXT:  .Lpcsection82:
2355; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2356; O2-NEXT:    movq $1, foo(%rip)
2357; O2-NEXT:    retq
2358;
2359; O3-LABEL: atomic8_cas_release:
2360; O3:       # %bb.0: # %entry
2361; O3-NEXT:    movq foo(%rip), %rax
2362; O3-NEXT:    movb $1, %cl
2363; O3-NEXT:  .Lpcsection77:
2364; O3-NEXT:    movb $42, %al
2365; O3-NEXT:  .Lpcsection78:
2366; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2367; O3-NEXT:  .Lpcsection79:
2368; O3-NEXT:    movb $42, %al
2369; O3-NEXT:  .Lpcsection80:
2370; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2371; O3-NEXT:  .Lpcsection81:
2372; O3-NEXT:    movb $42, %al
2373; O3-NEXT:  .Lpcsection82:
2374; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2375; O3-NEXT:    movq $1, foo(%rip)
2376; O3-NEXT:    retq
2377entry:
2378  load volatile i64, ptr @foo, align 8
2379  %x = cmpxchg ptr %a, i8 42, i8 1 release monotonic, align 1, !pcsections !0
2380  %y = cmpxchg ptr %a, i8 42, i8 1 release acquire, align 1, !pcsections !0
2381  %z = cmpxchg ptr %a, i8 42, i8 1 release seq_cst, align 1, !pcsections !0
2382  store volatile i64 1, ptr @foo, align 8
2383  ret void
2384}
2385
2386define void @atomic8_cas_acq_rel(ptr %a) {
2387; O0-LABEL: atomic8_cas_acq_rel:
2388; O0:       # %bb.0: # %entry
2389; O0-NEXT:    movq foo(%rip), %rax
2390; O0-NEXT:    movb $42, %al
2391; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2392; O0-NEXT:    movb $1, %cl
2393; O0-NEXT:  .Lpcsection90:
2394; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2395; O0-NEXT:  .Lpcsection91:
2396; O0-NEXT:    # kill: def $dl killed $al
2397; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2398; O0-NEXT:  .Lpcsection92:
2399; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2400; O0-NEXT:  .Lpcsection93:
2401; O0-NEXT:    # kill: def $dl killed $al
2402; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2403; O0-NEXT:  .Lpcsection94:
2404; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2405; O0-NEXT:    movq $1, foo
2406; O0-NEXT:    retq
2407;
2408; O1-LABEL: atomic8_cas_acq_rel:
2409; O1:       # %bb.0: # %entry
2410; O1-NEXT:    movq foo(%rip), %rax
2411; O1-NEXT:    movb $1, %cl
2412; O1-NEXT:  .Lpcsection83:
2413; O1-NEXT:    movb $42, %al
2414; O1-NEXT:  .Lpcsection84:
2415; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2416; O1-NEXT:  .Lpcsection85:
2417; O1-NEXT:    movb $42, %al
2418; O1-NEXT:  .Lpcsection86:
2419; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2420; O1-NEXT:  .Lpcsection87:
2421; O1-NEXT:    movb $42, %al
2422; O1-NEXT:  .Lpcsection88:
2423; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2424; O1-NEXT:    movq $1, foo(%rip)
2425; O1-NEXT:    retq
2426;
2427; O2-LABEL: atomic8_cas_acq_rel:
2428; O2:       # %bb.0: # %entry
2429; O2-NEXT:    movq foo(%rip), %rax
2430; O2-NEXT:    movb $1, %cl
2431; O2-NEXT:  .Lpcsection83:
2432; O2-NEXT:    movb $42, %al
2433; O2-NEXT:  .Lpcsection84:
2434; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2435; O2-NEXT:  .Lpcsection85:
2436; O2-NEXT:    movb $42, %al
2437; O2-NEXT:  .Lpcsection86:
2438; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2439; O2-NEXT:  .Lpcsection87:
2440; O2-NEXT:    movb $42, %al
2441; O2-NEXT:  .Lpcsection88:
2442; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2443; O2-NEXT:    movq $1, foo(%rip)
2444; O2-NEXT:    retq
2445;
2446; O3-LABEL: atomic8_cas_acq_rel:
2447; O3:       # %bb.0: # %entry
2448; O3-NEXT:    movq foo(%rip), %rax
2449; O3-NEXT:    movb $1, %cl
2450; O3-NEXT:  .Lpcsection83:
2451; O3-NEXT:    movb $42, %al
2452; O3-NEXT:  .Lpcsection84:
2453; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2454; O3-NEXT:  .Lpcsection85:
2455; O3-NEXT:    movb $42, %al
2456; O3-NEXT:  .Lpcsection86:
2457; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2458; O3-NEXT:  .Lpcsection87:
2459; O3-NEXT:    movb $42, %al
2460; O3-NEXT:  .Lpcsection88:
2461; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2462; O3-NEXT:    movq $1, foo(%rip)
2463; O3-NEXT:    retq
2464entry:
2465  load volatile i64, ptr @foo, align 8
2466  %x = cmpxchg ptr %a, i8 42, i8 1 acq_rel monotonic, align 1, !pcsections !0
2467  %y = cmpxchg ptr %a, i8 42, i8 1 acq_rel acquire, align 1, !pcsections !0
2468  %z = cmpxchg ptr %a, i8 42, i8 1 acq_rel seq_cst, align 1, !pcsections !0
2469  store volatile i64 1, ptr @foo, align 8
2470  ret void
2471}
2472
2473define void @atomic8_cas_seq_cst(ptr %a) {
2474; O0-LABEL: atomic8_cas_seq_cst:
2475; O0:       # %bb.0: # %entry
2476; O0-NEXT:    movq foo(%rip), %rax
2477; O0-NEXT:    movb $42, %al
2478; O0-NEXT:    movb %al, {{[-0-9]+}}(%r{{[sb]}}p) # 1-byte Spill
2479; O0-NEXT:    movb $1, %cl
2480; O0-NEXT:  .Lpcsection95:
2481; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2482; O0-NEXT:  .Lpcsection96:
2483; O0-NEXT:    # kill: def $dl killed $al
2484; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2485; O0-NEXT:  .Lpcsection97:
2486; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2487; O0-NEXT:  .Lpcsection98:
2488; O0-NEXT:    # kill: def $dl killed $al
2489; O0-NEXT:    movb {{[-0-9]+}}(%r{{[sb]}}p), %al # 1-byte Reload
2490; O0-NEXT:  .Lpcsection99:
2491; O0-NEXT:    lock cmpxchgb %cl, (%rdi)
2492; O0-NEXT:    movq $1, foo
2493; O0-NEXT:    retq
2494;
2495; O1-LABEL: atomic8_cas_seq_cst:
2496; O1:       # %bb.0: # %entry
2497; O1-NEXT:    movq foo(%rip), %rax
2498; O1-NEXT:    movb $1, %cl
2499; O1-NEXT:  .Lpcsection89:
2500; O1-NEXT:    movb $42, %al
2501; O1-NEXT:  .Lpcsection90:
2502; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2503; O1-NEXT:  .Lpcsection91:
2504; O1-NEXT:    movb $42, %al
2505; O1-NEXT:  .Lpcsection92:
2506; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2507; O1-NEXT:  .Lpcsection93:
2508; O1-NEXT:    movb $42, %al
2509; O1-NEXT:  .Lpcsection94:
2510; O1-NEXT:    lock cmpxchgb %cl, (%rdi)
2511; O1-NEXT:    movq $1, foo(%rip)
2512; O1-NEXT:    retq
2513;
2514; O2-LABEL: atomic8_cas_seq_cst:
2515; O2:       # %bb.0: # %entry
2516; O2-NEXT:    movq foo(%rip), %rax
2517; O2-NEXT:    movb $1, %cl
2518; O2-NEXT:  .Lpcsection89:
2519; O2-NEXT:    movb $42, %al
2520; O2-NEXT:  .Lpcsection90:
2521; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2522; O2-NEXT:  .Lpcsection91:
2523; O2-NEXT:    movb $42, %al
2524; O2-NEXT:  .Lpcsection92:
2525; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2526; O2-NEXT:  .Lpcsection93:
2527; O2-NEXT:    movb $42, %al
2528; O2-NEXT:  .Lpcsection94:
2529; O2-NEXT:    lock cmpxchgb %cl, (%rdi)
2530; O2-NEXT:    movq $1, foo(%rip)
2531; O2-NEXT:    retq
2532;
2533; O3-LABEL: atomic8_cas_seq_cst:
2534; O3:       # %bb.0: # %entry
2535; O3-NEXT:    movq foo(%rip), %rax
2536; O3-NEXT:    movb $1, %cl
2537; O3-NEXT:  .Lpcsection89:
2538; O3-NEXT:    movb $42, %al
2539; O3-NEXT:  .Lpcsection90:
2540; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2541; O3-NEXT:  .Lpcsection91:
2542; O3-NEXT:    movb $42, %al
2543; O3-NEXT:  .Lpcsection92:
2544; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2545; O3-NEXT:  .Lpcsection93:
2546; O3-NEXT:    movb $42, %al
2547; O3-NEXT:  .Lpcsection94:
2548; O3-NEXT:    lock cmpxchgb %cl, (%rdi)
2549; O3-NEXT:    movq $1, foo(%rip)
2550; O3-NEXT:    retq
2551entry:
2552  load volatile i64, ptr @foo, align 8
2553  %x = cmpxchg ptr %a, i8 42, i8 1 seq_cst monotonic, align 1, !pcsections !0
2554  %y = cmpxchg ptr %a, i8 42, i8 1 seq_cst acquire, align 1, !pcsections !0
2555  %z = cmpxchg ptr %a, i8 42, i8 1 seq_cst seq_cst, align 1, !pcsections !0
2556  store volatile i64 1, ptr @foo, align 8
2557  ret void
2558}
2559
2560define i16 @atomic16_load_unordered(ptr %a) {
2561; O0-LABEL: atomic16_load_unordered:
2562; O0:       # %bb.0: # %entry
2563; O0-NEXT:    movq foo(%rip), %rax
2564; O0-NEXT:  .Lpcsection100:
2565; O0-NEXT:    movw (%rdi), %ax
2566; O0-NEXT:    movq $1, foo
2567; O0-NEXT:    retq
2568;
2569; O1-LABEL: atomic16_load_unordered:
2570; O1:       # %bb.0: # %entry
2571; O1-NEXT:    movq foo(%rip), %rax
2572; O1-NEXT:  .Lpcsection95:
2573; O1-NEXT:    movzwl (%rdi), %eax
2574; O1-NEXT:    movq $1, foo(%rip)
2575; O1-NEXT:    retq
2576;
2577; O2-LABEL: atomic16_load_unordered:
2578; O2:       # %bb.0: # %entry
2579; O2-NEXT:    movq foo(%rip), %rax
2580; O2-NEXT:  .Lpcsection95:
2581; O2-NEXT:    movzwl (%rdi), %eax
2582; O2-NEXT:    movq $1, foo(%rip)
2583; O2-NEXT:    retq
2584;
2585; O3-LABEL: atomic16_load_unordered:
2586; O3:       # %bb.0: # %entry
2587; O3-NEXT:    movq foo(%rip), %rax
2588; O3-NEXT:  .Lpcsection95:
2589; O3-NEXT:    movzwl (%rdi), %eax
2590; O3-NEXT:    movq $1, foo(%rip)
2591; O3-NEXT:    retq
2592entry:
2593  load volatile i64, ptr @foo, align 8
2594  %x = load atomic i16, ptr %a unordered, align 2, !pcsections !0
2595  store volatile i64 1, ptr @foo, align 8
2596  ret i16 %x
2597}
2598
2599define i16 @atomic16_load_monotonic(ptr %a) {
2600; O0-LABEL: atomic16_load_monotonic:
2601; O0:       # %bb.0: # %entry
2602; O0-NEXT:    movq foo(%rip), %rax
2603; O0-NEXT:  .Lpcsection101:
2604; O0-NEXT:    movw (%rdi), %ax
2605; O0-NEXT:    movq $1, foo
2606; O0-NEXT:    retq
2607;
2608; O1-LABEL: atomic16_load_monotonic:
2609; O1:       # %bb.0: # %entry
2610; O1-NEXT:    movq foo(%rip), %rax
2611; O1-NEXT:  .Lpcsection96:
2612; O1-NEXT:    movzwl (%rdi), %eax
2613; O1-NEXT:    movq $1, foo(%rip)
2614; O1-NEXT:    retq
2615;
2616; O2-LABEL: atomic16_load_monotonic:
2617; O2:       # %bb.0: # %entry
2618; O2-NEXT:    movq foo(%rip), %rax
2619; O2-NEXT:  .Lpcsection96:
2620; O2-NEXT:    movzwl (%rdi), %eax
2621; O2-NEXT:    movq $1, foo(%rip)
2622; O2-NEXT:    retq
2623;
2624; O3-LABEL: atomic16_load_monotonic:
2625; O3:       # %bb.0: # %entry
2626; O3-NEXT:    movq foo(%rip), %rax
2627; O3-NEXT:  .Lpcsection96:
2628; O3-NEXT:    movzwl (%rdi), %eax
2629; O3-NEXT:    movq $1, foo(%rip)
2630; O3-NEXT:    retq
2631entry:
2632  load volatile i64, ptr @foo, align 8
2633  %x = load atomic i16, ptr %a monotonic, align 2, !pcsections !0
2634  store volatile i64 1, ptr @foo, align 8
2635  ret i16 %x
2636}
2637
2638define i16 @atomic16_load_acquire(ptr %a) {
2639; O0-LABEL: atomic16_load_acquire:
2640; O0:       # %bb.0: # %entry
2641; O0-NEXT:    movq foo(%rip), %rax
2642; O0-NEXT:  .Lpcsection102:
2643; O0-NEXT:    movw (%rdi), %ax
2644; O0-NEXT:    movq $1, foo
2645; O0-NEXT:    retq
2646;
2647; O1-LABEL: atomic16_load_acquire:
2648; O1:       # %bb.0: # %entry
2649; O1-NEXT:    movq foo(%rip), %rax
2650; O1-NEXT:  .Lpcsection97:
2651; O1-NEXT:    movzwl (%rdi), %eax
2652; O1-NEXT:    movq $1, foo(%rip)
2653; O1-NEXT:    retq
2654;
2655; O2-LABEL: atomic16_load_acquire:
2656; O2:       # %bb.0: # %entry
2657; O2-NEXT:    movq foo(%rip), %rax
2658; O2-NEXT:  .Lpcsection97:
2659; O2-NEXT:    movzwl (%rdi), %eax
2660; O2-NEXT:    movq $1, foo(%rip)
2661; O2-NEXT:    retq
2662;
2663; O3-LABEL: atomic16_load_acquire:
2664; O3:       # %bb.0: # %entry
2665; O3-NEXT:    movq foo(%rip), %rax
2666; O3-NEXT:  .Lpcsection97:
2667; O3-NEXT:    movzwl (%rdi), %eax
2668; O3-NEXT:    movq $1, foo(%rip)
2669; O3-NEXT:    retq
2670entry:
2671  load volatile i64, ptr @foo, align 8
2672  %x = load atomic i16, ptr %a acquire, align 2, !pcsections !0
2673  store volatile i64 1, ptr @foo, align 8
2674  ret i16 %x
2675}
2676
2677define i16 @atomic16_load_seq_cst(ptr %a) {
2678; O0-LABEL: atomic16_load_seq_cst:
2679; O0:       # %bb.0: # %entry
2680; O0-NEXT:    movq foo(%rip), %rax
2681; O0-NEXT:  .Lpcsection103:
2682; O0-NEXT:    movw (%rdi), %ax
2683; O0-NEXT:    movq $1, foo
2684; O0-NEXT:    retq
2685;
2686; O1-LABEL: atomic16_load_seq_cst:
2687; O1:       # %bb.0: # %entry
2688; O1-NEXT:    movq foo(%rip), %rax
2689; O1-NEXT:  .Lpcsection98:
2690; O1-NEXT:    movzwl (%rdi), %eax
2691; O1-NEXT:    movq $1, foo(%rip)
2692; O1-NEXT:    retq
2693;
2694; O2-LABEL: atomic16_load_seq_cst:
2695; O2:       # %bb.0: # %entry
2696; O2-NEXT:    movq foo(%rip), %rax
2697; O2-NEXT:  .Lpcsection98:
2698; O2-NEXT:    movzwl (%rdi), %eax
2699; O2-NEXT:    movq $1, foo(%rip)
2700; O2-NEXT:    retq
2701;
2702; O3-LABEL: atomic16_load_seq_cst:
2703; O3:       # %bb.0: # %entry
2704; O3-NEXT:    movq foo(%rip), %rax
2705; O3-NEXT:  .Lpcsection98:
2706; O3-NEXT:    movzwl (%rdi), %eax
2707; O3-NEXT:    movq $1, foo(%rip)
2708; O3-NEXT:    retq
2709entry:
2710  load volatile i64, ptr @foo, align 8
2711  %x = load atomic i16, ptr %a seq_cst, align 2, !pcsections !0
2712  store volatile i64 1, ptr @foo, align 8
2713  ret i16 %x
2714}
2715
2716define void @atomic16_store_unordered(ptr %a) {
2717; O0-LABEL: atomic16_store_unordered:
2718; O0:       # %bb.0: # %entry
2719; O0-NEXT:    movq foo(%rip), %rax
2720; O0-NEXT:  .Lpcsection104:
2721; O0-NEXT:    movw $42, (%rdi)
2722; O0-NEXT:    movq $1, foo
2723; O0-NEXT:    retq
2724;
2725; O1-LABEL: atomic16_store_unordered:
2726; O1:       # %bb.0: # %entry
2727; O1-NEXT:    movq foo(%rip), %rax
2728; O1-NEXT:  .Lpcsection99:
2729; O1-NEXT:    movw $42, (%rdi)
2730; O1-NEXT:    movq $1, foo(%rip)
2731; O1-NEXT:    retq
2732;
2733; O2-LABEL: atomic16_store_unordered:
2734; O2:       # %bb.0: # %entry
2735; O2-NEXT:    movq foo(%rip), %rax
2736; O2-NEXT:  .Lpcsection99:
2737; O2-NEXT:    movw $42, (%rdi)
2738; O2-NEXT:    movq $1, foo(%rip)
2739; O2-NEXT:    retq
2740;
2741; O3-LABEL: atomic16_store_unordered:
2742; O3:       # %bb.0: # %entry
2743; O3-NEXT:    movq foo(%rip), %rax
2744; O3-NEXT:  .Lpcsection99:
2745; O3-NEXT:    movw $42, (%rdi)
2746; O3-NEXT:    movq $1, foo(%rip)
2747; O3-NEXT:    retq
2748entry:
2749  load volatile i64, ptr @foo, align 8
2750  store atomic i16 42, ptr %a unordered, align 2, !pcsections !0
2751  store volatile i64 1, ptr @foo, align 8
2752  ret void
2753}
2754
2755define void @atomic16_store_monotonic(ptr %a) {
2756; O0-LABEL: atomic16_store_monotonic:
2757; O0:       # %bb.0: # %entry
2758; O0-NEXT:    movq foo(%rip), %rax
2759; O0-NEXT:  .Lpcsection105:
2760; O0-NEXT:    movw $42, (%rdi)
2761; O0-NEXT:    movq $1, foo
2762; O0-NEXT:    retq
2763;
2764; O1-LABEL: atomic16_store_monotonic:
2765; O1:       # %bb.0: # %entry
2766; O1-NEXT:    movq foo(%rip), %rax
2767; O1-NEXT:  .Lpcsection100:
2768; O1-NEXT:    movw $42, (%rdi)
2769; O1-NEXT:    movq $1, foo(%rip)
2770; O1-NEXT:    retq
2771;
2772; O2-LABEL: atomic16_store_monotonic:
2773; O2:       # %bb.0: # %entry
2774; O2-NEXT:    movq foo(%rip), %rax
2775; O2-NEXT:  .Lpcsection100:
2776; O2-NEXT:    movw $42, (%rdi)
2777; O2-NEXT:    movq $1, foo(%rip)
2778; O2-NEXT:    retq
2779;
2780; O3-LABEL: atomic16_store_monotonic:
2781; O3:       # %bb.0: # %entry
2782; O3-NEXT:    movq foo(%rip), %rax
2783; O3-NEXT:  .Lpcsection100:
2784; O3-NEXT:    movw $42, (%rdi)
2785; O3-NEXT:    movq $1, foo(%rip)
2786; O3-NEXT:    retq
2787entry:
2788  load volatile i64, ptr @foo, align 8
2789  store atomic i16 42, ptr %a monotonic, align 2, !pcsections !0
2790  store volatile i64 1, ptr @foo, align 8
2791  ret void
2792}
2793
2794define void @atomic16_store_release(ptr %a) {
2795; O0-LABEL: atomic16_store_release:
2796; O0:       # %bb.0: # %entry
2797; O0-NEXT:    movq foo(%rip), %rax
2798; O0-NEXT:  .Lpcsection106:
2799; O0-NEXT:    movw $42, (%rdi)
2800; O0-NEXT:    movq $1, foo
2801; O0-NEXT:    retq
2802;
2803; O1-LABEL: atomic16_store_release:
2804; O1:       # %bb.0: # %entry
2805; O1-NEXT:    movq foo(%rip), %rax
2806; O1-NEXT:  .Lpcsection101:
2807; O1-NEXT:    movw $42, (%rdi)
2808; O1-NEXT:    movq $1, foo(%rip)
2809; O1-NEXT:    retq
2810;
2811; O2-LABEL: atomic16_store_release:
2812; O2:       # %bb.0: # %entry
2813; O2-NEXT:    movq foo(%rip), %rax
2814; O2-NEXT:  .Lpcsection101:
2815; O2-NEXT:    movw $42, (%rdi)
2816; O2-NEXT:    movq $1, foo(%rip)
2817; O2-NEXT:    retq
2818;
2819; O3-LABEL: atomic16_store_release:
2820; O3:       # %bb.0: # %entry
2821; O3-NEXT:    movq foo(%rip), %rax
2822; O3-NEXT:  .Lpcsection101:
2823; O3-NEXT:    movw $42, (%rdi)
2824; O3-NEXT:    movq $1, foo(%rip)
2825; O3-NEXT:    retq
2826entry:
2827  load volatile i64, ptr @foo, align 8
2828  store atomic i16 42, ptr %a release, align 2, !pcsections !0
2829  store volatile i64 1, ptr @foo, align 8
2830  ret void
2831}
2832
2833define void @atomic16_store_seq_cst(ptr %a) {
2834; O0-LABEL: atomic16_store_seq_cst:
2835; O0:       # %bb.0: # %entry
2836; O0-NEXT:    movq foo(%rip), %rax
2837; O0-NEXT:    movw $42, %ax
2838; O0-NEXT:  .Lpcsection107:
2839; O0-NEXT:    xchgw %ax, (%rdi)
2840; O0-NEXT:    movq $1, foo
2841; O0-NEXT:    retq
2842;
2843; O1-LABEL: atomic16_store_seq_cst:
2844; O1:       # %bb.0: # %entry
2845; O1-NEXT:    movq foo(%rip), %rax
2846; O1-NEXT:    movw $42, %ax
2847; O1-NEXT:  .Lpcsection102:
2848; O1-NEXT:    xchgw %ax, (%rdi)
2849; O1-NEXT:    movq $1, foo(%rip)
2850; O1-NEXT:    retq
2851;
2852; O2-LABEL: atomic16_store_seq_cst:
2853; O2:       # %bb.0: # %entry
2854; O2-NEXT:    movq foo(%rip), %rax
2855; O2-NEXT:    movw $42, %ax
2856; O2-NEXT:  .Lpcsection102:
2857; O2-NEXT:    xchgw %ax, (%rdi)
2858; O2-NEXT:    movq $1, foo(%rip)
2859; O2-NEXT:    retq
2860;
2861; O3-LABEL: atomic16_store_seq_cst:
2862; O3:       # %bb.0: # %entry
2863; O3-NEXT:    movq foo(%rip), %rax
2864; O3-NEXT:    movw $42, %ax
2865; O3-NEXT:  .Lpcsection102:
2866; O3-NEXT:    xchgw %ax, (%rdi)
2867; O3-NEXT:    movq $1, foo(%rip)
2868; O3-NEXT:    retq
2869entry:
2870  load volatile i64, ptr @foo, align 8
2871  store atomic i16 42, ptr %a seq_cst, align 2, !pcsections !0
2872  store volatile i64 1, ptr @foo, align 8
2873  ret void
2874}
2875
2876define void @atomic16_xchg_monotonic(ptr %a) {
2877; O0-LABEL: atomic16_xchg_monotonic:
2878; O0:       # %bb.0: # %entry
2879; O0-NEXT:    movq foo(%rip), %rax
2880; O0-NEXT:    movw $42, %ax
2881; O0-NEXT:  .Lpcsection108:
2882; O0-NEXT:    xchgw %ax, (%rdi)
2883; O0-NEXT:    movq $1, foo
2884; O0-NEXT:    retq
2885;
2886; O1-LABEL: atomic16_xchg_monotonic:
2887; O1:       # %bb.0: # %entry
2888; O1-NEXT:    movq foo(%rip), %rax
2889; O1-NEXT:    movw $42, %ax
2890; O1-NEXT:  .Lpcsection103:
2891; O1-NEXT:    xchgw %ax, (%rdi)
2892; O1-NEXT:    movq $1, foo(%rip)
2893; O1-NEXT:    retq
2894;
2895; O2-LABEL: atomic16_xchg_monotonic:
2896; O2:       # %bb.0: # %entry
2897; O2-NEXT:    movq foo(%rip), %rax
2898; O2-NEXT:    movw $42, %ax
2899; O2-NEXT:  .Lpcsection103:
2900; O2-NEXT:    xchgw %ax, (%rdi)
2901; O2-NEXT:    movq $1, foo(%rip)
2902; O2-NEXT:    retq
2903;
2904; O3-LABEL: atomic16_xchg_monotonic:
2905; O3:       # %bb.0: # %entry
2906; O3-NEXT:    movq foo(%rip), %rax
2907; O3-NEXT:    movw $42, %ax
2908; O3-NEXT:  .Lpcsection103:
2909; O3-NEXT:    xchgw %ax, (%rdi)
2910; O3-NEXT:    movq $1, foo(%rip)
2911; O3-NEXT:    retq
2912entry:
2913  load volatile i64, ptr @foo, align 8
2914  %x = atomicrmw xchg ptr %a, i16 42 monotonic, align 2, !pcsections !0
2915  store volatile i64 1, ptr @foo, align 8
2916  ret void
2917}
2918
2919define void @atomic16_add_monotonic(ptr %a) {
2920; O0-LABEL: atomic16_add_monotonic:
2921; O0:       # %bb.0: # %entry
2922; O0-NEXT:    movq foo(%rip), %rax
2923; O0-NEXT:  .Lpcsection109:
2924; O0-NEXT:    lock addw $42, (%rdi)
2925; O0-NEXT:    movq $1, foo
2926; O0-NEXT:    retq
2927;
2928; O1-LABEL: atomic16_add_monotonic:
2929; O1:       # %bb.0: # %entry
2930; O1-NEXT:    movq foo(%rip), %rax
2931; O1-NEXT:  .Lpcsection104:
2932; O1-NEXT:    lock addw $42, (%rdi)
2933; O1-NEXT:    movq $1, foo(%rip)
2934; O1-NEXT:    retq
2935;
2936; O2-LABEL: atomic16_add_monotonic:
2937; O2:       # %bb.0: # %entry
2938; O2-NEXT:    movq foo(%rip), %rax
2939; O2-NEXT:  .Lpcsection104:
2940; O2-NEXT:    lock addw $42, (%rdi)
2941; O2-NEXT:    movq $1, foo(%rip)
2942; O2-NEXT:    retq
2943;
2944; O3-LABEL: atomic16_add_monotonic:
2945; O3:       # %bb.0: # %entry
2946; O3-NEXT:    movq foo(%rip), %rax
2947; O3-NEXT:  .Lpcsection104:
2948; O3-NEXT:    lock addw $42, (%rdi)
2949; O3-NEXT:    movq $1, foo(%rip)
2950; O3-NEXT:    retq
2951entry:
2952  load volatile i64, ptr @foo, align 8
2953  %x = atomicrmw add ptr %a, i16 42 monotonic, align 2, !pcsections !0
2954  store volatile i64 1, ptr @foo, align 8
2955  ret void
2956}
2957
2958define void @atomic16_sub_monotonic(ptr %a) {
2959; O0-LABEL: atomic16_sub_monotonic:
2960; O0:       # %bb.0: # %entry
2961; O0-NEXT:    movq foo(%rip), %rax
2962; O0-NEXT:  .Lpcsection110:
2963; O0-NEXT:    lock subw $42, (%rdi)
2964; O0-NEXT:    movq $1, foo
2965; O0-NEXT:    retq
2966;
2967; O1-LABEL: atomic16_sub_monotonic:
2968; O1:       # %bb.0: # %entry
2969; O1-NEXT:    movq foo(%rip), %rax
2970; O1-NEXT:  .Lpcsection105:
2971; O1-NEXT:    lock subw $42, (%rdi)
2972; O1-NEXT:    movq $1, foo(%rip)
2973; O1-NEXT:    retq
2974;
2975; O2-LABEL: atomic16_sub_monotonic:
2976; O2:       # %bb.0: # %entry
2977; O2-NEXT:    movq foo(%rip), %rax
2978; O2-NEXT:  .Lpcsection105:
2979; O2-NEXT:    lock subw $42, (%rdi)
2980; O2-NEXT:    movq $1, foo(%rip)
2981; O2-NEXT:    retq
2982;
2983; O3-LABEL: atomic16_sub_monotonic:
2984; O3:       # %bb.0: # %entry
2985; O3-NEXT:    movq foo(%rip), %rax
2986; O3-NEXT:  .Lpcsection105:
2987; O3-NEXT:    lock subw $42, (%rdi)
2988; O3-NEXT:    movq $1, foo(%rip)
2989; O3-NEXT:    retq
2990entry:
2991  load volatile i64, ptr @foo, align 8
2992  %x = atomicrmw sub ptr %a, i16 42 monotonic, align 2, !pcsections !0
2993  store volatile i64 1, ptr @foo, align 8
2994  ret void
2995}
2996
2997define void @atomic16_and_monotonic(ptr %a) {
2998; O0-LABEL: atomic16_and_monotonic:
2999; O0:       # %bb.0: # %entry
3000; O0-NEXT:    movq foo(%rip), %rax
3001; O0-NEXT:  .Lpcsection111:
3002; O0-NEXT:    lock andw $42, (%rdi)
3003; O0-NEXT:    movq $1, foo
3004; O0-NEXT:    retq
3005;
3006; O1-LABEL: atomic16_and_monotonic:
3007; O1:       # %bb.0: # %entry
3008; O1-NEXT:    movq foo(%rip), %rax
3009; O1-NEXT:  .Lpcsection106:
3010; O1-NEXT:    lock andw $42, (%rdi)
3011; O1-NEXT:    movq $1, foo(%rip)
3012; O1-NEXT:    retq
3013;
3014; O2-LABEL: atomic16_and_monotonic:
3015; O2:       # %bb.0: # %entry
3016; O2-NEXT:    movq foo(%rip), %rax
3017; O2-NEXT:  .Lpcsection106:
3018; O2-NEXT:    lock andw $42, (%rdi)
3019; O2-NEXT:    movq $1, foo(%rip)
3020; O2-NEXT:    retq
3021;
3022; O3-LABEL: atomic16_and_monotonic:
3023; O3:       # %bb.0: # %entry
3024; O3-NEXT:    movq foo(%rip), %rax
3025; O3-NEXT:  .Lpcsection106:
3026; O3-NEXT:    lock andw $42, (%rdi)
3027; O3-NEXT:    movq $1, foo(%rip)
3028; O3-NEXT:    retq
3029entry:
3030  load volatile i64, ptr @foo, align 8
3031  %x = atomicrmw and ptr %a, i16 42 monotonic, align 2, !pcsections !0
3032  store volatile i64 1, ptr @foo, align 8
3033  ret void
3034}
3035
3036define void @atomic16_or_monotonic(ptr %a) {
3037; O0-LABEL: atomic16_or_monotonic:
3038; O0:       # %bb.0: # %entry
3039; O0-NEXT:    movq foo(%rip), %rax
3040; O0-NEXT:  .Lpcsection112:
3041; O0-NEXT:    lock orw $42, (%rdi)
3042; O0-NEXT:    movq $1, foo
3043; O0-NEXT:    retq
3044;
3045; O1-LABEL: atomic16_or_monotonic:
3046; O1:       # %bb.0: # %entry
3047; O1-NEXT:    movq foo(%rip), %rax
3048; O1-NEXT:  .Lpcsection107:
3049; O1-NEXT:    lock orw $42, (%rdi)
3050; O1-NEXT:    movq $1, foo(%rip)
3051; O1-NEXT:    retq
3052;
3053; O2-LABEL: atomic16_or_monotonic:
3054; O2:       # %bb.0: # %entry
3055; O2-NEXT:    movq foo(%rip), %rax
3056; O2-NEXT:  .Lpcsection107:
3057; O2-NEXT:    lock orw $42, (%rdi)
3058; O2-NEXT:    movq $1, foo(%rip)
3059; O2-NEXT:    retq
3060;
3061; O3-LABEL: atomic16_or_monotonic:
3062; O3:       # %bb.0: # %entry
3063; O3-NEXT:    movq foo(%rip), %rax
3064; O3-NEXT:  .Lpcsection107:
3065; O3-NEXT:    lock orw $42, (%rdi)
3066; O3-NEXT:    movq $1, foo(%rip)
3067; O3-NEXT:    retq
3068entry:
3069  load volatile i64, ptr @foo, align 8
3070  %x = atomicrmw or ptr %a, i16 42 monotonic, align 2, !pcsections !0
3071  store volatile i64 1, ptr @foo, align 8
3072  ret void
3073}
3074
3075define void @atomic16_xor_monotonic(ptr %a) {
3076; O0-LABEL: atomic16_xor_monotonic:
3077; O0:       # %bb.0: # %entry
3078; O0-NEXT:    movq foo(%rip), %rax
3079; O0-NEXT:  .Lpcsection113:
3080; O0-NEXT:    lock xorw $42, (%rdi)
3081; O0-NEXT:    movq $1, foo
3082; O0-NEXT:    retq
3083;
3084; O1-LABEL: atomic16_xor_monotonic:
3085; O1:       # %bb.0: # %entry
3086; O1-NEXT:    movq foo(%rip), %rax
3087; O1-NEXT:  .Lpcsection108:
3088; O1-NEXT:    lock xorw $42, (%rdi)
3089; O1-NEXT:    movq $1, foo(%rip)
3090; O1-NEXT:    retq
3091;
3092; O2-LABEL: atomic16_xor_monotonic:
3093; O2:       # %bb.0: # %entry
3094; O2-NEXT:    movq foo(%rip), %rax
3095; O2-NEXT:  .Lpcsection108:
3096; O2-NEXT:    lock xorw $42, (%rdi)
3097; O2-NEXT:    movq $1, foo(%rip)
3098; O2-NEXT:    retq
3099;
3100; O3-LABEL: atomic16_xor_monotonic:
3101; O3:       # %bb.0: # %entry
3102; O3-NEXT:    movq foo(%rip), %rax
3103; O3-NEXT:  .Lpcsection108:
3104; O3-NEXT:    lock xorw $42, (%rdi)
3105; O3-NEXT:    movq $1, foo(%rip)
3106; O3-NEXT:    retq
3107entry:
3108  load volatile i64, ptr @foo, align 8
3109  %x = atomicrmw xor ptr %a, i16 42 monotonic, align 2, !pcsections !0
3110  store volatile i64 1, ptr @foo, align 8
3111  ret void
3112}
3113
3114define void @atomic16_nand_monotonic(ptr %a) {
3115; O0-LABEL: atomic16_nand_monotonic:
3116; O0:       # %bb.0: # %entry
3117; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
3118; O0-NEXT:    movq foo, %rax
3119; O0-NEXT:  .Lpcsection114:
3120; O0-NEXT:    movw (%rdi), %ax
3121; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3122; O0-NEXT:  .LBB64_1: # %atomicrmw.start
3123; O0-NEXT:    # =>This Inner Loop Header: Depth=1
3124; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
3125; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
3126; O0-NEXT:  .Lpcsection115:
3127; O0-NEXT:    # implicit-def: $edx
3128; O0-NEXT:    movw %ax, %dx
3129; O0-NEXT:  .Lpcsection116:
3130; O0-NEXT:    notl %edx
3131; O0-NEXT:  .Lpcsection117:
3132; O0-NEXT:    orl $65493, %edx # imm = 0xFFD5
3133; O0-NEXT:  .Lpcsection118:
3134; O0-NEXT:    # kill: def $dx killed $dx killed $edx
3135; O0-NEXT:  .Lpcsection119:
3136; O0-NEXT:    lock cmpxchgw %dx, (%rcx)
3137; O0-NEXT:  .Lpcsection120:
3138; O0-NEXT:    sete %cl
3139; O0-NEXT:  .Lpcsection121:
3140; O0-NEXT:    testb $1, %cl
3141; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3142; O0-NEXT:  .Lpcsection122:
3143; O0-NEXT:    jne .LBB64_2
3144; O0-NEXT:    jmp .LBB64_1
3145; O0-NEXT:  .LBB64_2: # %atomicrmw.end
3146; O0-NEXT:    movq $1, foo
3147; O0-NEXT:    retq
3148;
3149; O1-LABEL: atomic16_nand_monotonic:
3150; O1:       # %bb.0: # %entry
3151; O1-NEXT:    movq foo(%rip), %rax
3152; O1-NEXT:  .Lpcsection109:
3153; O1-NEXT:    movzwl (%rdi), %eax
3154; O1-NEXT:    .p2align 4
3155; O1-NEXT:  .LBB64_1: # %atomicrmw.start
3156; O1-NEXT:    # =>This Inner Loop Header: Depth=1
3157; O1-NEXT:    movl %eax, %ecx
3158; O1-NEXT:  .Lpcsection110:
3159; O1-NEXT:    notl %ecx
3160; O1-NEXT:  .Lpcsection111:
3161; O1-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3162; O1-NEXT:  .Lpcsection112:
3163; O1-NEXT:    # kill: def $ax killed $ax killed $eax
3164; O1-NEXT:  .Lpcsection113:
3165; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
3166; O1-NEXT:  .Lpcsection114:
3167; O1-NEXT:    # kill: def $ax killed $ax def $eax
3168; O1-NEXT:  .Lpcsection115:
3169; O1-NEXT:    jne .LBB64_1
3170; O1-NEXT:  # %bb.2: # %atomicrmw.end
3171; O1-NEXT:    movq $1, foo(%rip)
3172; O1-NEXT:    retq
3173;
3174; O2-LABEL: atomic16_nand_monotonic:
3175; O2:       # %bb.0: # %entry
3176; O2-NEXT:    movq foo(%rip), %rax
3177; O2-NEXT:  .Lpcsection109:
3178; O2-NEXT:    movzwl (%rdi), %eax
3179; O2-NEXT:    .p2align 4
3180; O2-NEXT:  .LBB64_1: # %atomicrmw.start
3181; O2-NEXT:    # =>This Inner Loop Header: Depth=1
3182; O2-NEXT:    movl %eax, %ecx
3183; O2-NEXT:  .Lpcsection110:
3184; O2-NEXT:    notl %ecx
3185; O2-NEXT:  .Lpcsection111:
3186; O2-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3187; O2-NEXT:  .Lpcsection112:
3188; O2-NEXT:    # kill: def $ax killed $ax killed $eax
3189; O2-NEXT:  .Lpcsection113:
3190; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
3191; O2-NEXT:  .Lpcsection114:
3192; O2-NEXT:    # kill: def $ax killed $ax def $eax
3193; O2-NEXT:  .Lpcsection115:
3194; O2-NEXT:    jne .LBB64_1
3195; O2-NEXT:  # %bb.2: # %atomicrmw.end
3196; O2-NEXT:    movq $1, foo(%rip)
3197; O2-NEXT:    retq
3198;
3199; O3-LABEL: atomic16_nand_monotonic:
3200; O3:       # %bb.0: # %entry
3201; O3-NEXT:    movq foo(%rip), %rax
3202; O3-NEXT:  .Lpcsection109:
3203; O3-NEXT:    movzwl (%rdi), %eax
3204; O3-NEXT:    .p2align 4
3205; O3-NEXT:  .LBB64_1: # %atomicrmw.start
3206; O3-NEXT:    # =>This Inner Loop Header: Depth=1
3207; O3-NEXT:    movl %eax, %ecx
3208; O3-NEXT:  .Lpcsection110:
3209; O3-NEXT:    notl %ecx
3210; O3-NEXT:  .Lpcsection111:
3211; O3-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3212; O3-NEXT:  .Lpcsection112:
3213; O3-NEXT:    # kill: def $ax killed $ax killed $eax
3214; O3-NEXT:  .Lpcsection113:
3215; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
3216; O3-NEXT:  .Lpcsection114:
3217; O3-NEXT:    # kill: def $ax killed $ax def $eax
3218; O3-NEXT:  .Lpcsection115:
3219; O3-NEXT:    jne .LBB64_1
3220; O3-NEXT:  # %bb.2: # %atomicrmw.end
3221; O3-NEXT:    movq $1, foo(%rip)
3222; O3-NEXT:    retq
3223entry:
3224  load volatile i64, ptr @foo, align 8
3225  %x = atomicrmw nand ptr %a, i16 42 monotonic, align 2, !pcsections !0
3226  store volatile i64 1, ptr @foo, align 8
3227  ret void
3228}
3229
3230define void @atomic16_xchg_acquire(ptr %a) {
3231; O0-LABEL: atomic16_xchg_acquire:
3232; O0:       # %bb.0: # %entry
3233; O0-NEXT:    movq foo(%rip), %rax
3234; O0-NEXT:    movw $42, %ax
3235; O0-NEXT:  .Lpcsection123:
3236; O0-NEXT:    xchgw %ax, (%rdi)
3237; O0-NEXT:    movq $1, foo
3238; O0-NEXT:    retq
3239;
3240; O1-LABEL: atomic16_xchg_acquire:
3241; O1:       # %bb.0: # %entry
3242; O1-NEXT:    movq foo(%rip), %rax
3243; O1-NEXT:    movw $42, %ax
3244; O1-NEXT:  .Lpcsection116:
3245; O1-NEXT:    xchgw %ax, (%rdi)
3246; O1-NEXT:    movq $1, foo(%rip)
3247; O1-NEXT:    retq
3248;
3249; O2-LABEL: atomic16_xchg_acquire:
3250; O2:       # %bb.0: # %entry
3251; O2-NEXT:    movq foo(%rip), %rax
3252; O2-NEXT:    movw $42, %ax
3253; O2-NEXT:  .Lpcsection116:
3254; O2-NEXT:    xchgw %ax, (%rdi)
3255; O2-NEXT:    movq $1, foo(%rip)
3256; O2-NEXT:    retq
3257;
3258; O3-LABEL: atomic16_xchg_acquire:
3259; O3:       # %bb.0: # %entry
3260; O3-NEXT:    movq foo(%rip), %rax
3261; O3-NEXT:    movw $42, %ax
3262; O3-NEXT:  .Lpcsection116:
3263; O3-NEXT:    xchgw %ax, (%rdi)
3264; O3-NEXT:    movq $1, foo(%rip)
3265; O3-NEXT:    retq
3266entry:
3267  load volatile i64, ptr @foo, align 8
3268  %x = atomicrmw xchg ptr %a, i16 42 acquire, align 2, !pcsections !0
3269  store volatile i64 1, ptr @foo, align 8
3270  ret void
3271}
3272
3273define void @atomic16_add_acquire(ptr %a) {
3274; O0-LABEL: atomic16_add_acquire:
3275; O0:       # %bb.0: # %entry
3276; O0-NEXT:    movq foo(%rip), %rax
3277; O0-NEXT:  .Lpcsection124:
3278; O0-NEXT:    lock addw $42, (%rdi)
3279; O0-NEXT:    movq $1, foo
3280; O0-NEXT:    retq
3281;
3282; O1-LABEL: atomic16_add_acquire:
3283; O1:       # %bb.0: # %entry
3284; O1-NEXT:    movq foo(%rip), %rax
3285; O1-NEXT:  .Lpcsection117:
3286; O1-NEXT:    lock addw $42, (%rdi)
3287; O1-NEXT:    movq $1, foo(%rip)
3288; O1-NEXT:    retq
3289;
3290; O2-LABEL: atomic16_add_acquire:
3291; O2:       # %bb.0: # %entry
3292; O2-NEXT:    movq foo(%rip), %rax
3293; O2-NEXT:  .Lpcsection117:
3294; O2-NEXT:    lock addw $42, (%rdi)
3295; O2-NEXT:    movq $1, foo(%rip)
3296; O2-NEXT:    retq
3297;
3298; O3-LABEL: atomic16_add_acquire:
3299; O3:       # %bb.0: # %entry
3300; O3-NEXT:    movq foo(%rip), %rax
3301; O3-NEXT:  .Lpcsection117:
3302; O3-NEXT:    lock addw $42, (%rdi)
3303; O3-NEXT:    movq $1, foo(%rip)
3304; O3-NEXT:    retq
3305entry:
3306  load volatile i64, ptr @foo, align 8
3307  %x = atomicrmw add ptr %a, i16 42 acquire, align 2, !pcsections !0
3308  store volatile i64 1, ptr @foo, align 8
3309  ret void
3310}
3311
3312define void @atomic16_sub_acquire(ptr %a) {
3313; O0-LABEL: atomic16_sub_acquire:
3314; O0:       # %bb.0: # %entry
3315; O0-NEXT:    movq foo(%rip), %rax
3316; O0-NEXT:  .Lpcsection125:
3317; O0-NEXT:    lock subw $42, (%rdi)
3318; O0-NEXT:    movq $1, foo
3319; O0-NEXT:    retq
3320;
3321; O1-LABEL: atomic16_sub_acquire:
3322; O1:       # %bb.0: # %entry
3323; O1-NEXT:    movq foo(%rip), %rax
3324; O1-NEXT:  .Lpcsection118:
3325; O1-NEXT:    lock subw $42, (%rdi)
3326; O1-NEXT:    movq $1, foo(%rip)
3327; O1-NEXT:    retq
3328;
3329; O2-LABEL: atomic16_sub_acquire:
3330; O2:       # %bb.0: # %entry
3331; O2-NEXT:    movq foo(%rip), %rax
3332; O2-NEXT:  .Lpcsection118:
3333; O2-NEXT:    lock subw $42, (%rdi)
3334; O2-NEXT:    movq $1, foo(%rip)
3335; O2-NEXT:    retq
3336;
3337; O3-LABEL: atomic16_sub_acquire:
3338; O3:       # %bb.0: # %entry
3339; O3-NEXT:    movq foo(%rip), %rax
3340; O3-NEXT:  .Lpcsection118:
3341; O3-NEXT:    lock subw $42, (%rdi)
3342; O3-NEXT:    movq $1, foo(%rip)
3343; O3-NEXT:    retq
3344entry:
3345  load volatile i64, ptr @foo, align 8
3346  %x = atomicrmw sub ptr %a, i16 42 acquire, align 2, !pcsections !0
3347  store volatile i64 1, ptr @foo, align 8
3348  ret void
3349}
3350
3351define void @atomic16_and_acquire(ptr %a) {
3352; O0-LABEL: atomic16_and_acquire:
3353; O0:       # %bb.0: # %entry
3354; O0-NEXT:    movq foo(%rip), %rax
3355; O0-NEXT:  .Lpcsection126:
3356; O0-NEXT:    lock andw $42, (%rdi)
3357; O0-NEXT:    movq $1, foo
3358; O0-NEXT:    retq
3359;
3360; O1-LABEL: atomic16_and_acquire:
3361; O1:       # %bb.0: # %entry
3362; O1-NEXT:    movq foo(%rip), %rax
3363; O1-NEXT:  .Lpcsection119:
3364; O1-NEXT:    lock andw $42, (%rdi)
3365; O1-NEXT:    movq $1, foo(%rip)
3366; O1-NEXT:    retq
3367;
3368; O2-LABEL: atomic16_and_acquire:
3369; O2:       # %bb.0: # %entry
3370; O2-NEXT:    movq foo(%rip), %rax
3371; O2-NEXT:  .Lpcsection119:
3372; O2-NEXT:    lock andw $42, (%rdi)
3373; O2-NEXT:    movq $1, foo(%rip)
3374; O2-NEXT:    retq
3375;
3376; O3-LABEL: atomic16_and_acquire:
3377; O3:       # %bb.0: # %entry
3378; O3-NEXT:    movq foo(%rip), %rax
3379; O3-NEXT:  .Lpcsection119:
3380; O3-NEXT:    lock andw $42, (%rdi)
3381; O3-NEXT:    movq $1, foo(%rip)
3382; O3-NEXT:    retq
3383entry:
3384  load volatile i64, ptr @foo, align 8
3385  %x = atomicrmw and ptr %a, i16 42 acquire, align 2, !pcsections !0
3386  store volatile i64 1, ptr @foo, align 8
3387  ret void
3388}
3389
3390define void @atomic16_or_acquire(ptr %a) {
3391; O0-LABEL: atomic16_or_acquire:
3392; O0:       # %bb.0: # %entry
3393; O0-NEXT:    movq foo(%rip), %rax
3394; O0-NEXT:  .Lpcsection127:
3395; O0-NEXT:    lock orw $42, (%rdi)
3396; O0-NEXT:    movq $1, foo
3397; O0-NEXT:    retq
3398;
3399; O1-LABEL: atomic16_or_acquire:
3400; O1:       # %bb.0: # %entry
3401; O1-NEXT:    movq foo(%rip), %rax
3402; O1-NEXT:  .Lpcsection120:
3403; O1-NEXT:    lock orw $42, (%rdi)
3404; O1-NEXT:    movq $1, foo(%rip)
3405; O1-NEXT:    retq
3406;
3407; O2-LABEL: atomic16_or_acquire:
3408; O2:       # %bb.0: # %entry
3409; O2-NEXT:    movq foo(%rip), %rax
3410; O2-NEXT:  .Lpcsection120:
3411; O2-NEXT:    lock orw $42, (%rdi)
3412; O2-NEXT:    movq $1, foo(%rip)
3413; O2-NEXT:    retq
3414;
3415; O3-LABEL: atomic16_or_acquire:
3416; O3:       # %bb.0: # %entry
3417; O3-NEXT:    movq foo(%rip), %rax
3418; O3-NEXT:  .Lpcsection120:
3419; O3-NEXT:    lock orw $42, (%rdi)
3420; O3-NEXT:    movq $1, foo(%rip)
3421; O3-NEXT:    retq
3422entry:
3423  load volatile i64, ptr @foo, align 8
3424  %x = atomicrmw or ptr %a, i16 42 acquire, align 2, !pcsections !0
3425  store volatile i64 1, ptr @foo, align 8
3426  ret void
3427}
3428
3429define void @atomic16_xor_acquire(ptr %a) {
3430; O0-LABEL: atomic16_xor_acquire:
3431; O0:       # %bb.0: # %entry
3432; O0-NEXT:    movq foo(%rip), %rax
3433; O0-NEXT:  .Lpcsection128:
3434; O0-NEXT:    lock xorw $42, (%rdi)
3435; O0-NEXT:    movq $1, foo
3436; O0-NEXT:    retq
3437;
3438; O1-LABEL: atomic16_xor_acquire:
3439; O1:       # %bb.0: # %entry
3440; O1-NEXT:    movq foo(%rip), %rax
3441; O1-NEXT:  .Lpcsection121:
3442; O1-NEXT:    lock xorw $42, (%rdi)
3443; O1-NEXT:    movq $1, foo(%rip)
3444; O1-NEXT:    retq
3445;
3446; O2-LABEL: atomic16_xor_acquire:
3447; O2:       # %bb.0: # %entry
3448; O2-NEXT:    movq foo(%rip), %rax
3449; O2-NEXT:  .Lpcsection121:
3450; O2-NEXT:    lock xorw $42, (%rdi)
3451; O2-NEXT:    movq $1, foo(%rip)
3452; O2-NEXT:    retq
3453;
3454; O3-LABEL: atomic16_xor_acquire:
3455; O3:       # %bb.0: # %entry
3456; O3-NEXT:    movq foo(%rip), %rax
3457; O3-NEXT:  .Lpcsection121:
3458; O3-NEXT:    lock xorw $42, (%rdi)
3459; O3-NEXT:    movq $1, foo(%rip)
3460; O3-NEXT:    retq
3461entry:
3462  load volatile i64, ptr @foo, align 8
3463  %x = atomicrmw xor ptr %a, i16 42 acquire, align 2, !pcsections !0
3464  store volatile i64 1, ptr @foo, align 8
3465  ret void
3466}
3467
3468define void @atomic16_nand_acquire(ptr %a) {
3469; O0-LABEL: atomic16_nand_acquire:
3470; O0:       # %bb.0: # %entry
3471; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
3472; O0-NEXT:    movq foo, %rax
3473; O0-NEXT:  .Lpcsection129:
3474; O0-NEXT:    movw (%rdi), %ax
3475; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3476; O0-NEXT:  .LBB71_1: # %atomicrmw.start
3477; O0-NEXT:    # =>This Inner Loop Header: Depth=1
3478; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
3479; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
3480; O0-NEXT:  .Lpcsection130:
3481; O0-NEXT:    # implicit-def: $edx
3482; O0-NEXT:    movw %ax, %dx
3483; O0-NEXT:  .Lpcsection131:
3484; O0-NEXT:    notl %edx
3485; O0-NEXT:  .Lpcsection132:
3486; O0-NEXT:    orl $65493, %edx # imm = 0xFFD5
3487; O0-NEXT:  .Lpcsection133:
3488; O0-NEXT:    # kill: def $dx killed $dx killed $edx
3489; O0-NEXT:  .Lpcsection134:
3490; O0-NEXT:    lock cmpxchgw %dx, (%rcx)
3491; O0-NEXT:  .Lpcsection135:
3492; O0-NEXT:    sete %cl
3493; O0-NEXT:  .Lpcsection136:
3494; O0-NEXT:    testb $1, %cl
3495; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3496; O0-NEXT:  .Lpcsection137:
3497; O0-NEXT:    jne .LBB71_2
3498; O0-NEXT:    jmp .LBB71_1
3499; O0-NEXT:  .LBB71_2: # %atomicrmw.end
3500; O0-NEXT:    movq $1, foo
3501; O0-NEXT:    retq
3502;
3503; O1-LABEL: atomic16_nand_acquire:
3504; O1:       # %bb.0: # %entry
3505; O1-NEXT:    movq foo(%rip), %rax
3506; O1-NEXT:  .Lpcsection122:
3507; O1-NEXT:    movzwl (%rdi), %eax
3508; O1-NEXT:    .p2align 4
3509; O1-NEXT:  .LBB71_1: # %atomicrmw.start
3510; O1-NEXT:    # =>This Inner Loop Header: Depth=1
3511; O1-NEXT:    movl %eax, %ecx
3512; O1-NEXT:  .Lpcsection123:
3513; O1-NEXT:    notl %ecx
3514; O1-NEXT:  .Lpcsection124:
3515; O1-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3516; O1-NEXT:  .Lpcsection125:
3517; O1-NEXT:    # kill: def $ax killed $ax killed $eax
3518; O1-NEXT:  .Lpcsection126:
3519; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
3520; O1-NEXT:  .Lpcsection127:
3521; O1-NEXT:    # kill: def $ax killed $ax def $eax
3522; O1-NEXT:  .Lpcsection128:
3523; O1-NEXT:    jne .LBB71_1
3524; O1-NEXT:  # %bb.2: # %atomicrmw.end
3525; O1-NEXT:    movq $1, foo(%rip)
3526; O1-NEXT:    retq
3527;
3528; O2-LABEL: atomic16_nand_acquire:
3529; O2:       # %bb.0: # %entry
3530; O2-NEXT:    movq foo(%rip), %rax
3531; O2-NEXT:  .Lpcsection122:
3532; O2-NEXT:    movzwl (%rdi), %eax
3533; O2-NEXT:    .p2align 4
3534; O2-NEXT:  .LBB71_1: # %atomicrmw.start
3535; O2-NEXT:    # =>This Inner Loop Header: Depth=1
3536; O2-NEXT:    movl %eax, %ecx
3537; O2-NEXT:  .Lpcsection123:
3538; O2-NEXT:    notl %ecx
3539; O2-NEXT:  .Lpcsection124:
3540; O2-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3541; O2-NEXT:  .Lpcsection125:
3542; O2-NEXT:    # kill: def $ax killed $ax killed $eax
3543; O2-NEXT:  .Lpcsection126:
3544; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
3545; O2-NEXT:  .Lpcsection127:
3546; O2-NEXT:    # kill: def $ax killed $ax def $eax
3547; O2-NEXT:  .Lpcsection128:
3548; O2-NEXT:    jne .LBB71_1
3549; O2-NEXT:  # %bb.2: # %atomicrmw.end
3550; O2-NEXT:    movq $1, foo(%rip)
3551; O2-NEXT:    retq
3552;
3553; O3-LABEL: atomic16_nand_acquire:
3554; O3:       # %bb.0: # %entry
3555; O3-NEXT:    movq foo(%rip), %rax
3556; O3-NEXT:  .Lpcsection122:
3557; O3-NEXT:    movzwl (%rdi), %eax
3558; O3-NEXT:    .p2align 4
3559; O3-NEXT:  .LBB71_1: # %atomicrmw.start
3560; O3-NEXT:    # =>This Inner Loop Header: Depth=1
3561; O3-NEXT:    movl %eax, %ecx
3562; O3-NEXT:  .Lpcsection123:
3563; O3-NEXT:    notl %ecx
3564; O3-NEXT:  .Lpcsection124:
3565; O3-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3566; O3-NEXT:  .Lpcsection125:
3567; O3-NEXT:    # kill: def $ax killed $ax killed $eax
3568; O3-NEXT:  .Lpcsection126:
3569; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
3570; O3-NEXT:  .Lpcsection127:
3571; O3-NEXT:    # kill: def $ax killed $ax def $eax
3572; O3-NEXT:  .Lpcsection128:
3573; O3-NEXT:    jne .LBB71_1
3574; O3-NEXT:  # %bb.2: # %atomicrmw.end
3575; O3-NEXT:    movq $1, foo(%rip)
3576; O3-NEXT:    retq
3577entry:
3578  load volatile i64, ptr @foo, align 8
3579  %x = atomicrmw nand ptr %a, i16 42 acquire, align 2, !pcsections !0
3580  store volatile i64 1, ptr @foo, align 8
3581  ret void
3582}
3583
3584define void @atomic16_xchg_release(ptr %a) {
3585; O0-LABEL: atomic16_xchg_release:
3586; O0:       # %bb.0: # %entry
3587; O0-NEXT:    movq foo(%rip), %rax
3588; O0-NEXT:    movw $42, %ax
3589; O0-NEXT:  .Lpcsection138:
3590; O0-NEXT:    xchgw %ax, (%rdi)
3591; O0-NEXT:    movq $1, foo
3592; O0-NEXT:    retq
3593;
3594; O1-LABEL: atomic16_xchg_release:
3595; O1:       # %bb.0: # %entry
3596; O1-NEXT:    movq foo(%rip), %rax
3597; O1-NEXT:    movw $42, %ax
3598; O1-NEXT:  .Lpcsection129:
3599; O1-NEXT:    xchgw %ax, (%rdi)
3600; O1-NEXT:    movq $1, foo(%rip)
3601; O1-NEXT:    retq
3602;
3603; O2-LABEL: atomic16_xchg_release:
3604; O2:       # %bb.0: # %entry
3605; O2-NEXT:    movq foo(%rip), %rax
3606; O2-NEXT:    movw $42, %ax
3607; O2-NEXT:  .Lpcsection129:
3608; O2-NEXT:    xchgw %ax, (%rdi)
3609; O2-NEXT:    movq $1, foo(%rip)
3610; O2-NEXT:    retq
3611;
3612; O3-LABEL: atomic16_xchg_release:
3613; O3:       # %bb.0: # %entry
3614; O3-NEXT:    movq foo(%rip), %rax
3615; O3-NEXT:    movw $42, %ax
3616; O3-NEXT:  .Lpcsection129:
3617; O3-NEXT:    xchgw %ax, (%rdi)
3618; O3-NEXT:    movq $1, foo(%rip)
3619; O3-NEXT:    retq
3620entry:
3621  load volatile i64, ptr @foo, align 8
3622  %x = atomicrmw xchg ptr %a, i16 42 release, align 2, !pcsections !0
3623  store volatile i64 1, ptr @foo, align 8
3624  ret void
3625}
3626
3627define void @atomic16_add_release(ptr %a) {
3628; O0-LABEL: atomic16_add_release:
3629; O0:       # %bb.0: # %entry
3630; O0-NEXT:    movq foo(%rip), %rax
3631; O0-NEXT:  .Lpcsection139:
3632; O0-NEXT:    lock addw $42, (%rdi)
3633; O0-NEXT:    movq $1, foo
3634; O0-NEXT:    retq
3635;
3636; O1-LABEL: atomic16_add_release:
3637; O1:       # %bb.0: # %entry
3638; O1-NEXT:    movq foo(%rip), %rax
3639; O1-NEXT:  .Lpcsection130:
3640; O1-NEXT:    lock addw $42, (%rdi)
3641; O1-NEXT:    movq $1, foo(%rip)
3642; O1-NEXT:    retq
3643;
3644; O2-LABEL: atomic16_add_release:
3645; O2:       # %bb.0: # %entry
3646; O2-NEXT:    movq foo(%rip), %rax
3647; O2-NEXT:  .Lpcsection130:
3648; O2-NEXT:    lock addw $42, (%rdi)
3649; O2-NEXT:    movq $1, foo(%rip)
3650; O2-NEXT:    retq
3651;
3652; O3-LABEL: atomic16_add_release:
3653; O3:       # %bb.0: # %entry
3654; O3-NEXT:    movq foo(%rip), %rax
3655; O3-NEXT:  .Lpcsection130:
3656; O3-NEXT:    lock addw $42, (%rdi)
3657; O3-NEXT:    movq $1, foo(%rip)
3658; O3-NEXT:    retq
3659entry:
3660  load volatile i64, ptr @foo, align 8
3661  %x = atomicrmw add ptr %a, i16 42 release, align 2, !pcsections !0
3662  store volatile i64 1, ptr @foo, align 8
3663  ret void
3664}
3665
3666define void @atomic16_sub_release(ptr %a) {
3667; O0-LABEL: atomic16_sub_release:
3668; O0:       # %bb.0: # %entry
3669; O0-NEXT:    movq foo(%rip), %rax
3670; O0-NEXT:  .Lpcsection140:
3671; O0-NEXT:    lock subw $42, (%rdi)
3672; O0-NEXT:    movq $1, foo
3673; O0-NEXT:    retq
3674;
3675; O1-LABEL: atomic16_sub_release:
3676; O1:       # %bb.0: # %entry
3677; O1-NEXT:    movq foo(%rip), %rax
3678; O1-NEXT:  .Lpcsection131:
3679; O1-NEXT:    lock subw $42, (%rdi)
3680; O1-NEXT:    movq $1, foo(%rip)
3681; O1-NEXT:    retq
3682;
3683; O2-LABEL: atomic16_sub_release:
3684; O2:       # %bb.0: # %entry
3685; O2-NEXT:    movq foo(%rip), %rax
3686; O2-NEXT:  .Lpcsection131:
3687; O2-NEXT:    lock subw $42, (%rdi)
3688; O2-NEXT:    movq $1, foo(%rip)
3689; O2-NEXT:    retq
3690;
3691; O3-LABEL: atomic16_sub_release:
3692; O3:       # %bb.0: # %entry
3693; O3-NEXT:    movq foo(%rip), %rax
3694; O3-NEXT:  .Lpcsection131:
3695; O3-NEXT:    lock subw $42, (%rdi)
3696; O3-NEXT:    movq $1, foo(%rip)
3697; O3-NEXT:    retq
3698entry:
3699  load volatile i64, ptr @foo, align 8
3700  %x = atomicrmw sub ptr %a, i16 42 release, align 2, !pcsections !0
3701  store volatile i64 1, ptr @foo, align 8
3702  ret void
3703}
3704
3705define void @atomic16_and_release(ptr %a) {
3706; O0-LABEL: atomic16_and_release:
3707; O0:       # %bb.0: # %entry
3708; O0-NEXT:    movq foo(%rip), %rax
3709; O0-NEXT:  .Lpcsection141:
3710; O0-NEXT:    lock andw $42, (%rdi)
3711; O0-NEXT:    movq $1, foo
3712; O0-NEXT:    retq
3713;
3714; O1-LABEL: atomic16_and_release:
3715; O1:       # %bb.0: # %entry
3716; O1-NEXT:    movq foo(%rip), %rax
3717; O1-NEXT:  .Lpcsection132:
3718; O1-NEXT:    lock andw $42, (%rdi)
3719; O1-NEXT:    movq $1, foo(%rip)
3720; O1-NEXT:    retq
3721;
3722; O2-LABEL: atomic16_and_release:
3723; O2:       # %bb.0: # %entry
3724; O2-NEXT:    movq foo(%rip), %rax
3725; O2-NEXT:  .Lpcsection132:
3726; O2-NEXT:    lock andw $42, (%rdi)
3727; O2-NEXT:    movq $1, foo(%rip)
3728; O2-NEXT:    retq
3729;
3730; O3-LABEL: atomic16_and_release:
3731; O3:       # %bb.0: # %entry
3732; O3-NEXT:    movq foo(%rip), %rax
3733; O3-NEXT:  .Lpcsection132:
3734; O3-NEXT:    lock andw $42, (%rdi)
3735; O3-NEXT:    movq $1, foo(%rip)
3736; O3-NEXT:    retq
3737entry:
3738  load volatile i64, ptr @foo, align 8
3739  %x = atomicrmw and ptr %a, i16 42 release, align 2, !pcsections !0
3740  store volatile i64 1, ptr @foo, align 8
3741  ret void
3742}
3743
3744define void @atomic16_or_release(ptr %a) {
3745; O0-LABEL: atomic16_or_release:
3746; O0:       # %bb.0: # %entry
3747; O0-NEXT:    movq foo(%rip), %rax
3748; O0-NEXT:  .Lpcsection142:
3749; O0-NEXT:    lock orw $42, (%rdi)
3750; O0-NEXT:    movq $1, foo
3751; O0-NEXT:    retq
3752;
3753; O1-LABEL: atomic16_or_release:
3754; O1:       # %bb.0: # %entry
3755; O1-NEXT:    movq foo(%rip), %rax
3756; O1-NEXT:  .Lpcsection133:
3757; O1-NEXT:    lock orw $42, (%rdi)
3758; O1-NEXT:    movq $1, foo(%rip)
3759; O1-NEXT:    retq
3760;
3761; O2-LABEL: atomic16_or_release:
3762; O2:       # %bb.0: # %entry
3763; O2-NEXT:    movq foo(%rip), %rax
3764; O2-NEXT:  .Lpcsection133:
3765; O2-NEXT:    lock orw $42, (%rdi)
3766; O2-NEXT:    movq $1, foo(%rip)
3767; O2-NEXT:    retq
3768;
3769; O3-LABEL: atomic16_or_release:
3770; O3:       # %bb.0: # %entry
3771; O3-NEXT:    movq foo(%rip), %rax
3772; O3-NEXT:  .Lpcsection133:
3773; O3-NEXT:    lock orw $42, (%rdi)
3774; O3-NEXT:    movq $1, foo(%rip)
3775; O3-NEXT:    retq
3776entry:
3777  load volatile i64, ptr @foo, align 8
3778  %x = atomicrmw or ptr %a, i16 42 release, align 2, !pcsections !0
3779  store volatile i64 1, ptr @foo, align 8
3780  ret void
3781}
3782
3783define void @atomic16_xor_release(ptr %a) {
3784; O0-LABEL: atomic16_xor_release:
3785; O0:       # %bb.0: # %entry
3786; O0-NEXT:    movq foo(%rip), %rax
3787; O0-NEXT:  .Lpcsection143:
3788; O0-NEXT:    lock xorw $42, (%rdi)
3789; O0-NEXT:    movq $1, foo
3790; O0-NEXT:    retq
3791;
3792; O1-LABEL: atomic16_xor_release:
3793; O1:       # %bb.0: # %entry
3794; O1-NEXT:    movq foo(%rip), %rax
3795; O1-NEXT:  .Lpcsection134:
3796; O1-NEXT:    lock xorw $42, (%rdi)
3797; O1-NEXT:    movq $1, foo(%rip)
3798; O1-NEXT:    retq
3799;
3800; O2-LABEL: atomic16_xor_release:
3801; O2:       # %bb.0: # %entry
3802; O2-NEXT:    movq foo(%rip), %rax
3803; O2-NEXT:  .Lpcsection134:
3804; O2-NEXT:    lock xorw $42, (%rdi)
3805; O2-NEXT:    movq $1, foo(%rip)
3806; O2-NEXT:    retq
3807;
3808; O3-LABEL: atomic16_xor_release:
3809; O3:       # %bb.0: # %entry
3810; O3-NEXT:    movq foo(%rip), %rax
3811; O3-NEXT:  .Lpcsection134:
3812; O3-NEXT:    lock xorw $42, (%rdi)
3813; O3-NEXT:    movq $1, foo(%rip)
3814; O3-NEXT:    retq
3815entry:
3816  load volatile i64, ptr @foo, align 8
3817  %x = atomicrmw xor ptr %a, i16 42 release, align 2, !pcsections !0
3818  store volatile i64 1, ptr @foo, align 8
3819  ret void
3820}
3821
3822define void @atomic16_nand_release(ptr %a) {
3823; O0-LABEL: atomic16_nand_release:
3824; O0:       # %bb.0: # %entry
3825; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
3826; O0-NEXT:    movq foo, %rax
3827; O0-NEXT:  .Lpcsection144:
3828; O0-NEXT:    movw (%rdi), %ax
3829; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3830; O0-NEXT:  .LBB78_1: # %atomicrmw.start
3831; O0-NEXT:    # =>This Inner Loop Header: Depth=1
3832; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
3833; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
3834; O0-NEXT:  .Lpcsection145:
3835; O0-NEXT:    # implicit-def: $edx
3836; O0-NEXT:    movw %ax, %dx
3837; O0-NEXT:  .Lpcsection146:
3838; O0-NEXT:    notl %edx
3839; O0-NEXT:  .Lpcsection147:
3840; O0-NEXT:    orl $65493, %edx # imm = 0xFFD5
3841; O0-NEXT:  .Lpcsection148:
3842; O0-NEXT:    # kill: def $dx killed $dx killed $edx
3843; O0-NEXT:  .Lpcsection149:
3844; O0-NEXT:    lock cmpxchgw %dx, (%rcx)
3845; O0-NEXT:  .Lpcsection150:
3846; O0-NEXT:    sete %cl
3847; O0-NEXT:  .Lpcsection151:
3848; O0-NEXT:    testb $1, %cl
3849; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
3850; O0-NEXT:  .Lpcsection152:
3851; O0-NEXT:    jne .LBB78_2
3852; O0-NEXT:    jmp .LBB78_1
3853; O0-NEXT:  .LBB78_2: # %atomicrmw.end
3854; O0-NEXT:    movq $1, foo
3855; O0-NEXT:    retq
3856;
3857; O1-LABEL: atomic16_nand_release:
3858; O1:       # %bb.0: # %entry
3859; O1-NEXT:    movq foo(%rip), %rax
3860; O1-NEXT:  .Lpcsection135:
3861; O1-NEXT:    movzwl (%rdi), %eax
3862; O1-NEXT:    .p2align 4
3863; O1-NEXT:  .LBB78_1: # %atomicrmw.start
3864; O1-NEXT:    # =>This Inner Loop Header: Depth=1
3865; O1-NEXT:    movl %eax, %ecx
3866; O1-NEXT:  .Lpcsection136:
3867; O1-NEXT:    notl %ecx
3868; O1-NEXT:  .Lpcsection137:
3869; O1-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3870; O1-NEXT:  .Lpcsection138:
3871; O1-NEXT:    # kill: def $ax killed $ax killed $eax
3872; O1-NEXT:  .Lpcsection139:
3873; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
3874; O1-NEXT:  .Lpcsection140:
3875; O1-NEXT:    # kill: def $ax killed $ax def $eax
3876; O1-NEXT:  .Lpcsection141:
3877; O1-NEXT:    jne .LBB78_1
3878; O1-NEXT:  # %bb.2: # %atomicrmw.end
3879; O1-NEXT:    movq $1, foo(%rip)
3880; O1-NEXT:    retq
3881;
3882; O2-LABEL: atomic16_nand_release:
3883; O2:       # %bb.0: # %entry
3884; O2-NEXT:    movq foo(%rip), %rax
3885; O2-NEXT:  .Lpcsection135:
3886; O2-NEXT:    movzwl (%rdi), %eax
3887; O2-NEXT:    .p2align 4
3888; O2-NEXT:  .LBB78_1: # %atomicrmw.start
3889; O2-NEXT:    # =>This Inner Loop Header: Depth=1
3890; O2-NEXT:    movl %eax, %ecx
3891; O2-NEXT:  .Lpcsection136:
3892; O2-NEXT:    notl %ecx
3893; O2-NEXT:  .Lpcsection137:
3894; O2-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3895; O2-NEXT:  .Lpcsection138:
3896; O2-NEXT:    # kill: def $ax killed $ax killed $eax
3897; O2-NEXT:  .Lpcsection139:
3898; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
3899; O2-NEXT:  .Lpcsection140:
3900; O2-NEXT:    # kill: def $ax killed $ax def $eax
3901; O2-NEXT:  .Lpcsection141:
3902; O2-NEXT:    jne .LBB78_1
3903; O2-NEXT:  # %bb.2: # %atomicrmw.end
3904; O2-NEXT:    movq $1, foo(%rip)
3905; O2-NEXT:    retq
3906;
3907; O3-LABEL: atomic16_nand_release:
3908; O3:       # %bb.0: # %entry
3909; O3-NEXT:    movq foo(%rip), %rax
3910; O3-NEXT:  .Lpcsection135:
3911; O3-NEXT:    movzwl (%rdi), %eax
3912; O3-NEXT:    .p2align 4
3913; O3-NEXT:  .LBB78_1: # %atomicrmw.start
3914; O3-NEXT:    # =>This Inner Loop Header: Depth=1
3915; O3-NEXT:    movl %eax, %ecx
3916; O3-NEXT:  .Lpcsection136:
3917; O3-NEXT:    notl %ecx
3918; O3-NEXT:  .Lpcsection137:
3919; O3-NEXT:    orl $65493, %ecx # imm = 0xFFD5
3920; O3-NEXT:  .Lpcsection138:
3921; O3-NEXT:    # kill: def $ax killed $ax killed $eax
3922; O3-NEXT:  .Lpcsection139:
3923; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
3924; O3-NEXT:  .Lpcsection140:
3925; O3-NEXT:    # kill: def $ax killed $ax def $eax
3926; O3-NEXT:  .Lpcsection141:
3927; O3-NEXT:    jne .LBB78_1
3928; O3-NEXT:  # %bb.2: # %atomicrmw.end
3929; O3-NEXT:    movq $1, foo(%rip)
3930; O3-NEXT:    retq
3931entry:
3932  load volatile i64, ptr @foo, align 8
3933  %x = atomicrmw nand ptr %a, i16 42 release, align 2, !pcsections !0
3934  store volatile i64 1, ptr @foo, align 8
3935  ret void
3936}
3937
3938define void @atomic16_xchg_acq_rel(ptr %a) {
3939; O0-LABEL: atomic16_xchg_acq_rel:
3940; O0:       # %bb.0: # %entry
3941; O0-NEXT:    movq foo(%rip), %rax
3942; O0-NEXT:    movw $42, %ax
3943; O0-NEXT:  .Lpcsection153:
3944; O0-NEXT:    xchgw %ax, (%rdi)
3945; O0-NEXT:    movq $1, foo
3946; O0-NEXT:    retq
3947;
3948; O1-LABEL: atomic16_xchg_acq_rel:
3949; O1:       # %bb.0: # %entry
3950; O1-NEXT:    movq foo(%rip), %rax
3951; O1-NEXT:    movw $42, %ax
3952; O1-NEXT:  .Lpcsection142:
3953; O1-NEXT:    xchgw %ax, (%rdi)
3954; O1-NEXT:    movq $1, foo(%rip)
3955; O1-NEXT:    retq
3956;
3957; O2-LABEL: atomic16_xchg_acq_rel:
3958; O2:       # %bb.0: # %entry
3959; O2-NEXT:    movq foo(%rip), %rax
3960; O2-NEXT:    movw $42, %ax
3961; O2-NEXT:  .Lpcsection142:
3962; O2-NEXT:    xchgw %ax, (%rdi)
3963; O2-NEXT:    movq $1, foo(%rip)
3964; O2-NEXT:    retq
3965;
3966; O3-LABEL: atomic16_xchg_acq_rel:
3967; O3:       # %bb.0: # %entry
3968; O3-NEXT:    movq foo(%rip), %rax
3969; O3-NEXT:    movw $42, %ax
3970; O3-NEXT:  .Lpcsection142:
3971; O3-NEXT:    xchgw %ax, (%rdi)
3972; O3-NEXT:    movq $1, foo(%rip)
3973; O3-NEXT:    retq
3974entry:
3975  load volatile i64, ptr @foo, align 8
3976  %x = atomicrmw xchg ptr %a, i16 42 acq_rel, align 2, !pcsections !0
3977  store volatile i64 1, ptr @foo, align 8
3978  ret void
3979}
3980
3981define void @atomic16_add_acq_rel(ptr %a) {
3982; O0-LABEL: atomic16_add_acq_rel:
3983; O0:       # %bb.0: # %entry
3984; O0-NEXT:    movq foo(%rip), %rax
3985; O0-NEXT:  .Lpcsection154:
3986; O0-NEXT:    lock addw $42, (%rdi)
3987; O0-NEXT:    movq $1, foo
3988; O0-NEXT:    retq
3989;
3990; O1-LABEL: atomic16_add_acq_rel:
3991; O1:       # %bb.0: # %entry
3992; O1-NEXT:    movq foo(%rip), %rax
3993; O1-NEXT:  .Lpcsection143:
3994; O1-NEXT:    lock addw $42, (%rdi)
3995; O1-NEXT:    movq $1, foo(%rip)
3996; O1-NEXT:    retq
3997;
3998; O2-LABEL: atomic16_add_acq_rel:
3999; O2:       # %bb.0: # %entry
4000; O2-NEXT:    movq foo(%rip), %rax
4001; O2-NEXT:  .Lpcsection143:
4002; O2-NEXT:    lock addw $42, (%rdi)
4003; O2-NEXT:    movq $1, foo(%rip)
4004; O2-NEXT:    retq
4005;
4006; O3-LABEL: atomic16_add_acq_rel:
4007; O3:       # %bb.0: # %entry
4008; O3-NEXT:    movq foo(%rip), %rax
4009; O3-NEXT:  .Lpcsection143:
4010; O3-NEXT:    lock addw $42, (%rdi)
4011; O3-NEXT:    movq $1, foo(%rip)
4012; O3-NEXT:    retq
4013entry:
4014  load volatile i64, ptr @foo, align 8
4015  %x = atomicrmw add ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4016  store volatile i64 1, ptr @foo, align 8
4017  ret void
4018}
4019
4020define void @atomic16_sub_acq_rel(ptr %a) {
4021; O0-LABEL: atomic16_sub_acq_rel:
4022; O0:       # %bb.0: # %entry
4023; O0-NEXT:    movq foo(%rip), %rax
4024; O0-NEXT:  .Lpcsection155:
4025; O0-NEXT:    lock subw $42, (%rdi)
4026; O0-NEXT:    movq $1, foo
4027; O0-NEXT:    retq
4028;
4029; O1-LABEL: atomic16_sub_acq_rel:
4030; O1:       # %bb.0: # %entry
4031; O1-NEXT:    movq foo(%rip), %rax
4032; O1-NEXT:  .Lpcsection144:
4033; O1-NEXT:    lock subw $42, (%rdi)
4034; O1-NEXT:    movq $1, foo(%rip)
4035; O1-NEXT:    retq
4036;
4037; O2-LABEL: atomic16_sub_acq_rel:
4038; O2:       # %bb.0: # %entry
4039; O2-NEXT:    movq foo(%rip), %rax
4040; O2-NEXT:  .Lpcsection144:
4041; O2-NEXT:    lock subw $42, (%rdi)
4042; O2-NEXT:    movq $1, foo(%rip)
4043; O2-NEXT:    retq
4044;
4045; O3-LABEL: atomic16_sub_acq_rel:
4046; O3:       # %bb.0: # %entry
4047; O3-NEXT:    movq foo(%rip), %rax
4048; O3-NEXT:  .Lpcsection144:
4049; O3-NEXT:    lock subw $42, (%rdi)
4050; O3-NEXT:    movq $1, foo(%rip)
4051; O3-NEXT:    retq
4052entry:
4053  load volatile i64, ptr @foo, align 8
4054  %x = atomicrmw sub ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4055  store volatile i64 1, ptr @foo, align 8
4056  ret void
4057}
4058
4059define void @atomic16_and_acq_rel(ptr %a) {
4060; O0-LABEL: atomic16_and_acq_rel:
4061; O0:       # %bb.0: # %entry
4062; O0-NEXT:    movq foo(%rip), %rax
4063; O0-NEXT:  .Lpcsection156:
4064; O0-NEXT:    lock andw $42, (%rdi)
4065; O0-NEXT:    movq $1, foo
4066; O0-NEXT:    retq
4067;
4068; O1-LABEL: atomic16_and_acq_rel:
4069; O1:       # %bb.0: # %entry
4070; O1-NEXT:    movq foo(%rip), %rax
4071; O1-NEXT:  .Lpcsection145:
4072; O1-NEXT:    lock andw $42, (%rdi)
4073; O1-NEXT:    movq $1, foo(%rip)
4074; O1-NEXT:    retq
4075;
4076; O2-LABEL: atomic16_and_acq_rel:
4077; O2:       # %bb.0: # %entry
4078; O2-NEXT:    movq foo(%rip), %rax
4079; O2-NEXT:  .Lpcsection145:
4080; O2-NEXT:    lock andw $42, (%rdi)
4081; O2-NEXT:    movq $1, foo(%rip)
4082; O2-NEXT:    retq
4083;
4084; O3-LABEL: atomic16_and_acq_rel:
4085; O3:       # %bb.0: # %entry
4086; O3-NEXT:    movq foo(%rip), %rax
4087; O3-NEXT:  .Lpcsection145:
4088; O3-NEXT:    lock andw $42, (%rdi)
4089; O3-NEXT:    movq $1, foo(%rip)
4090; O3-NEXT:    retq
4091entry:
4092  load volatile i64, ptr @foo, align 8
4093  %x = atomicrmw and ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4094  store volatile i64 1, ptr @foo, align 8
4095  ret void
4096}
4097
4098define void @atomic16_or_acq_rel(ptr %a) {
4099; O0-LABEL: atomic16_or_acq_rel:
4100; O0:       # %bb.0: # %entry
4101; O0-NEXT:    movq foo(%rip), %rax
4102; O0-NEXT:  .Lpcsection157:
4103; O0-NEXT:    lock orw $42, (%rdi)
4104; O0-NEXT:    movq $1, foo
4105; O0-NEXT:    retq
4106;
4107; O1-LABEL: atomic16_or_acq_rel:
4108; O1:       # %bb.0: # %entry
4109; O1-NEXT:    movq foo(%rip), %rax
4110; O1-NEXT:  .Lpcsection146:
4111; O1-NEXT:    lock orw $42, (%rdi)
4112; O1-NEXT:    movq $1, foo(%rip)
4113; O1-NEXT:    retq
4114;
4115; O2-LABEL: atomic16_or_acq_rel:
4116; O2:       # %bb.0: # %entry
4117; O2-NEXT:    movq foo(%rip), %rax
4118; O2-NEXT:  .Lpcsection146:
4119; O2-NEXT:    lock orw $42, (%rdi)
4120; O2-NEXT:    movq $1, foo(%rip)
4121; O2-NEXT:    retq
4122;
4123; O3-LABEL: atomic16_or_acq_rel:
4124; O3:       # %bb.0: # %entry
4125; O3-NEXT:    movq foo(%rip), %rax
4126; O3-NEXT:  .Lpcsection146:
4127; O3-NEXT:    lock orw $42, (%rdi)
4128; O3-NEXT:    movq $1, foo(%rip)
4129; O3-NEXT:    retq
4130entry:
4131  load volatile i64, ptr @foo, align 8
4132  %x = atomicrmw or ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4133  store volatile i64 1, ptr @foo, align 8
4134  ret void
4135}
4136
4137define void @atomic16_xor_acq_rel(ptr %a) {
4138; O0-LABEL: atomic16_xor_acq_rel:
4139; O0:       # %bb.0: # %entry
4140; O0-NEXT:    movq foo(%rip), %rax
4141; O0-NEXT:  .Lpcsection158:
4142; O0-NEXT:    lock xorw $42, (%rdi)
4143; O0-NEXT:    movq $1, foo
4144; O0-NEXT:    retq
4145;
4146; O1-LABEL: atomic16_xor_acq_rel:
4147; O1:       # %bb.0: # %entry
4148; O1-NEXT:    movq foo(%rip), %rax
4149; O1-NEXT:  .Lpcsection147:
4150; O1-NEXT:    lock xorw $42, (%rdi)
4151; O1-NEXT:    movq $1, foo(%rip)
4152; O1-NEXT:    retq
4153;
4154; O2-LABEL: atomic16_xor_acq_rel:
4155; O2:       # %bb.0: # %entry
4156; O2-NEXT:    movq foo(%rip), %rax
4157; O2-NEXT:  .Lpcsection147:
4158; O2-NEXT:    lock xorw $42, (%rdi)
4159; O2-NEXT:    movq $1, foo(%rip)
4160; O2-NEXT:    retq
4161;
4162; O3-LABEL: atomic16_xor_acq_rel:
4163; O3:       # %bb.0: # %entry
4164; O3-NEXT:    movq foo(%rip), %rax
4165; O3-NEXT:  .Lpcsection147:
4166; O3-NEXT:    lock xorw $42, (%rdi)
4167; O3-NEXT:    movq $1, foo(%rip)
4168; O3-NEXT:    retq
4169entry:
4170  load volatile i64, ptr @foo, align 8
4171  %x = atomicrmw xor ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4172  store volatile i64 1, ptr @foo, align 8
4173  ret void
4174}
4175
4176define void @atomic16_nand_acq_rel(ptr %a) {
4177; O0-LABEL: atomic16_nand_acq_rel:
4178; O0:       # %bb.0: # %entry
4179; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
4180; O0-NEXT:    movq foo, %rax
4181; O0-NEXT:  .Lpcsection159:
4182; O0-NEXT:    movw (%rdi), %ax
4183; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4184; O0-NEXT:  .LBB85_1: # %atomicrmw.start
4185; O0-NEXT:    # =>This Inner Loop Header: Depth=1
4186; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4187; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
4188; O0-NEXT:  .Lpcsection160:
4189; O0-NEXT:    # implicit-def: $edx
4190; O0-NEXT:    movw %ax, %dx
4191; O0-NEXT:  .Lpcsection161:
4192; O0-NEXT:    notl %edx
4193; O0-NEXT:  .Lpcsection162:
4194; O0-NEXT:    orl $65493, %edx # imm = 0xFFD5
4195; O0-NEXT:  .Lpcsection163:
4196; O0-NEXT:    # kill: def $dx killed $dx killed $edx
4197; O0-NEXT:  .Lpcsection164:
4198; O0-NEXT:    lock cmpxchgw %dx, (%rcx)
4199; O0-NEXT:  .Lpcsection165:
4200; O0-NEXT:    sete %cl
4201; O0-NEXT:  .Lpcsection166:
4202; O0-NEXT:    testb $1, %cl
4203; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4204; O0-NEXT:  .Lpcsection167:
4205; O0-NEXT:    jne .LBB85_2
4206; O0-NEXT:    jmp .LBB85_1
4207; O0-NEXT:  .LBB85_2: # %atomicrmw.end
4208; O0-NEXT:    movq $1, foo
4209; O0-NEXT:    retq
4210;
4211; O1-LABEL: atomic16_nand_acq_rel:
4212; O1:       # %bb.0: # %entry
4213; O1-NEXT:    movq foo(%rip), %rax
4214; O1-NEXT:  .Lpcsection148:
4215; O1-NEXT:    movzwl (%rdi), %eax
4216; O1-NEXT:    .p2align 4
4217; O1-NEXT:  .LBB85_1: # %atomicrmw.start
4218; O1-NEXT:    # =>This Inner Loop Header: Depth=1
4219; O1-NEXT:    movl %eax, %ecx
4220; O1-NEXT:  .Lpcsection149:
4221; O1-NEXT:    notl %ecx
4222; O1-NEXT:  .Lpcsection150:
4223; O1-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4224; O1-NEXT:  .Lpcsection151:
4225; O1-NEXT:    # kill: def $ax killed $ax killed $eax
4226; O1-NEXT:  .Lpcsection152:
4227; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4228; O1-NEXT:  .Lpcsection153:
4229; O1-NEXT:    # kill: def $ax killed $ax def $eax
4230; O1-NEXT:  .Lpcsection154:
4231; O1-NEXT:    jne .LBB85_1
4232; O1-NEXT:  # %bb.2: # %atomicrmw.end
4233; O1-NEXT:    movq $1, foo(%rip)
4234; O1-NEXT:    retq
4235;
4236; O2-LABEL: atomic16_nand_acq_rel:
4237; O2:       # %bb.0: # %entry
4238; O2-NEXT:    movq foo(%rip), %rax
4239; O2-NEXT:  .Lpcsection148:
4240; O2-NEXT:    movzwl (%rdi), %eax
4241; O2-NEXT:    .p2align 4
4242; O2-NEXT:  .LBB85_1: # %atomicrmw.start
4243; O2-NEXT:    # =>This Inner Loop Header: Depth=1
4244; O2-NEXT:    movl %eax, %ecx
4245; O2-NEXT:  .Lpcsection149:
4246; O2-NEXT:    notl %ecx
4247; O2-NEXT:  .Lpcsection150:
4248; O2-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4249; O2-NEXT:  .Lpcsection151:
4250; O2-NEXT:    # kill: def $ax killed $ax killed $eax
4251; O2-NEXT:  .Lpcsection152:
4252; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4253; O2-NEXT:  .Lpcsection153:
4254; O2-NEXT:    # kill: def $ax killed $ax def $eax
4255; O2-NEXT:  .Lpcsection154:
4256; O2-NEXT:    jne .LBB85_1
4257; O2-NEXT:  # %bb.2: # %atomicrmw.end
4258; O2-NEXT:    movq $1, foo(%rip)
4259; O2-NEXT:    retq
4260;
4261; O3-LABEL: atomic16_nand_acq_rel:
4262; O3:       # %bb.0: # %entry
4263; O3-NEXT:    movq foo(%rip), %rax
4264; O3-NEXT:  .Lpcsection148:
4265; O3-NEXT:    movzwl (%rdi), %eax
4266; O3-NEXT:    .p2align 4
4267; O3-NEXT:  .LBB85_1: # %atomicrmw.start
4268; O3-NEXT:    # =>This Inner Loop Header: Depth=1
4269; O3-NEXT:    movl %eax, %ecx
4270; O3-NEXT:  .Lpcsection149:
4271; O3-NEXT:    notl %ecx
4272; O3-NEXT:  .Lpcsection150:
4273; O3-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4274; O3-NEXT:  .Lpcsection151:
4275; O3-NEXT:    # kill: def $ax killed $ax killed $eax
4276; O3-NEXT:  .Lpcsection152:
4277; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4278; O3-NEXT:  .Lpcsection153:
4279; O3-NEXT:    # kill: def $ax killed $ax def $eax
4280; O3-NEXT:  .Lpcsection154:
4281; O3-NEXT:    jne .LBB85_1
4282; O3-NEXT:  # %bb.2: # %atomicrmw.end
4283; O3-NEXT:    movq $1, foo(%rip)
4284; O3-NEXT:    retq
4285entry:
4286  load volatile i64, ptr @foo, align 8
4287  %x = atomicrmw nand ptr %a, i16 42 acq_rel, align 2, !pcsections !0
4288  store volatile i64 1, ptr @foo, align 8
4289  ret void
4290}
4291
4292define void @atomic16_xchg_seq_cst(ptr %a) {
4293; O0-LABEL: atomic16_xchg_seq_cst:
4294; O0:       # %bb.0: # %entry
4295; O0-NEXT:    movq foo(%rip), %rax
4296; O0-NEXT:    movw $42, %ax
4297; O0-NEXT:  .Lpcsection168:
4298; O0-NEXT:    xchgw %ax, (%rdi)
4299; O0-NEXT:    movq $1, foo
4300; O0-NEXT:    retq
4301;
4302; O1-LABEL: atomic16_xchg_seq_cst:
4303; O1:       # %bb.0: # %entry
4304; O1-NEXT:    movq foo(%rip), %rax
4305; O1-NEXT:    movw $42, %ax
4306; O1-NEXT:  .Lpcsection155:
4307; O1-NEXT:    xchgw %ax, (%rdi)
4308; O1-NEXT:    movq $1, foo(%rip)
4309; O1-NEXT:    retq
4310;
4311; O2-LABEL: atomic16_xchg_seq_cst:
4312; O2:       # %bb.0: # %entry
4313; O2-NEXT:    movq foo(%rip), %rax
4314; O2-NEXT:    movw $42, %ax
4315; O2-NEXT:  .Lpcsection155:
4316; O2-NEXT:    xchgw %ax, (%rdi)
4317; O2-NEXT:    movq $1, foo(%rip)
4318; O2-NEXT:    retq
4319;
4320; O3-LABEL: atomic16_xchg_seq_cst:
4321; O3:       # %bb.0: # %entry
4322; O3-NEXT:    movq foo(%rip), %rax
4323; O3-NEXT:    movw $42, %ax
4324; O3-NEXT:  .Lpcsection155:
4325; O3-NEXT:    xchgw %ax, (%rdi)
4326; O3-NEXT:    movq $1, foo(%rip)
4327; O3-NEXT:    retq
4328entry:
4329  load volatile i64, ptr @foo, align 8
4330  %x = atomicrmw xchg ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4331  store volatile i64 1, ptr @foo, align 8
4332  ret void
4333}
4334
4335define void @atomic16_add_seq_cst(ptr %a) {
4336; O0-LABEL: atomic16_add_seq_cst:
4337; O0:       # %bb.0: # %entry
4338; O0-NEXT:    movq foo(%rip), %rax
4339; O0-NEXT:  .Lpcsection169:
4340; O0-NEXT:    lock addw $42, (%rdi)
4341; O0-NEXT:    movq $1, foo
4342; O0-NEXT:    retq
4343;
4344; O1-LABEL: atomic16_add_seq_cst:
4345; O1:       # %bb.0: # %entry
4346; O1-NEXT:    movq foo(%rip), %rax
4347; O1-NEXT:  .Lpcsection156:
4348; O1-NEXT:    lock addw $42, (%rdi)
4349; O1-NEXT:    movq $1, foo(%rip)
4350; O1-NEXT:    retq
4351;
4352; O2-LABEL: atomic16_add_seq_cst:
4353; O2:       # %bb.0: # %entry
4354; O2-NEXT:    movq foo(%rip), %rax
4355; O2-NEXT:  .Lpcsection156:
4356; O2-NEXT:    lock addw $42, (%rdi)
4357; O2-NEXT:    movq $1, foo(%rip)
4358; O2-NEXT:    retq
4359;
4360; O3-LABEL: atomic16_add_seq_cst:
4361; O3:       # %bb.0: # %entry
4362; O3-NEXT:    movq foo(%rip), %rax
4363; O3-NEXT:  .Lpcsection156:
4364; O3-NEXT:    lock addw $42, (%rdi)
4365; O3-NEXT:    movq $1, foo(%rip)
4366; O3-NEXT:    retq
4367entry:
4368  load volatile i64, ptr @foo, align 8
4369  %x = atomicrmw add ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4370  store volatile i64 1, ptr @foo, align 8
4371  ret void
4372}
4373
4374define void @atomic16_sub_seq_cst(ptr %a) {
4375; O0-LABEL: atomic16_sub_seq_cst:
4376; O0:       # %bb.0: # %entry
4377; O0-NEXT:    movq foo(%rip), %rax
4378; O0-NEXT:  .Lpcsection170:
4379; O0-NEXT:    lock subw $42, (%rdi)
4380; O0-NEXT:    movq $1, foo
4381; O0-NEXT:    retq
4382;
4383; O1-LABEL: atomic16_sub_seq_cst:
4384; O1:       # %bb.0: # %entry
4385; O1-NEXT:    movq foo(%rip), %rax
4386; O1-NEXT:  .Lpcsection157:
4387; O1-NEXT:    lock subw $42, (%rdi)
4388; O1-NEXT:    movq $1, foo(%rip)
4389; O1-NEXT:    retq
4390;
4391; O2-LABEL: atomic16_sub_seq_cst:
4392; O2:       # %bb.0: # %entry
4393; O2-NEXT:    movq foo(%rip), %rax
4394; O2-NEXT:  .Lpcsection157:
4395; O2-NEXT:    lock subw $42, (%rdi)
4396; O2-NEXT:    movq $1, foo(%rip)
4397; O2-NEXT:    retq
4398;
4399; O3-LABEL: atomic16_sub_seq_cst:
4400; O3:       # %bb.0: # %entry
4401; O3-NEXT:    movq foo(%rip), %rax
4402; O3-NEXT:  .Lpcsection157:
4403; O3-NEXT:    lock subw $42, (%rdi)
4404; O3-NEXT:    movq $1, foo(%rip)
4405; O3-NEXT:    retq
4406entry:
4407  load volatile i64, ptr @foo, align 8
4408  %x = atomicrmw sub ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4409  store volatile i64 1, ptr @foo, align 8
4410  ret void
4411}
4412
4413define void @atomic16_and_seq_cst(ptr %a) {
4414; O0-LABEL: atomic16_and_seq_cst:
4415; O0:       # %bb.0: # %entry
4416; O0-NEXT:    movq foo(%rip), %rax
4417; O0-NEXT:  .Lpcsection171:
4418; O0-NEXT:    lock andw $42, (%rdi)
4419; O0-NEXT:    movq $1, foo
4420; O0-NEXT:    retq
4421;
4422; O1-LABEL: atomic16_and_seq_cst:
4423; O1:       # %bb.0: # %entry
4424; O1-NEXT:    movq foo(%rip), %rax
4425; O1-NEXT:  .Lpcsection158:
4426; O1-NEXT:    lock andw $42, (%rdi)
4427; O1-NEXT:    movq $1, foo(%rip)
4428; O1-NEXT:    retq
4429;
4430; O2-LABEL: atomic16_and_seq_cst:
4431; O2:       # %bb.0: # %entry
4432; O2-NEXT:    movq foo(%rip), %rax
4433; O2-NEXT:  .Lpcsection158:
4434; O2-NEXT:    lock andw $42, (%rdi)
4435; O2-NEXT:    movq $1, foo(%rip)
4436; O2-NEXT:    retq
4437;
4438; O3-LABEL: atomic16_and_seq_cst:
4439; O3:       # %bb.0: # %entry
4440; O3-NEXT:    movq foo(%rip), %rax
4441; O3-NEXT:  .Lpcsection158:
4442; O3-NEXT:    lock andw $42, (%rdi)
4443; O3-NEXT:    movq $1, foo(%rip)
4444; O3-NEXT:    retq
4445entry:
4446  load volatile i64, ptr @foo, align 8
4447  %x = atomicrmw and ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4448  store volatile i64 1, ptr @foo, align 8
4449  ret void
4450}
4451
4452define void @atomic16_or_seq_cst(ptr %a) {
4453; O0-LABEL: atomic16_or_seq_cst:
4454; O0:       # %bb.0: # %entry
4455; O0-NEXT:    movq foo(%rip), %rax
4456; O0-NEXT:  .Lpcsection172:
4457; O0-NEXT:    lock orw $42, (%rdi)
4458; O0-NEXT:    movq $1, foo
4459; O0-NEXT:    retq
4460;
4461; O1-LABEL: atomic16_or_seq_cst:
4462; O1:       # %bb.0: # %entry
4463; O1-NEXT:    movq foo(%rip), %rax
4464; O1-NEXT:  .Lpcsection159:
4465; O1-NEXT:    lock orw $42, (%rdi)
4466; O1-NEXT:    movq $1, foo(%rip)
4467; O1-NEXT:    retq
4468;
4469; O2-LABEL: atomic16_or_seq_cst:
4470; O2:       # %bb.0: # %entry
4471; O2-NEXT:    movq foo(%rip), %rax
4472; O2-NEXT:  .Lpcsection159:
4473; O2-NEXT:    lock orw $42, (%rdi)
4474; O2-NEXT:    movq $1, foo(%rip)
4475; O2-NEXT:    retq
4476;
4477; O3-LABEL: atomic16_or_seq_cst:
4478; O3:       # %bb.0: # %entry
4479; O3-NEXT:    movq foo(%rip), %rax
4480; O3-NEXT:  .Lpcsection159:
4481; O3-NEXT:    lock orw $42, (%rdi)
4482; O3-NEXT:    movq $1, foo(%rip)
4483; O3-NEXT:    retq
4484entry:
4485  load volatile i64, ptr @foo, align 8
4486  %x = atomicrmw or ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4487  store volatile i64 1, ptr @foo, align 8
4488  ret void
4489}
4490
4491define void @atomic16_xor_seq_cst(ptr %a) {
4492; O0-LABEL: atomic16_xor_seq_cst:
4493; O0:       # %bb.0: # %entry
4494; O0-NEXT:    movq foo(%rip), %rax
4495; O0-NEXT:  .Lpcsection173:
4496; O0-NEXT:    lock xorw $42, (%rdi)
4497; O0-NEXT:    movq $1, foo
4498; O0-NEXT:    retq
4499;
4500; O1-LABEL: atomic16_xor_seq_cst:
4501; O1:       # %bb.0: # %entry
4502; O1-NEXT:    movq foo(%rip), %rax
4503; O1-NEXT:  .Lpcsection160:
4504; O1-NEXT:    lock xorw $42, (%rdi)
4505; O1-NEXT:    movq $1, foo(%rip)
4506; O1-NEXT:    retq
4507;
4508; O2-LABEL: atomic16_xor_seq_cst:
4509; O2:       # %bb.0: # %entry
4510; O2-NEXT:    movq foo(%rip), %rax
4511; O2-NEXT:  .Lpcsection160:
4512; O2-NEXT:    lock xorw $42, (%rdi)
4513; O2-NEXT:    movq $1, foo(%rip)
4514; O2-NEXT:    retq
4515;
4516; O3-LABEL: atomic16_xor_seq_cst:
4517; O3:       # %bb.0: # %entry
4518; O3-NEXT:    movq foo(%rip), %rax
4519; O3-NEXT:  .Lpcsection160:
4520; O3-NEXT:    lock xorw $42, (%rdi)
4521; O3-NEXT:    movq $1, foo(%rip)
4522; O3-NEXT:    retq
4523entry:
4524  load volatile i64, ptr @foo, align 8
4525  %x = atomicrmw xor ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4526  store volatile i64 1, ptr @foo, align 8
4527  ret void
4528}
4529
4530define void @atomic16_nand_seq_cst(ptr %a) {
4531; O0-LABEL: atomic16_nand_seq_cst:
4532; O0:       # %bb.0: # %entry
4533; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
4534; O0-NEXT:    movq foo, %rax
4535; O0-NEXT:  .Lpcsection174:
4536; O0-NEXT:    movw (%rdi), %ax
4537; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4538; O0-NEXT:  .LBB92_1: # %atomicrmw.start
4539; O0-NEXT:    # =>This Inner Loop Header: Depth=1
4540; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4541; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
4542; O0-NEXT:  .Lpcsection175:
4543; O0-NEXT:    # implicit-def: $edx
4544; O0-NEXT:    movw %ax, %dx
4545; O0-NEXT:  .Lpcsection176:
4546; O0-NEXT:    notl %edx
4547; O0-NEXT:  .Lpcsection177:
4548; O0-NEXT:    orl $65493, %edx # imm = 0xFFD5
4549; O0-NEXT:  .Lpcsection178:
4550; O0-NEXT:    # kill: def $dx killed $dx killed $edx
4551; O0-NEXT:  .Lpcsection179:
4552; O0-NEXT:    lock cmpxchgw %dx, (%rcx)
4553; O0-NEXT:  .Lpcsection180:
4554; O0-NEXT:    sete %cl
4555; O0-NEXT:  .Lpcsection181:
4556; O0-NEXT:    testb $1, %cl
4557; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4558; O0-NEXT:  .Lpcsection182:
4559; O0-NEXT:    jne .LBB92_2
4560; O0-NEXT:    jmp .LBB92_1
4561; O0-NEXT:  .LBB92_2: # %atomicrmw.end
4562; O0-NEXT:    movq $1, foo
4563; O0-NEXT:    retq
4564;
4565; O1-LABEL: atomic16_nand_seq_cst:
4566; O1:       # %bb.0: # %entry
4567; O1-NEXT:    movq foo(%rip), %rax
4568; O1-NEXT:  .Lpcsection161:
4569; O1-NEXT:    movzwl (%rdi), %eax
4570; O1-NEXT:    .p2align 4
4571; O1-NEXT:  .LBB92_1: # %atomicrmw.start
4572; O1-NEXT:    # =>This Inner Loop Header: Depth=1
4573; O1-NEXT:    movl %eax, %ecx
4574; O1-NEXT:  .Lpcsection162:
4575; O1-NEXT:    notl %ecx
4576; O1-NEXT:  .Lpcsection163:
4577; O1-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4578; O1-NEXT:  .Lpcsection164:
4579; O1-NEXT:    # kill: def $ax killed $ax killed $eax
4580; O1-NEXT:  .Lpcsection165:
4581; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4582; O1-NEXT:  .Lpcsection166:
4583; O1-NEXT:    # kill: def $ax killed $ax def $eax
4584; O1-NEXT:  .Lpcsection167:
4585; O1-NEXT:    jne .LBB92_1
4586; O1-NEXT:  # %bb.2: # %atomicrmw.end
4587; O1-NEXT:    movq $1, foo(%rip)
4588; O1-NEXT:    retq
4589;
4590; O2-LABEL: atomic16_nand_seq_cst:
4591; O2:       # %bb.0: # %entry
4592; O2-NEXT:    movq foo(%rip), %rax
4593; O2-NEXT:  .Lpcsection161:
4594; O2-NEXT:    movzwl (%rdi), %eax
4595; O2-NEXT:    .p2align 4
4596; O2-NEXT:  .LBB92_1: # %atomicrmw.start
4597; O2-NEXT:    # =>This Inner Loop Header: Depth=1
4598; O2-NEXT:    movl %eax, %ecx
4599; O2-NEXT:  .Lpcsection162:
4600; O2-NEXT:    notl %ecx
4601; O2-NEXT:  .Lpcsection163:
4602; O2-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4603; O2-NEXT:  .Lpcsection164:
4604; O2-NEXT:    # kill: def $ax killed $ax killed $eax
4605; O2-NEXT:  .Lpcsection165:
4606; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4607; O2-NEXT:  .Lpcsection166:
4608; O2-NEXT:    # kill: def $ax killed $ax def $eax
4609; O2-NEXT:  .Lpcsection167:
4610; O2-NEXT:    jne .LBB92_1
4611; O2-NEXT:  # %bb.2: # %atomicrmw.end
4612; O2-NEXT:    movq $1, foo(%rip)
4613; O2-NEXT:    retq
4614;
4615; O3-LABEL: atomic16_nand_seq_cst:
4616; O3:       # %bb.0: # %entry
4617; O3-NEXT:    movq foo(%rip), %rax
4618; O3-NEXT:  .Lpcsection161:
4619; O3-NEXT:    movzwl (%rdi), %eax
4620; O3-NEXT:    .p2align 4
4621; O3-NEXT:  .LBB92_1: # %atomicrmw.start
4622; O3-NEXT:    # =>This Inner Loop Header: Depth=1
4623; O3-NEXT:    movl %eax, %ecx
4624; O3-NEXT:  .Lpcsection162:
4625; O3-NEXT:    notl %ecx
4626; O3-NEXT:  .Lpcsection163:
4627; O3-NEXT:    orl $65493, %ecx # imm = 0xFFD5
4628; O3-NEXT:  .Lpcsection164:
4629; O3-NEXT:    # kill: def $ax killed $ax killed $eax
4630; O3-NEXT:  .Lpcsection165:
4631; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4632; O3-NEXT:  .Lpcsection166:
4633; O3-NEXT:    # kill: def $ax killed $ax def $eax
4634; O3-NEXT:  .Lpcsection167:
4635; O3-NEXT:    jne .LBB92_1
4636; O3-NEXT:  # %bb.2: # %atomicrmw.end
4637; O3-NEXT:    movq $1, foo(%rip)
4638; O3-NEXT:    retq
4639entry:
4640  load volatile i64, ptr @foo, align 8
4641  %x = atomicrmw nand ptr %a, i16 42 seq_cst, align 2, !pcsections !0
4642  store volatile i64 1, ptr @foo, align 8
4643  ret void
4644}
4645
4646define void @atomic16_cas_monotonic(ptr %a) {
4647; O0-LABEL: atomic16_cas_monotonic:
4648; O0:       # %bb.0: # %entry
4649; O0-NEXT:    movq foo(%rip), %rax
4650; O0-NEXT:    movw $42, %ax
4651; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4652; O0-NEXT:    movw $1, %cx
4653; O0-NEXT:  .Lpcsection183:
4654; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4655; O0-NEXT:  .Lpcsection184:
4656; O0-NEXT:    # kill: def $dx killed $ax
4657; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4658; O0-NEXT:  .Lpcsection185:
4659; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4660; O0-NEXT:  .Lpcsection186:
4661; O0-NEXT:    # kill: def $dx killed $ax
4662; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4663; O0-NEXT:  .Lpcsection187:
4664; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4665; O0-NEXT:    movq $1, foo
4666; O0-NEXT:    retq
4667;
4668; O1-LABEL: atomic16_cas_monotonic:
4669; O1:       # %bb.0: # %entry
4670; O1-NEXT:    movq foo(%rip), %rax
4671; O1-NEXT:    movw $1, %cx
4672; O1-NEXT:    movw $42, %ax
4673; O1-NEXT:  .Lpcsection168:
4674; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4675; O1-NEXT:    movw $42, %ax
4676; O1-NEXT:  .Lpcsection169:
4677; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4678; O1-NEXT:    movw $42, %ax
4679; O1-NEXT:  .Lpcsection170:
4680; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4681; O1-NEXT:    movq $1, foo(%rip)
4682; O1-NEXT:    retq
4683;
4684; O2-LABEL: atomic16_cas_monotonic:
4685; O2:       # %bb.0: # %entry
4686; O2-NEXT:    movq foo(%rip), %rax
4687; O2-NEXT:    movw $1, %cx
4688; O2-NEXT:    movw $42, %ax
4689; O2-NEXT:  .Lpcsection168:
4690; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4691; O2-NEXT:    movw $42, %ax
4692; O2-NEXT:  .Lpcsection169:
4693; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4694; O2-NEXT:    movw $42, %ax
4695; O2-NEXT:  .Lpcsection170:
4696; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4697; O2-NEXT:    movq $1, foo(%rip)
4698; O2-NEXT:    retq
4699;
4700; O3-LABEL: atomic16_cas_monotonic:
4701; O3:       # %bb.0: # %entry
4702; O3-NEXT:    movq foo(%rip), %rax
4703; O3-NEXT:    movw $1, %cx
4704; O3-NEXT:    movw $42, %ax
4705; O3-NEXT:  .Lpcsection168:
4706; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4707; O3-NEXT:    movw $42, %ax
4708; O3-NEXT:  .Lpcsection169:
4709; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4710; O3-NEXT:    movw $42, %ax
4711; O3-NEXT:  .Lpcsection170:
4712; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4713; O3-NEXT:    movq $1, foo(%rip)
4714; O3-NEXT:    retq
4715entry:
4716  load volatile i64, ptr @foo, align 8
4717  %x = cmpxchg ptr %a, i16 42, i16 1 monotonic monotonic, align 2, !pcsections !0
4718  %y = cmpxchg ptr %a, i16 42, i16 1 monotonic acquire, align 2, !pcsections !0
4719  %z = cmpxchg ptr %a, i16 42, i16 1 monotonic seq_cst, align 2, !pcsections !0
4720  store volatile i64 1, ptr @foo, align 8
4721  ret void
4722}
4723
4724define void @atomic16_cas_acquire(ptr %a) {
4725; O0-LABEL: atomic16_cas_acquire:
4726; O0:       # %bb.0: # %entry
4727; O0-NEXT:    movq foo(%rip), %rax
4728; O0-NEXT:    movw $42, %ax
4729; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4730; O0-NEXT:    movw $1, %cx
4731; O0-NEXT:  .Lpcsection188:
4732; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4733; O0-NEXT:  .Lpcsection189:
4734; O0-NEXT:    # kill: def $dx killed $ax
4735; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4736; O0-NEXT:  .Lpcsection190:
4737; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4738; O0-NEXT:  .Lpcsection191:
4739; O0-NEXT:    # kill: def $dx killed $ax
4740; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4741; O0-NEXT:  .Lpcsection192:
4742; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4743; O0-NEXT:    movq $1, foo
4744; O0-NEXT:    retq
4745;
4746; O1-LABEL: atomic16_cas_acquire:
4747; O1:       # %bb.0: # %entry
4748; O1-NEXT:    movq foo(%rip), %rax
4749; O1-NEXT:    movw $1, %cx
4750; O1-NEXT:    movw $42, %ax
4751; O1-NEXT:  .Lpcsection171:
4752; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4753; O1-NEXT:    movw $42, %ax
4754; O1-NEXT:  .Lpcsection172:
4755; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4756; O1-NEXT:    movw $42, %ax
4757; O1-NEXT:  .Lpcsection173:
4758; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4759; O1-NEXT:    movq $1, foo(%rip)
4760; O1-NEXT:    retq
4761;
4762; O2-LABEL: atomic16_cas_acquire:
4763; O2:       # %bb.0: # %entry
4764; O2-NEXT:    movq foo(%rip), %rax
4765; O2-NEXT:    movw $1, %cx
4766; O2-NEXT:    movw $42, %ax
4767; O2-NEXT:  .Lpcsection171:
4768; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4769; O2-NEXT:    movw $42, %ax
4770; O2-NEXT:  .Lpcsection172:
4771; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4772; O2-NEXT:    movw $42, %ax
4773; O2-NEXT:  .Lpcsection173:
4774; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4775; O2-NEXT:    movq $1, foo(%rip)
4776; O2-NEXT:    retq
4777;
4778; O3-LABEL: atomic16_cas_acquire:
4779; O3:       # %bb.0: # %entry
4780; O3-NEXT:    movq foo(%rip), %rax
4781; O3-NEXT:    movw $1, %cx
4782; O3-NEXT:    movw $42, %ax
4783; O3-NEXT:  .Lpcsection171:
4784; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4785; O3-NEXT:    movw $42, %ax
4786; O3-NEXT:  .Lpcsection172:
4787; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4788; O3-NEXT:    movw $42, %ax
4789; O3-NEXT:  .Lpcsection173:
4790; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4791; O3-NEXT:    movq $1, foo(%rip)
4792; O3-NEXT:    retq
4793entry:
4794  load volatile i64, ptr @foo, align 8
4795  %x = cmpxchg ptr %a, i16 42, i16 1 acquire monotonic, align 2, !pcsections !0
4796  %y = cmpxchg ptr %a, i16 42, i16 1 acquire acquire, align 2, !pcsections !0
4797  %z = cmpxchg ptr %a, i16 42, i16 1 acquire seq_cst, align 2, !pcsections !0
4798  store volatile i64 1, ptr @foo, align 8
4799  ret void
4800}
4801
4802define void @atomic16_cas_release(ptr %a) {
4803; O0-LABEL: atomic16_cas_release:
4804; O0:       # %bb.0: # %entry
4805; O0-NEXT:    movq foo(%rip), %rax
4806; O0-NEXT:    movw $42, %ax
4807; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4808; O0-NEXT:    movw $1, %cx
4809; O0-NEXT:  .Lpcsection193:
4810; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4811; O0-NEXT:  .Lpcsection194:
4812; O0-NEXT:    # kill: def $dx killed $ax
4813; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4814; O0-NEXT:  .Lpcsection195:
4815; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4816; O0-NEXT:  .Lpcsection196:
4817; O0-NEXT:    # kill: def $dx killed $ax
4818; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4819; O0-NEXT:  .Lpcsection197:
4820; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4821; O0-NEXT:    movq $1, foo
4822; O0-NEXT:    retq
4823;
4824; O1-LABEL: atomic16_cas_release:
4825; O1:       # %bb.0: # %entry
4826; O1-NEXT:    movq foo(%rip), %rax
4827; O1-NEXT:    movw $1, %cx
4828; O1-NEXT:    movw $42, %ax
4829; O1-NEXT:  .Lpcsection174:
4830; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4831; O1-NEXT:    movw $42, %ax
4832; O1-NEXT:  .Lpcsection175:
4833; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4834; O1-NEXT:    movw $42, %ax
4835; O1-NEXT:  .Lpcsection176:
4836; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4837; O1-NEXT:    movq $1, foo(%rip)
4838; O1-NEXT:    retq
4839;
4840; O2-LABEL: atomic16_cas_release:
4841; O2:       # %bb.0: # %entry
4842; O2-NEXT:    movq foo(%rip), %rax
4843; O2-NEXT:    movw $1, %cx
4844; O2-NEXT:    movw $42, %ax
4845; O2-NEXT:  .Lpcsection174:
4846; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4847; O2-NEXT:    movw $42, %ax
4848; O2-NEXT:  .Lpcsection175:
4849; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4850; O2-NEXT:    movw $42, %ax
4851; O2-NEXT:  .Lpcsection176:
4852; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4853; O2-NEXT:    movq $1, foo(%rip)
4854; O2-NEXT:    retq
4855;
4856; O3-LABEL: atomic16_cas_release:
4857; O3:       # %bb.0: # %entry
4858; O3-NEXT:    movq foo(%rip), %rax
4859; O3-NEXT:    movw $1, %cx
4860; O3-NEXT:    movw $42, %ax
4861; O3-NEXT:  .Lpcsection174:
4862; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4863; O3-NEXT:    movw $42, %ax
4864; O3-NEXT:  .Lpcsection175:
4865; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4866; O3-NEXT:    movw $42, %ax
4867; O3-NEXT:  .Lpcsection176:
4868; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4869; O3-NEXT:    movq $1, foo(%rip)
4870; O3-NEXT:    retq
4871entry:
4872  load volatile i64, ptr @foo, align 8
4873  %x = cmpxchg ptr %a, i16 42, i16 1 release monotonic, align 2, !pcsections !0
4874  %y = cmpxchg ptr %a, i16 42, i16 1 release acquire, align 2, !pcsections !0
4875  %z = cmpxchg ptr %a, i16 42, i16 1 release seq_cst, align 2, !pcsections !0
4876  store volatile i64 1, ptr @foo, align 8
4877  ret void
4878}
4879
4880define void @atomic16_cas_acq_rel(ptr %a) {
4881; O0-LABEL: atomic16_cas_acq_rel:
4882; O0:       # %bb.0: # %entry
4883; O0-NEXT:    movq foo(%rip), %rax
4884; O0-NEXT:    movw $42, %ax
4885; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4886; O0-NEXT:    movw $1, %cx
4887; O0-NEXT:  .Lpcsection198:
4888; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4889; O0-NEXT:  .Lpcsection199:
4890; O0-NEXT:    # kill: def $dx killed $ax
4891; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4892; O0-NEXT:  .Lpcsection200:
4893; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4894; O0-NEXT:  .Lpcsection201:
4895; O0-NEXT:    # kill: def $dx killed $ax
4896; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4897; O0-NEXT:  .Lpcsection202:
4898; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4899; O0-NEXT:    movq $1, foo
4900; O0-NEXT:    retq
4901;
4902; O1-LABEL: atomic16_cas_acq_rel:
4903; O1:       # %bb.0: # %entry
4904; O1-NEXT:    movq foo(%rip), %rax
4905; O1-NEXT:    movw $1, %cx
4906; O1-NEXT:    movw $42, %ax
4907; O1-NEXT:  .Lpcsection177:
4908; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4909; O1-NEXT:    movw $42, %ax
4910; O1-NEXT:  .Lpcsection178:
4911; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4912; O1-NEXT:    movw $42, %ax
4913; O1-NEXT:  .Lpcsection179:
4914; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4915; O1-NEXT:    movq $1, foo(%rip)
4916; O1-NEXT:    retq
4917;
4918; O2-LABEL: atomic16_cas_acq_rel:
4919; O2:       # %bb.0: # %entry
4920; O2-NEXT:    movq foo(%rip), %rax
4921; O2-NEXT:    movw $1, %cx
4922; O2-NEXT:    movw $42, %ax
4923; O2-NEXT:  .Lpcsection177:
4924; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4925; O2-NEXT:    movw $42, %ax
4926; O2-NEXT:  .Lpcsection178:
4927; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4928; O2-NEXT:    movw $42, %ax
4929; O2-NEXT:  .Lpcsection179:
4930; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
4931; O2-NEXT:    movq $1, foo(%rip)
4932; O2-NEXT:    retq
4933;
4934; O3-LABEL: atomic16_cas_acq_rel:
4935; O3:       # %bb.0: # %entry
4936; O3-NEXT:    movq foo(%rip), %rax
4937; O3-NEXT:    movw $1, %cx
4938; O3-NEXT:    movw $42, %ax
4939; O3-NEXT:  .Lpcsection177:
4940; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4941; O3-NEXT:    movw $42, %ax
4942; O3-NEXT:  .Lpcsection178:
4943; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4944; O3-NEXT:    movw $42, %ax
4945; O3-NEXT:  .Lpcsection179:
4946; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
4947; O3-NEXT:    movq $1, foo(%rip)
4948; O3-NEXT:    retq
4949entry:
4950  load volatile i64, ptr @foo, align 8
4951  %x = cmpxchg ptr %a, i16 42, i16 1 acq_rel monotonic, align 2, !pcsections !0
4952  %y = cmpxchg ptr %a, i16 42, i16 1 acq_rel acquire, align 2, !pcsections !0
4953  %z = cmpxchg ptr %a, i16 42, i16 1 acq_rel seq_cst, align 2, !pcsections !0
4954  store volatile i64 1, ptr @foo, align 8
4955  ret void
4956}
4957
4958define void @atomic16_cas_seq_cst(ptr %a) {
4959; O0-LABEL: atomic16_cas_seq_cst:
4960; O0:       # %bb.0: # %entry
4961; O0-NEXT:    movq foo(%rip), %rax
4962; O0-NEXT:    movw $42, %ax
4963; O0-NEXT:    movw %ax, {{[-0-9]+}}(%r{{[sb]}}p) # 2-byte Spill
4964; O0-NEXT:    movw $1, %cx
4965; O0-NEXT:  .Lpcsection203:
4966; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4967; O0-NEXT:  .Lpcsection204:
4968; O0-NEXT:    # kill: def $dx killed $ax
4969; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4970; O0-NEXT:  .Lpcsection205:
4971; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4972; O0-NEXT:  .Lpcsection206:
4973; O0-NEXT:    # kill: def $dx killed $ax
4974; O0-NEXT:    movw {{[-0-9]+}}(%r{{[sb]}}p), %ax # 2-byte Reload
4975; O0-NEXT:  .Lpcsection207:
4976; O0-NEXT:    lock cmpxchgw %cx, (%rdi)
4977; O0-NEXT:    movq $1, foo
4978; O0-NEXT:    retq
4979;
4980; O1-LABEL: atomic16_cas_seq_cst:
4981; O1:       # %bb.0: # %entry
4982; O1-NEXT:    movq foo(%rip), %rax
4983; O1-NEXT:    movw $1, %cx
4984; O1-NEXT:    movw $42, %ax
4985; O1-NEXT:  .Lpcsection180:
4986; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4987; O1-NEXT:    movw $42, %ax
4988; O1-NEXT:  .Lpcsection181:
4989; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4990; O1-NEXT:    movw $42, %ax
4991; O1-NEXT:  .Lpcsection182:
4992; O1-NEXT:    lock cmpxchgw %cx, (%rdi)
4993; O1-NEXT:    movq $1, foo(%rip)
4994; O1-NEXT:    retq
4995;
4996; O2-LABEL: atomic16_cas_seq_cst:
4997; O2:       # %bb.0: # %entry
4998; O2-NEXT:    movq foo(%rip), %rax
4999; O2-NEXT:    movw $1, %cx
5000; O2-NEXT:    movw $42, %ax
5001; O2-NEXT:  .Lpcsection180:
5002; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
5003; O2-NEXT:    movw $42, %ax
5004; O2-NEXT:  .Lpcsection181:
5005; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
5006; O2-NEXT:    movw $42, %ax
5007; O2-NEXT:  .Lpcsection182:
5008; O2-NEXT:    lock cmpxchgw %cx, (%rdi)
5009; O2-NEXT:    movq $1, foo(%rip)
5010; O2-NEXT:    retq
5011;
5012; O3-LABEL: atomic16_cas_seq_cst:
5013; O3:       # %bb.0: # %entry
5014; O3-NEXT:    movq foo(%rip), %rax
5015; O3-NEXT:    movw $1, %cx
5016; O3-NEXT:    movw $42, %ax
5017; O3-NEXT:  .Lpcsection180:
5018; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
5019; O3-NEXT:    movw $42, %ax
5020; O3-NEXT:  .Lpcsection181:
5021; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
5022; O3-NEXT:    movw $42, %ax
5023; O3-NEXT:  .Lpcsection182:
5024; O3-NEXT:    lock cmpxchgw %cx, (%rdi)
5025; O3-NEXT:    movq $1, foo(%rip)
5026; O3-NEXT:    retq
5027entry:
5028  load volatile i64, ptr @foo, align 8
5029  %x = cmpxchg ptr %a, i16 42, i16 1 seq_cst monotonic, align 2, !pcsections !0
5030  %y = cmpxchg ptr %a, i16 42, i16 1 seq_cst acquire, align 2, !pcsections !0
5031  %z = cmpxchg ptr %a, i16 42, i16 1 seq_cst seq_cst, align 2, !pcsections !0
5032  store volatile i64 1, ptr @foo, align 8
5033  ret void
5034}
5035
5036define i32 @atomic32_load_unordered(ptr %a) {
5037; O0-LABEL: atomic32_load_unordered:
5038; O0:       # %bb.0: # %entry
5039; O0-NEXT:    movq foo(%rip), %rax
5040; O0-NEXT:  .Lpcsection208:
5041; O0-NEXT:    movl (%rdi), %eax
5042; O0-NEXT:    movq $1, foo
5043; O0-NEXT:    retq
5044;
5045; O1-LABEL: atomic32_load_unordered:
5046; O1:       # %bb.0: # %entry
5047; O1-NEXT:    movq foo(%rip), %rax
5048; O1-NEXT:  .Lpcsection183:
5049; O1-NEXT:    movl (%rdi), %eax
5050; O1-NEXT:    movq $1, foo(%rip)
5051; O1-NEXT:    retq
5052;
5053; O2-LABEL: atomic32_load_unordered:
5054; O2:       # %bb.0: # %entry
5055; O2-NEXT:    movq foo(%rip), %rax
5056; O2-NEXT:  .Lpcsection183:
5057; O2-NEXT:    movl (%rdi), %eax
5058; O2-NEXT:    movq $1, foo(%rip)
5059; O2-NEXT:    retq
5060;
5061; O3-LABEL: atomic32_load_unordered:
5062; O3:       # %bb.0: # %entry
5063; O3-NEXT:    movq foo(%rip), %rax
5064; O3-NEXT:  .Lpcsection183:
5065; O3-NEXT:    movl (%rdi), %eax
5066; O3-NEXT:    movq $1, foo(%rip)
5067; O3-NEXT:    retq
5068entry:
5069  load volatile i64, ptr @foo, align 8
5070  %x = load atomic i32, ptr %a unordered, align 4, !pcsections !0
5071  store volatile i64 1, ptr @foo, align 8
5072  ret i32 %x
5073}
5074
5075define i32 @atomic32_load_monotonic(ptr %a) {
5076; O0-LABEL: atomic32_load_monotonic:
5077; O0:       # %bb.0: # %entry
5078; O0-NEXT:    movq foo(%rip), %rax
5079; O0-NEXT:  .Lpcsection209:
5080; O0-NEXT:    movl (%rdi), %eax
5081; O0-NEXT:    movq $1, foo
5082; O0-NEXT:    retq
5083;
5084; O1-LABEL: atomic32_load_monotonic:
5085; O1:       # %bb.0: # %entry
5086; O1-NEXT:    movq foo(%rip), %rax
5087; O1-NEXT:  .Lpcsection184:
5088; O1-NEXT:    movl (%rdi), %eax
5089; O1-NEXT:    movq $1, foo(%rip)
5090; O1-NEXT:    retq
5091;
5092; O2-LABEL: atomic32_load_monotonic:
5093; O2:       # %bb.0: # %entry
5094; O2-NEXT:    movq foo(%rip), %rax
5095; O2-NEXT:  .Lpcsection184:
5096; O2-NEXT:    movl (%rdi), %eax
5097; O2-NEXT:    movq $1, foo(%rip)
5098; O2-NEXT:    retq
5099;
5100; O3-LABEL: atomic32_load_monotonic:
5101; O3:       # %bb.0: # %entry
5102; O3-NEXT:    movq foo(%rip), %rax
5103; O3-NEXT:  .Lpcsection184:
5104; O3-NEXT:    movl (%rdi), %eax
5105; O3-NEXT:    movq $1, foo(%rip)
5106; O3-NEXT:    retq
5107entry:
5108  load volatile i64, ptr @foo, align 8
5109  %x = load atomic i32, ptr %a monotonic, align 4, !pcsections !0
5110  store volatile i64 1, ptr @foo, align 8
5111  ret i32 %x
5112}
5113
5114define i32 @atomic32_load_acquire(ptr %a) {
5115; O0-LABEL: atomic32_load_acquire:
5116; O0:       # %bb.0: # %entry
5117; O0-NEXT:    movq foo(%rip), %rax
5118; O0-NEXT:  .Lpcsection210:
5119; O0-NEXT:    movl (%rdi), %eax
5120; O0-NEXT:    movq $1, foo
5121; O0-NEXT:    retq
5122;
5123; O1-LABEL: atomic32_load_acquire:
5124; O1:       # %bb.0: # %entry
5125; O1-NEXT:    movq foo(%rip), %rax
5126; O1-NEXT:  .Lpcsection185:
5127; O1-NEXT:    movl (%rdi), %eax
5128; O1-NEXT:    movq $1, foo(%rip)
5129; O1-NEXT:    retq
5130;
5131; O2-LABEL: atomic32_load_acquire:
5132; O2:       # %bb.0: # %entry
5133; O2-NEXT:    movq foo(%rip), %rax
5134; O2-NEXT:  .Lpcsection185:
5135; O2-NEXT:    movl (%rdi), %eax
5136; O2-NEXT:    movq $1, foo(%rip)
5137; O2-NEXT:    retq
5138;
5139; O3-LABEL: atomic32_load_acquire:
5140; O3:       # %bb.0: # %entry
5141; O3-NEXT:    movq foo(%rip), %rax
5142; O3-NEXT:  .Lpcsection185:
5143; O3-NEXT:    movl (%rdi), %eax
5144; O3-NEXT:    movq $1, foo(%rip)
5145; O3-NEXT:    retq
5146entry:
5147  load volatile i64, ptr @foo, align 8
5148  %x = load atomic i32, ptr %a acquire, align 4, !pcsections !0
5149  store volatile i64 1, ptr @foo, align 8
5150  ret i32 %x
5151}
5152
5153define i32 @atomic32_load_seq_cst(ptr %a) {
5154; O0-LABEL: atomic32_load_seq_cst:
5155; O0:       # %bb.0: # %entry
5156; O0-NEXT:    movq foo(%rip), %rax
5157; O0-NEXT:  .Lpcsection211:
5158; O0-NEXT:    movl (%rdi), %eax
5159; O0-NEXT:    movq $1, foo
5160; O0-NEXT:    retq
5161;
5162; O1-LABEL: atomic32_load_seq_cst:
5163; O1:       # %bb.0: # %entry
5164; O1-NEXT:    movq foo(%rip), %rax
5165; O1-NEXT:  .Lpcsection186:
5166; O1-NEXT:    movl (%rdi), %eax
5167; O1-NEXT:    movq $1, foo(%rip)
5168; O1-NEXT:    retq
5169;
5170; O2-LABEL: atomic32_load_seq_cst:
5171; O2:       # %bb.0: # %entry
5172; O2-NEXT:    movq foo(%rip), %rax
5173; O2-NEXT:  .Lpcsection186:
5174; O2-NEXT:    movl (%rdi), %eax
5175; O2-NEXT:    movq $1, foo(%rip)
5176; O2-NEXT:    retq
5177;
5178; O3-LABEL: atomic32_load_seq_cst:
5179; O3:       # %bb.0: # %entry
5180; O3-NEXT:    movq foo(%rip), %rax
5181; O3-NEXT:  .Lpcsection186:
5182; O3-NEXT:    movl (%rdi), %eax
5183; O3-NEXT:    movq $1, foo(%rip)
5184; O3-NEXT:    retq
5185entry:
5186  load volatile i64, ptr @foo, align 8
5187  %x = load atomic i32, ptr %a seq_cst, align 4, !pcsections !0
5188  store volatile i64 1, ptr @foo, align 8
5189  ret i32 %x
5190}
5191
5192define void @atomic32_store_unordered(ptr %a) {
5193; O0-LABEL: atomic32_store_unordered:
5194; O0:       # %bb.0: # %entry
5195; O0-NEXT:    movq foo(%rip), %rax
5196; O0-NEXT:  .Lpcsection212:
5197; O0-NEXT:    movl $42, (%rdi)
5198; O0-NEXT:    movq $1, foo
5199; O0-NEXT:    retq
5200;
5201; O1-LABEL: atomic32_store_unordered:
5202; O1:       # %bb.0: # %entry
5203; O1-NEXT:    movq foo(%rip), %rax
5204; O1-NEXT:  .Lpcsection187:
5205; O1-NEXT:    movl $42, (%rdi)
5206; O1-NEXT:    movq $1, foo(%rip)
5207; O1-NEXT:    retq
5208;
5209; O2-LABEL: atomic32_store_unordered:
5210; O2:       # %bb.0: # %entry
5211; O2-NEXT:    movq foo(%rip), %rax
5212; O2-NEXT:  .Lpcsection187:
5213; O2-NEXT:    movl $42, (%rdi)
5214; O2-NEXT:    movq $1, foo(%rip)
5215; O2-NEXT:    retq
5216;
5217; O3-LABEL: atomic32_store_unordered:
5218; O3:       # %bb.0: # %entry
5219; O3-NEXT:    movq foo(%rip), %rax
5220; O3-NEXT:  .Lpcsection187:
5221; O3-NEXT:    movl $42, (%rdi)
5222; O3-NEXT:    movq $1, foo(%rip)
5223; O3-NEXT:    retq
5224entry:
5225  load volatile i64, ptr @foo, align 8
5226  store atomic i32 42, ptr %a unordered, align 4, !pcsections !0
5227  store volatile i64 1, ptr @foo, align 8
5228  ret void
5229}
5230
5231define void @atomic32_store_monotonic(ptr %a) {
5232; O0-LABEL: atomic32_store_monotonic:
5233; O0:       # %bb.0: # %entry
5234; O0-NEXT:    movq foo(%rip), %rax
5235; O0-NEXT:  .Lpcsection213:
5236; O0-NEXT:    movl $42, (%rdi)
5237; O0-NEXT:    movq $1, foo
5238; O0-NEXT:    retq
5239;
5240; O1-LABEL: atomic32_store_monotonic:
5241; O1:       # %bb.0: # %entry
5242; O1-NEXT:    movq foo(%rip), %rax
5243; O1-NEXT:  .Lpcsection188:
5244; O1-NEXT:    movl $42, (%rdi)
5245; O1-NEXT:    movq $1, foo(%rip)
5246; O1-NEXT:    retq
5247;
5248; O2-LABEL: atomic32_store_monotonic:
5249; O2:       # %bb.0: # %entry
5250; O2-NEXT:    movq foo(%rip), %rax
5251; O2-NEXT:  .Lpcsection188:
5252; O2-NEXT:    movl $42, (%rdi)
5253; O2-NEXT:    movq $1, foo(%rip)
5254; O2-NEXT:    retq
5255;
5256; O3-LABEL: atomic32_store_monotonic:
5257; O3:       # %bb.0: # %entry
5258; O3-NEXT:    movq foo(%rip), %rax
5259; O3-NEXT:  .Lpcsection188:
5260; O3-NEXT:    movl $42, (%rdi)
5261; O3-NEXT:    movq $1, foo(%rip)
5262; O3-NEXT:    retq
5263entry:
5264  load volatile i64, ptr @foo, align 8
5265  store atomic i32 42, ptr %a monotonic, align 4, !pcsections !0
5266  store volatile i64 1, ptr @foo, align 8
5267  ret void
5268}
5269
5270define void @atomic32_store_release(ptr %a) {
5271; O0-LABEL: atomic32_store_release:
5272; O0:       # %bb.0: # %entry
5273; O0-NEXT:    movq foo(%rip), %rax
5274; O0-NEXT:  .Lpcsection214:
5275; O0-NEXT:    movl $42, (%rdi)
5276; O0-NEXT:    movq $1, foo
5277; O0-NEXT:    retq
5278;
5279; O1-LABEL: atomic32_store_release:
5280; O1:       # %bb.0: # %entry
5281; O1-NEXT:    movq foo(%rip), %rax
5282; O1-NEXT:  .Lpcsection189:
5283; O1-NEXT:    movl $42, (%rdi)
5284; O1-NEXT:    movq $1, foo(%rip)
5285; O1-NEXT:    retq
5286;
5287; O2-LABEL: atomic32_store_release:
5288; O2:       # %bb.0: # %entry
5289; O2-NEXT:    movq foo(%rip), %rax
5290; O2-NEXT:  .Lpcsection189:
5291; O2-NEXT:    movl $42, (%rdi)
5292; O2-NEXT:    movq $1, foo(%rip)
5293; O2-NEXT:    retq
5294;
5295; O3-LABEL: atomic32_store_release:
5296; O3:       # %bb.0: # %entry
5297; O3-NEXT:    movq foo(%rip), %rax
5298; O3-NEXT:  .Lpcsection189:
5299; O3-NEXT:    movl $42, (%rdi)
5300; O3-NEXT:    movq $1, foo(%rip)
5301; O3-NEXT:    retq
5302entry:
5303  load volatile i64, ptr @foo, align 8
5304  store atomic i32 42, ptr %a release, align 4, !pcsections !0
5305  store volatile i64 1, ptr @foo, align 8
5306  ret void
5307}
5308
5309define void @atomic32_store_seq_cst(ptr %a) {
5310; O0-LABEL: atomic32_store_seq_cst:
5311; O0:       # %bb.0: # %entry
5312; O0-NEXT:    movq foo(%rip), %rax
5313; O0-NEXT:    movl $42, %eax
5314; O0-NEXT:  .Lpcsection215:
5315; O0-NEXT:    xchgl %eax, (%rdi)
5316; O0-NEXT:    movq $1, foo
5317; O0-NEXT:    retq
5318;
5319; O1-LABEL: atomic32_store_seq_cst:
5320; O1:       # %bb.0: # %entry
5321; O1-NEXT:    movq foo(%rip), %rax
5322; O1-NEXT:    movl $42, %eax
5323; O1-NEXT:  .Lpcsection190:
5324; O1-NEXT:    xchgl %eax, (%rdi)
5325; O1-NEXT:    movq $1, foo(%rip)
5326; O1-NEXT:    retq
5327;
5328; O2-LABEL: atomic32_store_seq_cst:
5329; O2:       # %bb.0: # %entry
5330; O2-NEXT:    movq foo(%rip), %rax
5331; O2-NEXT:    movl $42, %eax
5332; O2-NEXT:  .Lpcsection190:
5333; O2-NEXT:    xchgl %eax, (%rdi)
5334; O2-NEXT:    movq $1, foo(%rip)
5335; O2-NEXT:    retq
5336;
5337; O3-LABEL: atomic32_store_seq_cst:
5338; O3:       # %bb.0: # %entry
5339; O3-NEXT:    movq foo(%rip), %rax
5340; O3-NEXT:    movl $42, %eax
5341; O3-NEXT:  .Lpcsection190:
5342; O3-NEXT:    xchgl %eax, (%rdi)
5343; O3-NEXT:    movq $1, foo(%rip)
5344; O3-NEXT:    retq
5345entry:
5346  load volatile i64, ptr @foo, align 8
5347  store atomic i32 42, ptr %a seq_cst, align 4, !pcsections !0
5348  store volatile i64 1, ptr @foo, align 8
5349  ret void
5350}
5351
5352define void @atomic32_xchg_monotonic(ptr %a) {
5353; O0-LABEL: atomic32_xchg_monotonic:
5354; O0:       # %bb.0: # %entry
5355; O0-NEXT:    movq foo(%rip), %rax
5356; O0-NEXT:    movl $42, %eax
5357; O0-NEXT:  .Lpcsection216:
5358; O0-NEXT:    xchgl %eax, (%rdi)
5359; O0-NEXT:    movq $1, foo
5360; O0-NEXT:    retq
5361;
5362; O1-LABEL: atomic32_xchg_monotonic:
5363; O1:       # %bb.0: # %entry
5364; O1-NEXT:    movq foo(%rip), %rax
5365; O1-NEXT:    movl $42, %eax
5366; O1-NEXT:  .Lpcsection191:
5367; O1-NEXT:    xchgl %eax, (%rdi)
5368; O1-NEXT:    movq $1, foo(%rip)
5369; O1-NEXT:    retq
5370;
5371; O2-LABEL: atomic32_xchg_monotonic:
5372; O2:       # %bb.0: # %entry
5373; O2-NEXT:    movq foo(%rip), %rax
5374; O2-NEXT:    movl $42, %eax
5375; O2-NEXT:  .Lpcsection191:
5376; O2-NEXT:    xchgl %eax, (%rdi)
5377; O2-NEXT:    movq $1, foo(%rip)
5378; O2-NEXT:    retq
5379;
5380; O3-LABEL: atomic32_xchg_monotonic:
5381; O3:       # %bb.0: # %entry
5382; O3-NEXT:    movq foo(%rip), %rax
5383; O3-NEXT:    movl $42, %eax
5384; O3-NEXT:  .Lpcsection191:
5385; O3-NEXT:    xchgl %eax, (%rdi)
5386; O3-NEXT:    movq $1, foo(%rip)
5387; O3-NEXT:    retq
5388entry:
5389  load volatile i64, ptr @foo, align 8
5390  %x = atomicrmw xchg ptr %a, i32 42 monotonic, align 4, !pcsections !0
5391  store volatile i64 1, ptr @foo, align 8
5392  ret void
5393}
5394
5395define void @atomic32_add_monotonic(ptr %a) {
5396; O0-LABEL: atomic32_add_monotonic:
5397; O0:       # %bb.0: # %entry
5398; O0-NEXT:    movq foo(%rip), %rax
5399; O0-NEXT:  .Lpcsection217:
5400; O0-NEXT:    lock addl $42, (%rdi)
5401; O0-NEXT:    movq $1, foo
5402; O0-NEXT:    retq
5403;
5404; O1-LABEL: atomic32_add_monotonic:
5405; O1:       # %bb.0: # %entry
5406; O1-NEXT:    movq foo(%rip), %rax
5407; O1-NEXT:  .Lpcsection192:
5408; O1-NEXT:    lock addl $42, (%rdi)
5409; O1-NEXT:    movq $1, foo(%rip)
5410; O1-NEXT:    retq
5411;
5412; O2-LABEL: atomic32_add_monotonic:
5413; O2:       # %bb.0: # %entry
5414; O2-NEXT:    movq foo(%rip), %rax
5415; O2-NEXT:  .Lpcsection192:
5416; O2-NEXT:    lock addl $42, (%rdi)
5417; O2-NEXT:    movq $1, foo(%rip)
5418; O2-NEXT:    retq
5419;
5420; O3-LABEL: atomic32_add_monotonic:
5421; O3:       # %bb.0: # %entry
5422; O3-NEXT:    movq foo(%rip), %rax
5423; O3-NEXT:  .Lpcsection192:
5424; O3-NEXT:    lock addl $42, (%rdi)
5425; O3-NEXT:    movq $1, foo(%rip)
5426; O3-NEXT:    retq
5427entry:
5428  load volatile i64, ptr @foo, align 8
5429  %x = atomicrmw add ptr %a, i32 42 monotonic, align 4, !pcsections !0
5430  store volatile i64 1, ptr @foo, align 8
5431  ret void
5432}
5433
5434define void @atomic32_sub_monotonic(ptr %a) {
5435; O0-LABEL: atomic32_sub_monotonic:
5436; O0:       # %bb.0: # %entry
5437; O0-NEXT:    movq foo(%rip), %rax
5438; O0-NEXT:  .Lpcsection218:
5439; O0-NEXT:    lock subl $42, (%rdi)
5440; O0-NEXT:    movq $1, foo
5441; O0-NEXT:    retq
5442;
5443; O1-LABEL: atomic32_sub_monotonic:
5444; O1:       # %bb.0: # %entry
5445; O1-NEXT:    movq foo(%rip), %rax
5446; O1-NEXT:  .Lpcsection193:
5447; O1-NEXT:    lock subl $42, (%rdi)
5448; O1-NEXT:    movq $1, foo(%rip)
5449; O1-NEXT:    retq
5450;
5451; O2-LABEL: atomic32_sub_monotonic:
5452; O2:       # %bb.0: # %entry
5453; O2-NEXT:    movq foo(%rip), %rax
5454; O2-NEXT:  .Lpcsection193:
5455; O2-NEXT:    lock subl $42, (%rdi)
5456; O2-NEXT:    movq $1, foo(%rip)
5457; O2-NEXT:    retq
5458;
5459; O3-LABEL: atomic32_sub_monotonic:
5460; O3:       # %bb.0: # %entry
5461; O3-NEXT:    movq foo(%rip), %rax
5462; O3-NEXT:  .Lpcsection193:
5463; O3-NEXT:    lock subl $42, (%rdi)
5464; O3-NEXT:    movq $1, foo(%rip)
5465; O3-NEXT:    retq
5466entry:
5467  load volatile i64, ptr @foo, align 8
5468  %x = atomicrmw sub ptr %a, i32 42 monotonic, align 4, !pcsections !0
5469  store volatile i64 1, ptr @foo, align 8
5470  ret void
5471}
5472
5473define void @atomic32_and_monotonic(ptr %a) {
5474; O0-LABEL: atomic32_and_monotonic:
5475; O0:       # %bb.0: # %entry
5476; O0-NEXT:    movq foo(%rip), %rax
5477; O0-NEXT:  .Lpcsection219:
5478; O0-NEXT:    lock andl $42, (%rdi)
5479; O0-NEXT:    movq $1, foo
5480; O0-NEXT:    retq
5481;
5482; O1-LABEL: atomic32_and_monotonic:
5483; O1:       # %bb.0: # %entry
5484; O1-NEXT:    movq foo(%rip), %rax
5485; O1-NEXT:  .Lpcsection194:
5486; O1-NEXT:    lock andl $42, (%rdi)
5487; O1-NEXT:    movq $1, foo(%rip)
5488; O1-NEXT:    retq
5489;
5490; O2-LABEL: atomic32_and_monotonic:
5491; O2:       # %bb.0: # %entry
5492; O2-NEXT:    movq foo(%rip), %rax
5493; O2-NEXT:  .Lpcsection194:
5494; O2-NEXT:    lock andl $42, (%rdi)
5495; O2-NEXT:    movq $1, foo(%rip)
5496; O2-NEXT:    retq
5497;
5498; O3-LABEL: atomic32_and_monotonic:
5499; O3:       # %bb.0: # %entry
5500; O3-NEXT:    movq foo(%rip), %rax
5501; O3-NEXT:  .Lpcsection194:
5502; O3-NEXT:    lock andl $42, (%rdi)
5503; O3-NEXT:    movq $1, foo(%rip)
5504; O3-NEXT:    retq
5505entry:
5506  load volatile i64, ptr @foo, align 8
5507  %x = atomicrmw and ptr %a, i32 42 monotonic, align 4, !pcsections !0
5508  store volatile i64 1, ptr @foo, align 8
5509  ret void
5510}
5511
5512define void @atomic32_or_monotonic(ptr %a) {
5513; O0-LABEL: atomic32_or_monotonic:
5514; O0:       # %bb.0: # %entry
5515; O0-NEXT:    movq foo(%rip), %rax
5516; O0-NEXT:  .Lpcsection220:
5517; O0-NEXT:    lock orl $42, (%rdi)
5518; O0-NEXT:    movq $1, foo
5519; O0-NEXT:    retq
5520;
5521; O1-LABEL: atomic32_or_monotonic:
5522; O1:       # %bb.0: # %entry
5523; O1-NEXT:    movq foo(%rip), %rax
5524; O1-NEXT:  .Lpcsection195:
5525; O1-NEXT:    lock orl $42, (%rdi)
5526; O1-NEXT:    movq $1, foo(%rip)
5527; O1-NEXT:    retq
5528;
5529; O2-LABEL: atomic32_or_monotonic:
5530; O2:       # %bb.0: # %entry
5531; O2-NEXT:    movq foo(%rip), %rax
5532; O2-NEXT:  .Lpcsection195:
5533; O2-NEXT:    lock orl $42, (%rdi)
5534; O2-NEXT:    movq $1, foo(%rip)
5535; O2-NEXT:    retq
5536;
5537; O3-LABEL: atomic32_or_monotonic:
5538; O3:       # %bb.0: # %entry
5539; O3-NEXT:    movq foo(%rip), %rax
5540; O3-NEXT:  .Lpcsection195:
5541; O3-NEXT:    lock orl $42, (%rdi)
5542; O3-NEXT:    movq $1, foo(%rip)
5543; O3-NEXT:    retq
5544entry:
5545  load volatile i64, ptr @foo, align 8
5546  %x = atomicrmw or ptr %a, i32 42 monotonic, align 4, !pcsections !0
5547  store volatile i64 1, ptr @foo, align 8
5548  ret void
5549}
5550
5551define void @atomic32_xor_monotonic(ptr %a) {
5552; O0-LABEL: atomic32_xor_monotonic:
5553; O0:       # %bb.0: # %entry
5554; O0-NEXT:    movq foo(%rip), %rax
5555; O0-NEXT:  .Lpcsection221:
5556; O0-NEXT:    lock xorl $42, (%rdi)
5557; O0-NEXT:    movq $1, foo
5558; O0-NEXT:    retq
5559;
5560; O1-LABEL: atomic32_xor_monotonic:
5561; O1:       # %bb.0: # %entry
5562; O1-NEXT:    movq foo(%rip), %rax
5563; O1-NEXT:  .Lpcsection196:
5564; O1-NEXT:    lock xorl $42, (%rdi)
5565; O1-NEXT:    movq $1, foo(%rip)
5566; O1-NEXT:    retq
5567;
5568; O2-LABEL: atomic32_xor_monotonic:
5569; O2:       # %bb.0: # %entry
5570; O2-NEXT:    movq foo(%rip), %rax
5571; O2-NEXT:  .Lpcsection196:
5572; O2-NEXT:    lock xorl $42, (%rdi)
5573; O2-NEXT:    movq $1, foo(%rip)
5574; O2-NEXT:    retq
5575;
5576; O3-LABEL: atomic32_xor_monotonic:
5577; O3:       # %bb.0: # %entry
5578; O3-NEXT:    movq foo(%rip), %rax
5579; O3-NEXT:  .Lpcsection196:
5580; O3-NEXT:    lock xorl $42, (%rdi)
5581; O3-NEXT:    movq $1, foo(%rip)
5582; O3-NEXT:    retq
5583entry:
5584  load volatile i64, ptr @foo, align 8
5585  %x = atomicrmw xor ptr %a, i32 42 monotonic, align 4, !pcsections !0
5586  store volatile i64 1, ptr @foo, align 8
5587  ret void
5588}
5589
5590define void @atomic32_nand_monotonic(ptr %a) {
5591; O0-LABEL: atomic32_nand_monotonic:
5592; O0:       # %bb.0: # %entry
5593; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
5594; O0-NEXT:    movq foo, %rax
5595; O0-NEXT:  .Lpcsection222:
5596; O0-NEXT:    movl (%rdi), %eax
5597; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
5598; O0-NEXT:  .LBB112_1: # %atomicrmw.start
5599; O0-NEXT:    # =>This Inner Loop Header: Depth=1
5600; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
5601; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
5602; O0-NEXT:    movl %eax, %edx
5603; O0-NEXT:  .Lpcsection223:
5604; O0-NEXT:    notl %edx
5605; O0-NEXT:  .Lpcsection224:
5606; O0-NEXT:    orl $-43, %edx
5607; O0-NEXT:  .Lpcsection225:
5608; O0-NEXT:    lock cmpxchgl %edx, (%rcx)
5609; O0-NEXT:  .Lpcsection226:
5610; O0-NEXT:    sete %cl
5611; O0-NEXT:  .Lpcsection227:
5612; O0-NEXT:    testb $1, %cl
5613; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
5614; O0-NEXT:  .Lpcsection228:
5615; O0-NEXT:    jne .LBB112_2
5616; O0-NEXT:    jmp .LBB112_1
5617; O0-NEXT:  .LBB112_2: # %atomicrmw.end
5618; O0-NEXT:    movq $1, foo
5619; O0-NEXT:    retq
5620;
5621; O1-LABEL: atomic32_nand_monotonic:
5622; O1:       # %bb.0: # %entry
5623; O1-NEXT:    movq foo(%rip), %rax
5624; O1-NEXT:  .Lpcsection197:
5625; O1-NEXT:    movl (%rdi), %eax
5626; O1-NEXT:    .p2align 4
5627; O1-NEXT:  .LBB112_1: # %atomicrmw.start
5628; O1-NEXT:    # =>This Inner Loop Header: Depth=1
5629; O1-NEXT:    movl %eax, %ecx
5630; O1-NEXT:  .Lpcsection198:
5631; O1-NEXT:    notl %ecx
5632; O1-NEXT:  .Lpcsection199:
5633; O1-NEXT:    orl $-43, %ecx
5634; O1-NEXT:  .Lpcsection200:
5635; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
5636; O1-NEXT:  .Lpcsection201:
5637; O1-NEXT:    jne .LBB112_1
5638; O1-NEXT:  # %bb.2: # %atomicrmw.end
5639; O1-NEXT:    movq $1, foo(%rip)
5640; O1-NEXT:    retq
5641;
5642; O2-LABEL: atomic32_nand_monotonic:
5643; O2:       # %bb.0: # %entry
5644; O2-NEXT:    movq foo(%rip), %rax
5645; O2-NEXT:  .Lpcsection197:
5646; O2-NEXT:    movl (%rdi), %eax
5647; O2-NEXT:    .p2align 4
5648; O2-NEXT:  .LBB112_1: # %atomicrmw.start
5649; O2-NEXT:    # =>This Inner Loop Header: Depth=1
5650; O2-NEXT:    movl %eax, %ecx
5651; O2-NEXT:  .Lpcsection198:
5652; O2-NEXT:    notl %ecx
5653; O2-NEXT:  .Lpcsection199:
5654; O2-NEXT:    orl $-43, %ecx
5655; O2-NEXT:  .Lpcsection200:
5656; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
5657; O2-NEXT:  .Lpcsection201:
5658; O2-NEXT:    jne .LBB112_1
5659; O2-NEXT:  # %bb.2: # %atomicrmw.end
5660; O2-NEXT:    movq $1, foo(%rip)
5661; O2-NEXT:    retq
5662;
5663; O3-LABEL: atomic32_nand_monotonic:
5664; O3:       # %bb.0: # %entry
5665; O3-NEXT:    movq foo(%rip), %rax
5666; O3-NEXT:  .Lpcsection197:
5667; O3-NEXT:    movl (%rdi), %eax
5668; O3-NEXT:    .p2align 4
5669; O3-NEXT:  .LBB112_1: # %atomicrmw.start
5670; O3-NEXT:    # =>This Inner Loop Header: Depth=1
5671; O3-NEXT:    movl %eax, %ecx
5672; O3-NEXT:  .Lpcsection198:
5673; O3-NEXT:    notl %ecx
5674; O3-NEXT:  .Lpcsection199:
5675; O3-NEXT:    orl $-43, %ecx
5676; O3-NEXT:  .Lpcsection200:
5677; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
5678; O3-NEXT:  .Lpcsection201:
5679; O3-NEXT:    jne .LBB112_1
5680; O3-NEXT:  # %bb.2: # %atomicrmw.end
5681; O3-NEXT:    movq $1, foo(%rip)
5682; O3-NEXT:    retq
5683entry:
5684  load volatile i64, ptr @foo, align 8
5685  %x = atomicrmw nand ptr %a, i32 42 monotonic, align 4, !pcsections !0
5686  store volatile i64 1, ptr @foo, align 8
5687  ret void
5688}
5689
5690define void @atomic32_xchg_acquire(ptr %a) {
5691; O0-LABEL: atomic32_xchg_acquire:
5692; O0:       # %bb.0: # %entry
5693; O0-NEXT:    movq foo(%rip), %rax
5694; O0-NEXT:    movl $42, %eax
5695; O0-NEXT:  .Lpcsection229:
5696; O0-NEXT:    xchgl %eax, (%rdi)
5697; O0-NEXT:    movq $1, foo
5698; O0-NEXT:    retq
5699;
5700; O1-LABEL: atomic32_xchg_acquire:
5701; O1:       # %bb.0: # %entry
5702; O1-NEXT:    movq foo(%rip), %rax
5703; O1-NEXT:    movl $42, %eax
5704; O1-NEXT:  .Lpcsection202:
5705; O1-NEXT:    xchgl %eax, (%rdi)
5706; O1-NEXT:    movq $1, foo(%rip)
5707; O1-NEXT:    retq
5708;
5709; O2-LABEL: atomic32_xchg_acquire:
5710; O2:       # %bb.0: # %entry
5711; O2-NEXT:    movq foo(%rip), %rax
5712; O2-NEXT:    movl $42, %eax
5713; O2-NEXT:  .Lpcsection202:
5714; O2-NEXT:    xchgl %eax, (%rdi)
5715; O2-NEXT:    movq $1, foo(%rip)
5716; O2-NEXT:    retq
5717;
5718; O3-LABEL: atomic32_xchg_acquire:
5719; O3:       # %bb.0: # %entry
5720; O3-NEXT:    movq foo(%rip), %rax
5721; O3-NEXT:    movl $42, %eax
5722; O3-NEXT:  .Lpcsection202:
5723; O3-NEXT:    xchgl %eax, (%rdi)
5724; O3-NEXT:    movq $1, foo(%rip)
5725; O3-NEXT:    retq
5726entry:
5727  load volatile i64, ptr @foo, align 8
5728  %x = atomicrmw xchg ptr %a, i32 42 acquire, align 4, !pcsections !0
5729  store volatile i64 1, ptr @foo, align 8
5730  ret void
5731}
5732
5733define void @atomic32_add_acquire(ptr %a) {
5734; O0-LABEL: atomic32_add_acquire:
5735; O0:       # %bb.0: # %entry
5736; O0-NEXT:    movq foo(%rip), %rax
5737; O0-NEXT:  .Lpcsection230:
5738; O0-NEXT:    lock addl $42, (%rdi)
5739; O0-NEXT:    movq $1, foo
5740; O0-NEXT:    retq
5741;
5742; O1-LABEL: atomic32_add_acquire:
5743; O1:       # %bb.0: # %entry
5744; O1-NEXT:    movq foo(%rip), %rax
5745; O1-NEXT:  .Lpcsection203:
5746; O1-NEXT:    lock addl $42, (%rdi)
5747; O1-NEXT:    movq $1, foo(%rip)
5748; O1-NEXT:    retq
5749;
5750; O2-LABEL: atomic32_add_acquire:
5751; O2:       # %bb.0: # %entry
5752; O2-NEXT:    movq foo(%rip), %rax
5753; O2-NEXT:  .Lpcsection203:
5754; O2-NEXT:    lock addl $42, (%rdi)
5755; O2-NEXT:    movq $1, foo(%rip)
5756; O2-NEXT:    retq
5757;
5758; O3-LABEL: atomic32_add_acquire:
5759; O3:       # %bb.0: # %entry
5760; O3-NEXT:    movq foo(%rip), %rax
5761; O3-NEXT:  .Lpcsection203:
5762; O3-NEXT:    lock addl $42, (%rdi)
5763; O3-NEXT:    movq $1, foo(%rip)
5764; O3-NEXT:    retq
5765entry:
5766  load volatile i64, ptr @foo, align 8
5767  %x = atomicrmw add ptr %a, i32 42 acquire, align 4, !pcsections !0
5768  store volatile i64 1, ptr @foo, align 8
5769  ret void
5770}
5771
5772define void @atomic32_sub_acquire(ptr %a) {
5773; O0-LABEL: atomic32_sub_acquire:
5774; O0:       # %bb.0: # %entry
5775; O0-NEXT:    movq foo(%rip), %rax
5776; O0-NEXT:  .Lpcsection231:
5777; O0-NEXT:    lock subl $42, (%rdi)
5778; O0-NEXT:    movq $1, foo
5779; O0-NEXT:    retq
5780;
5781; O1-LABEL: atomic32_sub_acquire:
5782; O1:       # %bb.0: # %entry
5783; O1-NEXT:    movq foo(%rip), %rax
5784; O1-NEXT:  .Lpcsection204:
5785; O1-NEXT:    lock subl $42, (%rdi)
5786; O1-NEXT:    movq $1, foo(%rip)
5787; O1-NEXT:    retq
5788;
5789; O2-LABEL: atomic32_sub_acquire:
5790; O2:       # %bb.0: # %entry
5791; O2-NEXT:    movq foo(%rip), %rax
5792; O2-NEXT:  .Lpcsection204:
5793; O2-NEXT:    lock subl $42, (%rdi)
5794; O2-NEXT:    movq $1, foo(%rip)
5795; O2-NEXT:    retq
5796;
5797; O3-LABEL: atomic32_sub_acquire:
5798; O3:       # %bb.0: # %entry
5799; O3-NEXT:    movq foo(%rip), %rax
5800; O3-NEXT:  .Lpcsection204:
5801; O3-NEXT:    lock subl $42, (%rdi)
5802; O3-NEXT:    movq $1, foo(%rip)
5803; O3-NEXT:    retq
5804entry:
5805  load volatile i64, ptr @foo, align 8
5806  %x = atomicrmw sub ptr %a, i32 42 acquire, align 4, !pcsections !0
5807  store volatile i64 1, ptr @foo, align 8
5808  ret void
5809}
5810
5811define void @atomic32_and_acquire(ptr %a) {
5812; O0-LABEL: atomic32_and_acquire:
5813; O0:       # %bb.0: # %entry
5814; O0-NEXT:    movq foo(%rip), %rax
5815; O0-NEXT:  .Lpcsection232:
5816; O0-NEXT:    lock andl $42, (%rdi)
5817; O0-NEXT:    movq $1, foo
5818; O0-NEXT:    retq
5819;
5820; O1-LABEL: atomic32_and_acquire:
5821; O1:       # %bb.0: # %entry
5822; O1-NEXT:    movq foo(%rip), %rax
5823; O1-NEXT:  .Lpcsection205:
5824; O1-NEXT:    lock andl $42, (%rdi)
5825; O1-NEXT:    movq $1, foo(%rip)
5826; O1-NEXT:    retq
5827;
5828; O2-LABEL: atomic32_and_acquire:
5829; O2:       # %bb.0: # %entry
5830; O2-NEXT:    movq foo(%rip), %rax
5831; O2-NEXT:  .Lpcsection205:
5832; O2-NEXT:    lock andl $42, (%rdi)
5833; O2-NEXT:    movq $1, foo(%rip)
5834; O2-NEXT:    retq
5835;
5836; O3-LABEL: atomic32_and_acquire:
5837; O3:       # %bb.0: # %entry
5838; O3-NEXT:    movq foo(%rip), %rax
5839; O3-NEXT:  .Lpcsection205:
5840; O3-NEXT:    lock andl $42, (%rdi)
5841; O3-NEXT:    movq $1, foo(%rip)
5842; O3-NEXT:    retq
5843entry:
5844  load volatile i64, ptr @foo, align 8
5845  %x = atomicrmw and ptr %a, i32 42 acquire, align 4, !pcsections !0
5846  store volatile i64 1, ptr @foo, align 8
5847  ret void
5848}
5849
5850define void @atomic32_or_acquire(ptr %a) {
5851; O0-LABEL: atomic32_or_acquire:
5852; O0:       # %bb.0: # %entry
5853; O0-NEXT:    movq foo(%rip), %rax
5854; O0-NEXT:  .Lpcsection233:
5855; O0-NEXT:    lock orl $42, (%rdi)
5856; O0-NEXT:    movq $1, foo
5857; O0-NEXT:    retq
5858;
5859; O1-LABEL: atomic32_or_acquire:
5860; O1:       # %bb.0: # %entry
5861; O1-NEXT:    movq foo(%rip), %rax
5862; O1-NEXT:  .Lpcsection206:
5863; O1-NEXT:    lock orl $42, (%rdi)
5864; O1-NEXT:    movq $1, foo(%rip)
5865; O1-NEXT:    retq
5866;
5867; O2-LABEL: atomic32_or_acquire:
5868; O2:       # %bb.0: # %entry
5869; O2-NEXT:    movq foo(%rip), %rax
5870; O2-NEXT:  .Lpcsection206:
5871; O2-NEXT:    lock orl $42, (%rdi)
5872; O2-NEXT:    movq $1, foo(%rip)
5873; O2-NEXT:    retq
5874;
5875; O3-LABEL: atomic32_or_acquire:
5876; O3:       # %bb.0: # %entry
5877; O3-NEXT:    movq foo(%rip), %rax
5878; O3-NEXT:  .Lpcsection206:
5879; O3-NEXT:    lock orl $42, (%rdi)
5880; O3-NEXT:    movq $1, foo(%rip)
5881; O3-NEXT:    retq
5882entry:
5883  load volatile i64, ptr @foo, align 8
5884  %x = atomicrmw or ptr %a, i32 42 acquire, align 4, !pcsections !0
5885  store volatile i64 1, ptr @foo, align 8
5886  ret void
5887}
5888
5889define void @atomic32_xor_acquire(ptr %a) {
5890; O0-LABEL: atomic32_xor_acquire:
5891; O0:       # %bb.0: # %entry
5892; O0-NEXT:    movq foo(%rip), %rax
5893; O0-NEXT:  .Lpcsection234:
5894; O0-NEXT:    lock xorl $42, (%rdi)
5895; O0-NEXT:    movq $1, foo
5896; O0-NEXT:    retq
5897;
5898; O1-LABEL: atomic32_xor_acquire:
5899; O1:       # %bb.0: # %entry
5900; O1-NEXT:    movq foo(%rip), %rax
5901; O1-NEXT:  .Lpcsection207:
5902; O1-NEXT:    lock xorl $42, (%rdi)
5903; O1-NEXT:    movq $1, foo(%rip)
5904; O1-NEXT:    retq
5905;
5906; O2-LABEL: atomic32_xor_acquire:
5907; O2:       # %bb.0: # %entry
5908; O2-NEXT:    movq foo(%rip), %rax
5909; O2-NEXT:  .Lpcsection207:
5910; O2-NEXT:    lock xorl $42, (%rdi)
5911; O2-NEXT:    movq $1, foo(%rip)
5912; O2-NEXT:    retq
5913;
5914; O3-LABEL: atomic32_xor_acquire:
5915; O3:       # %bb.0: # %entry
5916; O3-NEXT:    movq foo(%rip), %rax
5917; O3-NEXT:  .Lpcsection207:
5918; O3-NEXT:    lock xorl $42, (%rdi)
5919; O3-NEXT:    movq $1, foo(%rip)
5920; O3-NEXT:    retq
5921entry:
5922  load volatile i64, ptr @foo, align 8
5923  %x = atomicrmw xor ptr %a, i32 42 acquire, align 4, !pcsections !0
5924  store volatile i64 1, ptr @foo, align 8
5925  ret void
5926}
5927
5928define void @atomic32_nand_acquire(ptr %a) {
5929; O0-LABEL: atomic32_nand_acquire:
5930; O0:       # %bb.0: # %entry
5931; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
5932; O0-NEXT:    movq foo, %rax
5933; O0-NEXT:  .Lpcsection235:
5934; O0-NEXT:    movl (%rdi), %eax
5935; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
5936; O0-NEXT:  .LBB119_1: # %atomicrmw.start
5937; O0-NEXT:    # =>This Inner Loop Header: Depth=1
5938; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
5939; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
5940; O0-NEXT:    movl %eax, %edx
5941; O0-NEXT:  .Lpcsection236:
5942; O0-NEXT:    notl %edx
5943; O0-NEXT:  .Lpcsection237:
5944; O0-NEXT:    orl $-43, %edx
5945; O0-NEXT:  .Lpcsection238:
5946; O0-NEXT:    lock cmpxchgl %edx, (%rcx)
5947; O0-NEXT:  .Lpcsection239:
5948; O0-NEXT:    sete %cl
5949; O0-NEXT:  .Lpcsection240:
5950; O0-NEXT:    testb $1, %cl
5951; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
5952; O0-NEXT:  .Lpcsection241:
5953; O0-NEXT:    jne .LBB119_2
5954; O0-NEXT:    jmp .LBB119_1
5955; O0-NEXT:  .LBB119_2: # %atomicrmw.end
5956; O0-NEXT:    movq $1, foo
5957; O0-NEXT:    retq
5958;
5959; O1-LABEL: atomic32_nand_acquire:
5960; O1:       # %bb.0: # %entry
5961; O1-NEXT:    movq foo(%rip), %rax
5962; O1-NEXT:  .Lpcsection208:
5963; O1-NEXT:    movl (%rdi), %eax
5964; O1-NEXT:    .p2align 4
5965; O1-NEXT:  .LBB119_1: # %atomicrmw.start
5966; O1-NEXT:    # =>This Inner Loop Header: Depth=1
5967; O1-NEXT:    movl %eax, %ecx
5968; O1-NEXT:  .Lpcsection209:
5969; O1-NEXT:    notl %ecx
5970; O1-NEXT:  .Lpcsection210:
5971; O1-NEXT:    orl $-43, %ecx
5972; O1-NEXT:  .Lpcsection211:
5973; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
5974; O1-NEXT:  .Lpcsection212:
5975; O1-NEXT:    jne .LBB119_1
5976; O1-NEXT:  # %bb.2: # %atomicrmw.end
5977; O1-NEXT:    movq $1, foo(%rip)
5978; O1-NEXT:    retq
5979;
5980; O2-LABEL: atomic32_nand_acquire:
5981; O2:       # %bb.0: # %entry
5982; O2-NEXT:    movq foo(%rip), %rax
5983; O2-NEXT:  .Lpcsection208:
5984; O2-NEXT:    movl (%rdi), %eax
5985; O2-NEXT:    .p2align 4
5986; O2-NEXT:  .LBB119_1: # %atomicrmw.start
5987; O2-NEXT:    # =>This Inner Loop Header: Depth=1
5988; O2-NEXT:    movl %eax, %ecx
5989; O2-NEXT:  .Lpcsection209:
5990; O2-NEXT:    notl %ecx
5991; O2-NEXT:  .Lpcsection210:
5992; O2-NEXT:    orl $-43, %ecx
5993; O2-NEXT:  .Lpcsection211:
5994; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
5995; O2-NEXT:  .Lpcsection212:
5996; O2-NEXT:    jne .LBB119_1
5997; O2-NEXT:  # %bb.2: # %atomicrmw.end
5998; O2-NEXT:    movq $1, foo(%rip)
5999; O2-NEXT:    retq
6000;
6001; O3-LABEL: atomic32_nand_acquire:
6002; O3:       # %bb.0: # %entry
6003; O3-NEXT:    movq foo(%rip), %rax
6004; O3-NEXT:  .Lpcsection208:
6005; O3-NEXT:    movl (%rdi), %eax
6006; O3-NEXT:    .p2align 4
6007; O3-NEXT:  .LBB119_1: # %atomicrmw.start
6008; O3-NEXT:    # =>This Inner Loop Header: Depth=1
6009; O3-NEXT:    movl %eax, %ecx
6010; O3-NEXT:  .Lpcsection209:
6011; O3-NEXT:    notl %ecx
6012; O3-NEXT:  .Lpcsection210:
6013; O3-NEXT:    orl $-43, %ecx
6014; O3-NEXT:  .Lpcsection211:
6015; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
6016; O3-NEXT:  .Lpcsection212:
6017; O3-NEXT:    jne .LBB119_1
6018; O3-NEXT:  # %bb.2: # %atomicrmw.end
6019; O3-NEXT:    movq $1, foo(%rip)
6020; O3-NEXT:    retq
6021entry:
6022  load volatile i64, ptr @foo, align 8
6023  %x = atomicrmw nand ptr %a, i32 42 acquire, align 4, !pcsections !0
6024  store volatile i64 1, ptr @foo, align 8
6025  ret void
6026}
6027
6028define void @atomic32_xchg_release(ptr %a) {
6029; O0-LABEL: atomic32_xchg_release:
6030; O0:       # %bb.0: # %entry
6031; O0-NEXT:    movq foo(%rip), %rax
6032; O0-NEXT:    movl $42, %eax
6033; O0-NEXT:  .Lpcsection242:
6034; O0-NEXT:    xchgl %eax, (%rdi)
6035; O0-NEXT:    movq $1, foo
6036; O0-NEXT:    retq
6037;
6038; O1-LABEL: atomic32_xchg_release:
6039; O1:       # %bb.0: # %entry
6040; O1-NEXT:    movq foo(%rip), %rax
6041; O1-NEXT:    movl $42, %eax
6042; O1-NEXT:  .Lpcsection213:
6043; O1-NEXT:    xchgl %eax, (%rdi)
6044; O1-NEXT:    movq $1, foo(%rip)
6045; O1-NEXT:    retq
6046;
6047; O2-LABEL: atomic32_xchg_release:
6048; O2:       # %bb.0: # %entry
6049; O2-NEXT:    movq foo(%rip), %rax
6050; O2-NEXT:    movl $42, %eax
6051; O2-NEXT:  .Lpcsection213:
6052; O2-NEXT:    xchgl %eax, (%rdi)
6053; O2-NEXT:    movq $1, foo(%rip)
6054; O2-NEXT:    retq
6055;
6056; O3-LABEL: atomic32_xchg_release:
6057; O3:       # %bb.0: # %entry
6058; O3-NEXT:    movq foo(%rip), %rax
6059; O3-NEXT:    movl $42, %eax
6060; O3-NEXT:  .Lpcsection213:
6061; O3-NEXT:    xchgl %eax, (%rdi)
6062; O3-NEXT:    movq $1, foo(%rip)
6063; O3-NEXT:    retq
6064entry:
6065  load volatile i64, ptr @foo, align 8
6066  %x = atomicrmw xchg ptr %a, i32 42 release, align 4, !pcsections !0
6067  store volatile i64 1, ptr @foo, align 8
6068  ret void
6069}
6070
6071define void @atomic32_add_release(ptr %a) {
6072; O0-LABEL: atomic32_add_release:
6073; O0:       # %bb.0: # %entry
6074; O0-NEXT:    movq foo(%rip), %rax
6075; O0-NEXT:  .Lpcsection243:
6076; O0-NEXT:    lock addl $42, (%rdi)
6077; O0-NEXT:    movq $1, foo
6078; O0-NEXT:    retq
6079;
6080; O1-LABEL: atomic32_add_release:
6081; O1:       # %bb.0: # %entry
6082; O1-NEXT:    movq foo(%rip), %rax
6083; O1-NEXT:  .Lpcsection214:
6084; O1-NEXT:    lock addl $42, (%rdi)
6085; O1-NEXT:    movq $1, foo(%rip)
6086; O1-NEXT:    retq
6087;
6088; O2-LABEL: atomic32_add_release:
6089; O2:       # %bb.0: # %entry
6090; O2-NEXT:    movq foo(%rip), %rax
6091; O2-NEXT:  .Lpcsection214:
6092; O2-NEXT:    lock addl $42, (%rdi)
6093; O2-NEXT:    movq $1, foo(%rip)
6094; O2-NEXT:    retq
6095;
6096; O3-LABEL: atomic32_add_release:
6097; O3:       # %bb.0: # %entry
6098; O3-NEXT:    movq foo(%rip), %rax
6099; O3-NEXT:  .Lpcsection214:
6100; O3-NEXT:    lock addl $42, (%rdi)
6101; O3-NEXT:    movq $1, foo(%rip)
6102; O3-NEXT:    retq
6103entry:
6104  load volatile i64, ptr @foo, align 8
6105  %x = atomicrmw add ptr %a, i32 42 release, align 4, !pcsections !0
6106  store volatile i64 1, ptr @foo, align 8
6107  ret void
6108}
6109
6110define void @atomic32_sub_release(ptr %a) {
6111; O0-LABEL: atomic32_sub_release:
6112; O0:       # %bb.0: # %entry
6113; O0-NEXT:    movq foo(%rip), %rax
6114; O0-NEXT:  .Lpcsection244:
6115; O0-NEXT:    lock subl $42, (%rdi)
6116; O0-NEXT:    movq $1, foo
6117; O0-NEXT:    retq
6118;
6119; O1-LABEL: atomic32_sub_release:
6120; O1:       # %bb.0: # %entry
6121; O1-NEXT:    movq foo(%rip), %rax
6122; O1-NEXT:  .Lpcsection215:
6123; O1-NEXT:    lock subl $42, (%rdi)
6124; O1-NEXT:    movq $1, foo(%rip)
6125; O1-NEXT:    retq
6126;
6127; O2-LABEL: atomic32_sub_release:
6128; O2:       # %bb.0: # %entry
6129; O2-NEXT:    movq foo(%rip), %rax
6130; O2-NEXT:  .Lpcsection215:
6131; O2-NEXT:    lock subl $42, (%rdi)
6132; O2-NEXT:    movq $1, foo(%rip)
6133; O2-NEXT:    retq
6134;
6135; O3-LABEL: atomic32_sub_release:
6136; O3:       # %bb.0: # %entry
6137; O3-NEXT:    movq foo(%rip), %rax
6138; O3-NEXT:  .Lpcsection215:
6139; O3-NEXT:    lock subl $42, (%rdi)
6140; O3-NEXT:    movq $1, foo(%rip)
6141; O3-NEXT:    retq
6142entry:
6143  load volatile i64, ptr @foo, align 8
6144  %x = atomicrmw sub ptr %a, i32 42 release, align 4, !pcsections !0
6145  store volatile i64 1, ptr @foo, align 8
6146  ret void
6147}
6148
6149define void @atomic32_and_release(ptr %a) {
6150; O0-LABEL: atomic32_and_release:
6151; O0:       # %bb.0: # %entry
6152; O0-NEXT:    movq foo(%rip), %rax
6153; O0-NEXT:  .Lpcsection245:
6154; O0-NEXT:    lock andl $42, (%rdi)
6155; O0-NEXT:    movq $1, foo
6156; O0-NEXT:    retq
6157;
6158; O1-LABEL: atomic32_and_release:
6159; O1:       # %bb.0: # %entry
6160; O1-NEXT:    movq foo(%rip), %rax
6161; O1-NEXT:  .Lpcsection216:
6162; O1-NEXT:    lock andl $42, (%rdi)
6163; O1-NEXT:    movq $1, foo(%rip)
6164; O1-NEXT:    retq
6165;
6166; O2-LABEL: atomic32_and_release:
6167; O2:       # %bb.0: # %entry
6168; O2-NEXT:    movq foo(%rip), %rax
6169; O2-NEXT:  .Lpcsection216:
6170; O2-NEXT:    lock andl $42, (%rdi)
6171; O2-NEXT:    movq $1, foo(%rip)
6172; O2-NEXT:    retq
6173;
6174; O3-LABEL: atomic32_and_release:
6175; O3:       # %bb.0: # %entry
6176; O3-NEXT:    movq foo(%rip), %rax
6177; O3-NEXT:  .Lpcsection216:
6178; O3-NEXT:    lock andl $42, (%rdi)
6179; O3-NEXT:    movq $1, foo(%rip)
6180; O3-NEXT:    retq
6181entry:
6182  load volatile i64, ptr @foo, align 8
6183  %x = atomicrmw and ptr %a, i32 42 release, align 4, !pcsections !0
6184  store volatile i64 1, ptr @foo, align 8
6185  ret void
6186}
6187
6188define void @atomic32_or_release(ptr %a) {
6189; O0-LABEL: atomic32_or_release:
6190; O0:       # %bb.0: # %entry
6191; O0-NEXT:    movq foo(%rip), %rax
6192; O0-NEXT:  .Lpcsection246:
6193; O0-NEXT:    lock orl $42, (%rdi)
6194; O0-NEXT:    movq $1, foo
6195; O0-NEXT:    retq
6196;
6197; O1-LABEL: atomic32_or_release:
6198; O1:       # %bb.0: # %entry
6199; O1-NEXT:    movq foo(%rip), %rax
6200; O1-NEXT:  .Lpcsection217:
6201; O1-NEXT:    lock orl $42, (%rdi)
6202; O1-NEXT:    movq $1, foo(%rip)
6203; O1-NEXT:    retq
6204;
6205; O2-LABEL: atomic32_or_release:
6206; O2:       # %bb.0: # %entry
6207; O2-NEXT:    movq foo(%rip), %rax
6208; O2-NEXT:  .Lpcsection217:
6209; O2-NEXT:    lock orl $42, (%rdi)
6210; O2-NEXT:    movq $1, foo(%rip)
6211; O2-NEXT:    retq
6212;
6213; O3-LABEL: atomic32_or_release:
6214; O3:       # %bb.0: # %entry
6215; O3-NEXT:    movq foo(%rip), %rax
6216; O3-NEXT:  .Lpcsection217:
6217; O3-NEXT:    lock orl $42, (%rdi)
6218; O3-NEXT:    movq $1, foo(%rip)
6219; O3-NEXT:    retq
6220entry:
6221  load volatile i64, ptr @foo, align 8
6222  %x = atomicrmw or ptr %a, i32 42 release, align 4, !pcsections !0
6223  store volatile i64 1, ptr @foo, align 8
6224  ret void
6225}
6226
6227define void @atomic32_xor_release(ptr %a) {
6228; O0-LABEL: atomic32_xor_release:
6229; O0:       # %bb.0: # %entry
6230; O0-NEXT:    movq foo(%rip), %rax
6231; O0-NEXT:  .Lpcsection247:
6232; O0-NEXT:    lock xorl $42, (%rdi)
6233; O0-NEXT:    movq $1, foo
6234; O0-NEXT:    retq
6235;
6236; O1-LABEL: atomic32_xor_release:
6237; O1:       # %bb.0: # %entry
6238; O1-NEXT:    movq foo(%rip), %rax
6239; O1-NEXT:  .Lpcsection218:
6240; O1-NEXT:    lock xorl $42, (%rdi)
6241; O1-NEXT:    movq $1, foo(%rip)
6242; O1-NEXT:    retq
6243;
6244; O2-LABEL: atomic32_xor_release:
6245; O2:       # %bb.0: # %entry
6246; O2-NEXT:    movq foo(%rip), %rax
6247; O2-NEXT:  .Lpcsection218:
6248; O2-NEXT:    lock xorl $42, (%rdi)
6249; O2-NEXT:    movq $1, foo(%rip)
6250; O2-NEXT:    retq
6251;
6252; O3-LABEL: atomic32_xor_release:
6253; O3:       # %bb.0: # %entry
6254; O3-NEXT:    movq foo(%rip), %rax
6255; O3-NEXT:  .Lpcsection218:
6256; O3-NEXT:    lock xorl $42, (%rdi)
6257; O3-NEXT:    movq $1, foo(%rip)
6258; O3-NEXT:    retq
6259entry:
6260  load volatile i64, ptr @foo, align 8
6261  %x = atomicrmw xor ptr %a, i32 42 release, align 4, !pcsections !0
6262  store volatile i64 1, ptr @foo, align 8
6263  ret void
6264}
6265
6266define void @atomic32_nand_release(ptr %a) {
6267; O0-LABEL: atomic32_nand_release:
6268; O0:       # %bb.0: # %entry
6269; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
6270; O0-NEXT:    movq foo, %rax
6271; O0-NEXT:  .Lpcsection248:
6272; O0-NEXT:    movl (%rdi), %eax
6273; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6274; O0-NEXT:  .LBB126_1: # %atomicrmw.start
6275; O0-NEXT:    # =>This Inner Loop Header: Depth=1
6276; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
6277; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
6278; O0-NEXT:    movl %eax, %edx
6279; O0-NEXT:  .Lpcsection249:
6280; O0-NEXT:    notl %edx
6281; O0-NEXT:  .Lpcsection250:
6282; O0-NEXT:    orl $-43, %edx
6283; O0-NEXT:  .Lpcsection251:
6284; O0-NEXT:    lock cmpxchgl %edx, (%rcx)
6285; O0-NEXT:  .Lpcsection252:
6286; O0-NEXT:    sete %cl
6287; O0-NEXT:  .Lpcsection253:
6288; O0-NEXT:    testb $1, %cl
6289; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6290; O0-NEXT:  .Lpcsection254:
6291; O0-NEXT:    jne .LBB126_2
6292; O0-NEXT:    jmp .LBB126_1
6293; O0-NEXT:  .LBB126_2: # %atomicrmw.end
6294; O0-NEXT:    movq $1, foo
6295; O0-NEXT:    retq
6296;
6297; O1-LABEL: atomic32_nand_release:
6298; O1:       # %bb.0: # %entry
6299; O1-NEXT:    movq foo(%rip), %rax
6300; O1-NEXT:  .Lpcsection219:
6301; O1-NEXT:    movl (%rdi), %eax
6302; O1-NEXT:    .p2align 4
6303; O1-NEXT:  .LBB126_1: # %atomicrmw.start
6304; O1-NEXT:    # =>This Inner Loop Header: Depth=1
6305; O1-NEXT:    movl %eax, %ecx
6306; O1-NEXT:  .Lpcsection220:
6307; O1-NEXT:    notl %ecx
6308; O1-NEXT:  .Lpcsection221:
6309; O1-NEXT:    orl $-43, %ecx
6310; O1-NEXT:  .Lpcsection222:
6311; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
6312; O1-NEXT:  .Lpcsection223:
6313; O1-NEXT:    jne .LBB126_1
6314; O1-NEXT:  # %bb.2: # %atomicrmw.end
6315; O1-NEXT:    movq $1, foo(%rip)
6316; O1-NEXT:    retq
6317;
6318; O2-LABEL: atomic32_nand_release:
6319; O2:       # %bb.0: # %entry
6320; O2-NEXT:    movq foo(%rip), %rax
6321; O2-NEXT:  .Lpcsection219:
6322; O2-NEXT:    movl (%rdi), %eax
6323; O2-NEXT:    .p2align 4
6324; O2-NEXT:  .LBB126_1: # %atomicrmw.start
6325; O2-NEXT:    # =>This Inner Loop Header: Depth=1
6326; O2-NEXT:    movl %eax, %ecx
6327; O2-NEXT:  .Lpcsection220:
6328; O2-NEXT:    notl %ecx
6329; O2-NEXT:  .Lpcsection221:
6330; O2-NEXT:    orl $-43, %ecx
6331; O2-NEXT:  .Lpcsection222:
6332; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
6333; O2-NEXT:  .Lpcsection223:
6334; O2-NEXT:    jne .LBB126_1
6335; O2-NEXT:  # %bb.2: # %atomicrmw.end
6336; O2-NEXT:    movq $1, foo(%rip)
6337; O2-NEXT:    retq
6338;
6339; O3-LABEL: atomic32_nand_release:
6340; O3:       # %bb.0: # %entry
6341; O3-NEXT:    movq foo(%rip), %rax
6342; O3-NEXT:  .Lpcsection219:
6343; O3-NEXT:    movl (%rdi), %eax
6344; O3-NEXT:    .p2align 4
6345; O3-NEXT:  .LBB126_1: # %atomicrmw.start
6346; O3-NEXT:    # =>This Inner Loop Header: Depth=1
6347; O3-NEXT:    movl %eax, %ecx
6348; O3-NEXT:  .Lpcsection220:
6349; O3-NEXT:    notl %ecx
6350; O3-NEXT:  .Lpcsection221:
6351; O3-NEXT:    orl $-43, %ecx
6352; O3-NEXT:  .Lpcsection222:
6353; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
6354; O3-NEXT:  .Lpcsection223:
6355; O3-NEXT:    jne .LBB126_1
6356; O3-NEXT:  # %bb.2: # %atomicrmw.end
6357; O3-NEXT:    movq $1, foo(%rip)
6358; O3-NEXT:    retq
6359entry:
6360  load volatile i64, ptr @foo, align 8
6361  %x = atomicrmw nand ptr %a, i32 42 release, align 4, !pcsections !0
6362  store volatile i64 1, ptr @foo, align 8
6363  ret void
6364}
6365
6366define void @atomic32_xchg_acq_rel(ptr %a) {
6367; O0-LABEL: atomic32_xchg_acq_rel:
6368; O0:       # %bb.0: # %entry
6369; O0-NEXT:    movq foo(%rip), %rax
6370; O0-NEXT:    movl $42, %eax
6371; O0-NEXT:  .Lpcsection255:
6372; O0-NEXT:    xchgl %eax, (%rdi)
6373; O0-NEXT:    movq $1, foo
6374; O0-NEXT:    retq
6375;
6376; O1-LABEL: atomic32_xchg_acq_rel:
6377; O1:       # %bb.0: # %entry
6378; O1-NEXT:    movq foo(%rip), %rax
6379; O1-NEXT:    movl $42, %eax
6380; O1-NEXT:  .Lpcsection224:
6381; O1-NEXT:    xchgl %eax, (%rdi)
6382; O1-NEXT:    movq $1, foo(%rip)
6383; O1-NEXT:    retq
6384;
6385; O2-LABEL: atomic32_xchg_acq_rel:
6386; O2:       # %bb.0: # %entry
6387; O2-NEXT:    movq foo(%rip), %rax
6388; O2-NEXT:    movl $42, %eax
6389; O2-NEXT:  .Lpcsection224:
6390; O2-NEXT:    xchgl %eax, (%rdi)
6391; O2-NEXT:    movq $1, foo(%rip)
6392; O2-NEXT:    retq
6393;
6394; O3-LABEL: atomic32_xchg_acq_rel:
6395; O3:       # %bb.0: # %entry
6396; O3-NEXT:    movq foo(%rip), %rax
6397; O3-NEXT:    movl $42, %eax
6398; O3-NEXT:  .Lpcsection224:
6399; O3-NEXT:    xchgl %eax, (%rdi)
6400; O3-NEXT:    movq $1, foo(%rip)
6401; O3-NEXT:    retq
6402entry:
6403  load volatile i64, ptr @foo, align 8
6404  %x = atomicrmw xchg ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6405  store volatile i64 1, ptr @foo, align 8
6406  ret void
6407}
6408
6409define void @atomic32_add_acq_rel(ptr %a) {
6410; O0-LABEL: atomic32_add_acq_rel:
6411; O0:       # %bb.0: # %entry
6412; O0-NEXT:    movq foo(%rip), %rax
6413; O0-NEXT:  .Lpcsection256:
6414; O0-NEXT:    lock addl $42, (%rdi)
6415; O0-NEXT:    movq $1, foo
6416; O0-NEXT:    retq
6417;
6418; O1-LABEL: atomic32_add_acq_rel:
6419; O1:       # %bb.0: # %entry
6420; O1-NEXT:    movq foo(%rip), %rax
6421; O1-NEXT:  .Lpcsection225:
6422; O1-NEXT:    lock addl $42, (%rdi)
6423; O1-NEXT:    movq $1, foo(%rip)
6424; O1-NEXT:    retq
6425;
6426; O2-LABEL: atomic32_add_acq_rel:
6427; O2:       # %bb.0: # %entry
6428; O2-NEXT:    movq foo(%rip), %rax
6429; O2-NEXT:  .Lpcsection225:
6430; O2-NEXT:    lock addl $42, (%rdi)
6431; O2-NEXT:    movq $1, foo(%rip)
6432; O2-NEXT:    retq
6433;
6434; O3-LABEL: atomic32_add_acq_rel:
6435; O3:       # %bb.0: # %entry
6436; O3-NEXT:    movq foo(%rip), %rax
6437; O3-NEXT:  .Lpcsection225:
6438; O3-NEXT:    lock addl $42, (%rdi)
6439; O3-NEXT:    movq $1, foo(%rip)
6440; O3-NEXT:    retq
6441entry:
6442  load volatile i64, ptr @foo, align 8
6443  %x = atomicrmw add ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6444  store volatile i64 1, ptr @foo, align 8
6445  ret void
6446}
6447
6448define void @atomic32_sub_acq_rel(ptr %a) {
6449; O0-LABEL: atomic32_sub_acq_rel:
6450; O0:       # %bb.0: # %entry
6451; O0-NEXT:    movq foo(%rip), %rax
6452; O0-NEXT:  .Lpcsection257:
6453; O0-NEXT:    lock subl $42, (%rdi)
6454; O0-NEXT:    movq $1, foo
6455; O0-NEXT:    retq
6456;
6457; O1-LABEL: atomic32_sub_acq_rel:
6458; O1:       # %bb.0: # %entry
6459; O1-NEXT:    movq foo(%rip), %rax
6460; O1-NEXT:  .Lpcsection226:
6461; O1-NEXT:    lock subl $42, (%rdi)
6462; O1-NEXT:    movq $1, foo(%rip)
6463; O1-NEXT:    retq
6464;
6465; O2-LABEL: atomic32_sub_acq_rel:
6466; O2:       # %bb.0: # %entry
6467; O2-NEXT:    movq foo(%rip), %rax
6468; O2-NEXT:  .Lpcsection226:
6469; O2-NEXT:    lock subl $42, (%rdi)
6470; O2-NEXT:    movq $1, foo(%rip)
6471; O2-NEXT:    retq
6472;
6473; O3-LABEL: atomic32_sub_acq_rel:
6474; O3:       # %bb.0: # %entry
6475; O3-NEXT:    movq foo(%rip), %rax
6476; O3-NEXT:  .Lpcsection226:
6477; O3-NEXT:    lock subl $42, (%rdi)
6478; O3-NEXT:    movq $1, foo(%rip)
6479; O3-NEXT:    retq
6480entry:
6481  load volatile i64, ptr @foo, align 8
6482  %x = atomicrmw sub ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6483  store volatile i64 1, ptr @foo, align 8
6484  ret void
6485}
6486
6487define void @atomic32_and_acq_rel(ptr %a) {
6488; O0-LABEL: atomic32_and_acq_rel:
6489; O0:       # %bb.0: # %entry
6490; O0-NEXT:    movq foo(%rip), %rax
6491; O0-NEXT:  .Lpcsection258:
6492; O0-NEXT:    lock andl $42, (%rdi)
6493; O0-NEXT:    movq $1, foo
6494; O0-NEXT:    retq
6495;
6496; O1-LABEL: atomic32_and_acq_rel:
6497; O1:       # %bb.0: # %entry
6498; O1-NEXT:    movq foo(%rip), %rax
6499; O1-NEXT:  .Lpcsection227:
6500; O1-NEXT:    lock andl $42, (%rdi)
6501; O1-NEXT:    movq $1, foo(%rip)
6502; O1-NEXT:    retq
6503;
6504; O2-LABEL: atomic32_and_acq_rel:
6505; O2:       # %bb.0: # %entry
6506; O2-NEXT:    movq foo(%rip), %rax
6507; O2-NEXT:  .Lpcsection227:
6508; O2-NEXT:    lock andl $42, (%rdi)
6509; O2-NEXT:    movq $1, foo(%rip)
6510; O2-NEXT:    retq
6511;
6512; O3-LABEL: atomic32_and_acq_rel:
6513; O3:       # %bb.0: # %entry
6514; O3-NEXT:    movq foo(%rip), %rax
6515; O3-NEXT:  .Lpcsection227:
6516; O3-NEXT:    lock andl $42, (%rdi)
6517; O3-NEXT:    movq $1, foo(%rip)
6518; O3-NEXT:    retq
6519entry:
6520  load volatile i64, ptr @foo, align 8
6521  %x = atomicrmw and ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6522  store volatile i64 1, ptr @foo, align 8
6523  ret void
6524}
6525
6526define void @atomic32_or_acq_rel(ptr %a) {
6527; O0-LABEL: atomic32_or_acq_rel:
6528; O0:       # %bb.0: # %entry
6529; O0-NEXT:    movq foo(%rip), %rax
6530; O0-NEXT:  .Lpcsection259:
6531; O0-NEXT:    lock orl $42, (%rdi)
6532; O0-NEXT:    movq $1, foo
6533; O0-NEXT:    retq
6534;
6535; O1-LABEL: atomic32_or_acq_rel:
6536; O1:       # %bb.0: # %entry
6537; O1-NEXT:    movq foo(%rip), %rax
6538; O1-NEXT:  .Lpcsection228:
6539; O1-NEXT:    lock orl $42, (%rdi)
6540; O1-NEXT:    movq $1, foo(%rip)
6541; O1-NEXT:    retq
6542;
6543; O2-LABEL: atomic32_or_acq_rel:
6544; O2:       # %bb.0: # %entry
6545; O2-NEXT:    movq foo(%rip), %rax
6546; O2-NEXT:  .Lpcsection228:
6547; O2-NEXT:    lock orl $42, (%rdi)
6548; O2-NEXT:    movq $1, foo(%rip)
6549; O2-NEXT:    retq
6550;
6551; O3-LABEL: atomic32_or_acq_rel:
6552; O3:       # %bb.0: # %entry
6553; O3-NEXT:    movq foo(%rip), %rax
6554; O3-NEXT:  .Lpcsection228:
6555; O3-NEXT:    lock orl $42, (%rdi)
6556; O3-NEXT:    movq $1, foo(%rip)
6557; O3-NEXT:    retq
6558entry:
6559  load volatile i64, ptr @foo, align 8
6560  %x = atomicrmw or ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6561  store volatile i64 1, ptr @foo, align 8
6562  ret void
6563}
6564
6565define void @atomic32_xor_acq_rel(ptr %a) {
6566; O0-LABEL: atomic32_xor_acq_rel:
6567; O0:       # %bb.0: # %entry
6568; O0-NEXT:    movq foo(%rip), %rax
6569; O0-NEXT:  .Lpcsection260:
6570; O0-NEXT:    lock xorl $42, (%rdi)
6571; O0-NEXT:    movq $1, foo
6572; O0-NEXT:    retq
6573;
6574; O1-LABEL: atomic32_xor_acq_rel:
6575; O1:       # %bb.0: # %entry
6576; O1-NEXT:    movq foo(%rip), %rax
6577; O1-NEXT:  .Lpcsection229:
6578; O1-NEXT:    lock xorl $42, (%rdi)
6579; O1-NEXT:    movq $1, foo(%rip)
6580; O1-NEXT:    retq
6581;
6582; O2-LABEL: atomic32_xor_acq_rel:
6583; O2:       # %bb.0: # %entry
6584; O2-NEXT:    movq foo(%rip), %rax
6585; O2-NEXT:  .Lpcsection229:
6586; O2-NEXT:    lock xorl $42, (%rdi)
6587; O2-NEXT:    movq $1, foo(%rip)
6588; O2-NEXT:    retq
6589;
6590; O3-LABEL: atomic32_xor_acq_rel:
6591; O3:       # %bb.0: # %entry
6592; O3-NEXT:    movq foo(%rip), %rax
6593; O3-NEXT:  .Lpcsection229:
6594; O3-NEXT:    lock xorl $42, (%rdi)
6595; O3-NEXT:    movq $1, foo(%rip)
6596; O3-NEXT:    retq
6597entry:
6598  load volatile i64, ptr @foo, align 8
6599  %x = atomicrmw xor ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6600  store volatile i64 1, ptr @foo, align 8
6601  ret void
6602}
6603
6604define void @atomic32_nand_acq_rel(ptr %a) {
6605; O0-LABEL: atomic32_nand_acq_rel:
6606; O0:       # %bb.0: # %entry
6607; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
6608; O0-NEXT:    movq foo, %rax
6609; O0-NEXT:  .Lpcsection261:
6610; O0-NEXT:    movl (%rdi), %eax
6611; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6612; O0-NEXT:  .LBB133_1: # %atomicrmw.start
6613; O0-NEXT:    # =>This Inner Loop Header: Depth=1
6614; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
6615; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
6616; O0-NEXT:    movl %eax, %edx
6617; O0-NEXT:  .Lpcsection262:
6618; O0-NEXT:    notl %edx
6619; O0-NEXT:  .Lpcsection263:
6620; O0-NEXT:    orl $-43, %edx
6621; O0-NEXT:  .Lpcsection264:
6622; O0-NEXT:    lock cmpxchgl %edx, (%rcx)
6623; O0-NEXT:  .Lpcsection265:
6624; O0-NEXT:    sete %cl
6625; O0-NEXT:  .Lpcsection266:
6626; O0-NEXT:    testb $1, %cl
6627; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6628; O0-NEXT:  .Lpcsection267:
6629; O0-NEXT:    jne .LBB133_2
6630; O0-NEXT:    jmp .LBB133_1
6631; O0-NEXT:  .LBB133_2: # %atomicrmw.end
6632; O0-NEXT:    movq $1, foo
6633; O0-NEXT:    retq
6634;
6635; O1-LABEL: atomic32_nand_acq_rel:
6636; O1:       # %bb.0: # %entry
6637; O1-NEXT:    movq foo(%rip), %rax
6638; O1-NEXT:  .Lpcsection230:
6639; O1-NEXT:    movl (%rdi), %eax
6640; O1-NEXT:    .p2align 4
6641; O1-NEXT:  .LBB133_1: # %atomicrmw.start
6642; O1-NEXT:    # =>This Inner Loop Header: Depth=1
6643; O1-NEXT:    movl %eax, %ecx
6644; O1-NEXT:  .Lpcsection231:
6645; O1-NEXT:    notl %ecx
6646; O1-NEXT:  .Lpcsection232:
6647; O1-NEXT:    orl $-43, %ecx
6648; O1-NEXT:  .Lpcsection233:
6649; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
6650; O1-NEXT:  .Lpcsection234:
6651; O1-NEXT:    jne .LBB133_1
6652; O1-NEXT:  # %bb.2: # %atomicrmw.end
6653; O1-NEXT:    movq $1, foo(%rip)
6654; O1-NEXT:    retq
6655;
6656; O2-LABEL: atomic32_nand_acq_rel:
6657; O2:       # %bb.0: # %entry
6658; O2-NEXT:    movq foo(%rip), %rax
6659; O2-NEXT:  .Lpcsection230:
6660; O2-NEXT:    movl (%rdi), %eax
6661; O2-NEXT:    .p2align 4
6662; O2-NEXT:  .LBB133_1: # %atomicrmw.start
6663; O2-NEXT:    # =>This Inner Loop Header: Depth=1
6664; O2-NEXT:    movl %eax, %ecx
6665; O2-NEXT:  .Lpcsection231:
6666; O2-NEXT:    notl %ecx
6667; O2-NEXT:  .Lpcsection232:
6668; O2-NEXT:    orl $-43, %ecx
6669; O2-NEXT:  .Lpcsection233:
6670; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
6671; O2-NEXT:  .Lpcsection234:
6672; O2-NEXT:    jne .LBB133_1
6673; O2-NEXT:  # %bb.2: # %atomicrmw.end
6674; O2-NEXT:    movq $1, foo(%rip)
6675; O2-NEXT:    retq
6676;
6677; O3-LABEL: atomic32_nand_acq_rel:
6678; O3:       # %bb.0: # %entry
6679; O3-NEXT:    movq foo(%rip), %rax
6680; O3-NEXT:  .Lpcsection230:
6681; O3-NEXT:    movl (%rdi), %eax
6682; O3-NEXT:    .p2align 4
6683; O3-NEXT:  .LBB133_1: # %atomicrmw.start
6684; O3-NEXT:    # =>This Inner Loop Header: Depth=1
6685; O3-NEXT:    movl %eax, %ecx
6686; O3-NEXT:  .Lpcsection231:
6687; O3-NEXT:    notl %ecx
6688; O3-NEXT:  .Lpcsection232:
6689; O3-NEXT:    orl $-43, %ecx
6690; O3-NEXT:  .Lpcsection233:
6691; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
6692; O3-NEXT:  .Lpcsection234:
6693; O3-NEXT:    jne .LBB133_1
6694; O3-NEXT:  # %bb.2: # %atomicrmw.end
6695; O3-NEXT:    movq $1, foo(%rip)
6696; O3-NEXT:    retq
6697entry:
6698  load volatile i64, ptr @foo, align 8
6699  %x = atomicrmw nand ptr %a, i32 42 acq_rel, align 4, !pcsections !0
6700  store volatile i64 1, ptr @foo, align 8
6701  ret void
6702}
6703
6704define void @atomic32_xchg_seq_cst(ptr %a) {
6705; O0-LABEL: atomic32_xchg_seq_cst:
6706; O0:       # %bb.0: # %entry
6707; O0-NEXT:    movq foo(%rip), %rax
6708; O0-NEXT:    movl $42, %eax
6709; O0-NEXT:  .Lpcsection268:
6710; O0-NEXT:    xchgl %eax, (%rdi)
6711; O0-NEXT:    movq $1, foo
6712; O0-NEXT:    retq
6713;
6714; O1-LABEL: atomic32_xchg_seq_cst:
6715; O1:       # %bb.0: # %entry
6716; O1-NEXT:    movq foo(%rip), %rax
6717; O1-NEXT:    movl $42, %eax
6718; O1-NEXT:  .Lpcsection235:
6719; O1-NEXT:    xchgl %eax, (%rdi)
6720; O1-NEXT:    movq $1, foo(%rip)
6721; O1-NEXT:    retq
6722;
6723; O2-LABEL: atomic32_xchg_seq_cst:
6724; O2:       # %bb.0: # %entry
6725; O2-NEXT:    movq foo(%rip), %rax
6726; O2-NEXT:    movl $42, %eax
6727; O2-NEXT:  .Lpcsection235:
6728; O2-NEXT:    xchgl %eax, (%rdi)
6729; O2-NEXT:    movq $1, foo(%rip)
6730; O2-NEXT:    retq
6731;
6732; O3-LABEL: atomic32_xchg_seq_cst:
6733; O3:       # %bb.0: # %entry
6734; O3-NEXT:    movq foo(%rip), %rax
6735; O3-NEXT:    movl $42, %eax
6736; O3-NEXT:  .Lpcsection235:
6737; O3-NEXT:    xchgl %eax, (%rdi)
6738; O3-NEXT:    movq $1, foo(%rip)
6739; O3-NEXT:    retq
6740entry:
6741  load volatile i64, ptr @foo, align 8
6742  %x = atomicrmw xchg ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6743  store volatile i64 1, ptr @foo, align 8
6744  ret void
6745}
6746
6747define void @atomic32_add_seq_cst(ptr %a) {
6748; O0-LABEL: atomic32_add_seq_cst:
6749; O0:       # %bb.0: # %entry
6750; O0-NEXT:    movq foo(%rip), %rax
6751; O0-NEXT:  .Lpcsection269:
6752; O0-NEXT:    lock addl $42, (%rdi)
6753; O0-NEXT:    movq $1, foo
6754; O0-NEXT:    retq
6755;
6756; O1-LABEL: atomic32_add_seq_cst:
6757; O1:       # %bb.0: # %entry
6758; O1-NEXT:    movq foo(%rip), %rax
6759; O1-NEXT:  .Lpcsection236:
6760; O1-NEXT:    lock addl $42, (%rdi)
6761; O1-NEXT:    movq $1, foo(%rip)
6762; O1-NEXT:    retq
6763;
6764; O2-LABEL: atomic32_add_seq_cst:
6765; O2:       # %bb.0: # %entry
6766; O2-NEXT:    movq foo(%rip), %rax
6767; O2-NEXT:  .Lpcsection236:
6768; O2-NEXT:    lock addl $42, (%rdi)
6769; O2-NEXT:    movq $1, foo(%rip)
6770; O2-NEXT:    retq
6771;
6772; O3-LABEL: atomic32_add_seq_cst:
6773; O3:       # %bb.0: # %entry
6774; O3-NEXT:    movq foo(%rip), %rax
6775; O3-NEXT:  .Lpcsection236:
6776; O3-NEXT:    lock addl $42, (%rdi)
6777; O3-NEXT:    movq $1, foo(%rip)
6778; O3-NEXT:    retq
6779entry:
6780  load volatile i64, ptr @foo, align 8
6781  %x = atomicrmw add ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6782  store volatile i64 1, ptr @foo, align 8
6783  ret void
6784}
6785
6786define void @atomic32_sub_seq_cst(ptr %a) {
6787; O0-LABEL: atomic32_sub_seq_cst:
6788; O0:       # %bb.0: # %entry
6789; O0-NEXT:    movq foo(%rip), %rax
6790; O0-NEXT:  .Lpcsection270:
6791; O0-NEXT:    lock subl $42, (%rdi)
6792; O0-NEXT:    movq $1, foo
6793; O0-NEXT:    retq
6794;
6795; O1-LABEL: atomic32_sub_seq_cst:
6796; O1:       # %bb.0: # %entry
6797; O1-NEXT:    movq foo(%rip), %rax
6798; O1-NEXT:  .Lpcsection237:
6799; O1-NEXT:    lock subl $42, (%rdi)
6800; O1-NEXT:    movq $1, foo(%rip)
6801; O1-NEXT:    retq
6802;
6803; O2-LABEL: atomic32_sub_seq_cst:
6804; O2:       # %bb.0: # %entry
6805; O2-NEXT:    movq foo(%rip), %rax
6806; O2-NEXT:  .Lpcsection237:
6807; O2-NEXT:    lock subl $42, (%rdi)
6808; O2-NEXT:    movq $1, foo(%rip)
6809; O2-NEXT:    retq
6810;
6811; O3-LABEL: atomic32_sub_seq_cst:
6812; O3:       # %bb.0: # %entry
6813; O3-NEXT:    movq foo(%rip), %rax
6814; O3-NEXT:  .Lpcsection237:
6815; O3-NEXT:    lock subl $42, (%rdi)
6816; O3-NEXT:    movq $1, foo(%rip)
6817; O3-NEXT:    retq
6818entry:
6819  load volatile i64, ptr @foo, align 8
6820  %x = atomicrmw sub ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6821  store volatile i64 1, ptr @foo, align 8
6822  ret void
6823}
6824
6825define void @atomic32_and_seq_cst(ptr %a) {
6826; O0-LABEL: atomic32_and_seq_cst:
6827; O0:       # %bb.0: # %entry
6828; O0-NEXT:    movq foo(%rip), %rax
6829; O0-NEXT:  .Lpcsection271:
6830; O0-NEXT:    lock andl $42, (%rdi)
6831; O0-NEXT:    movq $1, foo
6832; O0-NEXT:    retq
6833;
6834; O1-LABEL: atomic32_and_seq_cst:
6835; O1:       # %bb.0: # %entry
6836; O1-NEXT:    movq foo(%rip), %rax
6837; O1-NEXT:  .Lpcsection238:
6838; O1-NEXT:    lock andl $42, (%rdi)
6839; O1-NEXT:    movq $1, foo(%rip)
6840; O1-NEXT:    retq
6841;
6842; O2-LABEL: atomic32_and_seq_cst:
6843; O2:       # %bb.0: # %entry
6844; O2-NEXT:    movq foo(%rip), %rax
6845; O2-NEXT:  .Lpcsection238:
6846; O2-NEXT:    lock andl $42, (%rdi)
6847; O2-NEXT:    movq $1, foo(%rip)
6848; O2-NEXT:    retq
6849;
6850; O3-LABEL: atomic32_and_seq_cst:
6851; O3:       # %bb.0: # %entry
6852; O3-NEXT:    movq foo(%rip), %rax
6853; O3-NEXT:  .Lpcsection238:
6854; O3-NEXT:    lock andl $42, (%rdi)
6855; O3-NEXT:    movq $1, foo(%rip)
6856; O3-NEXT:    retq
6857entry:
6858  load volatile i64, ptr @foo, align 8
6859  %x = atomicrmw and ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6860  store volatile i64 1, ptr @foo, align 8
6861  ret void
6862}
6863
6864define void @atomic32_or_seq_cst(ptr %a) {
6865; O0-LABEL: atomic32_or_seq_cst:
6866; O0:       # %bb.0: # %entry
6867; O0-NEXT:    movq foo(%rip), %rax
6868; O0-NEXT:  .Lpcsection272:
6869; O0-NEXT:    lock orl $42, (%rdi)
6870; O0-NEXT:    movq $1, foo
6871; O0-NEXT:    retq
6872;
6873; O1-LABEL: atomic32_or_seq_cst:
6874; O1:       # %bb.0: # %entry
6875; O1-NEXT:    movq foo(%rip), %rax
6876; O1-NEXT:  .Lpcsection239:
6877; O1-NEXT:    lock orl $42, (%rdi)
6878; O1-NEXT:    movq $1, foo(%rip)
6879; O1-NEXT:    retq
6880;
6881; O2-LABEL: atomic32_or_seq_cst:
6882; O2:       # %bb.0: # %entry
6883; O2-NEXT:    movq foo(%rip), %rax
6884; O2-NEXT:  .Lpcsection239:
6885; O2-NEXT:    lock orl $42, (%rdi)
6886; O2-NEXT:    movq $1, foo(%rip)
6887; O2-NEXT:    retq
6888;
6889; O3-LABEL: atomic32_or_seq_cst:
6890; O3:       # %bb.0: # %entry
6891; O3-NEXT:    movq foo(%rip), %rax
6892; O3-NEXT:  .Lpcsection239:
6893; O3-NEXT:    lock orl $42, (%rdi)
6894; O3-NEXT:    movq $1, foo(%rip)
6895; O3-NEXT:    retq
6896entry:
6897  load volatile i64, ptr @foo, align 8
6898  %x = atomicrmw or ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6899  store volatile i64 1, ptr @foo, align 8
6900  ret void
6901}
6902
6903define void @atomic32_xor_seq_cst(ptr %a) {
6904; O0-LABEL: atomic32_xor_seq_cst:
6905; O0:       # %bb.0: # %entry
6906; O0-NEXT:    movq foo(%rip), %rax
6907; O0-NEXT:  .Lpcsection273:
6908; O0-NEXT:    lock xorl $42, (%rdi)
6909; O0-NEXT:    movq $1, foo
6910; O0-NEXT:    retq
6911;
6912; O1-LABEL: atomic32_xor_seq_cst:
6913; O1:       # %bb.0: # %entry
6914; O1-NEXT:    movq foo(%rip), %rax
6915; O1-NEXT:  .Lpcsection240:
6916; O1-NEXT:    lock xorl $42, (%rdi)
6917; O1-NEXT:    movq $1, foo(%rip)
6918; O1-NEXT:    retq
6919;
6920; O2-LABEL: atomic32_xor_seq_cst:
6921; O2:       # %bb.0: # %entry
6922; O2-NEXT:    movq foo(%rip), %rax
6923; O2-NEXT:  .Lpcsection240:
6924; O2-NEXT:    lock xorl $42, (%rdi)
6925; O2-NEXT:    movq $1, foo(%rip)
6926; O2-NEXT:    retq
6927;
6928; O3-LABEL: atomic32_xor_seq_cst:
6929; O3:       # %bb.0: # %entry
6930; O3-NEXT:    movq foo(%rip), %rax
6931; O3-NEXT:  .Lpcsection240:
6932; O3-NEXT:    lock xorl $42, (%rdi)
6933; O3-NEXT:    movq $1, foo(%rip)
6934; O3-NEXT:    retq
6935entry:
6936  load volatile i64, ptr @foo, align 8
6937  %x = atomicrmw xor ptr %a, i32 42 seq_cst, align 4, !pcsections !0
6938  store volatile i64 1, ptr @foo, align 8
6939  ret void
6940}
6941
6942define void @atomic32_nand_seq_cst(ptr %a) {
6943; O0-LABEL: atomic32_nand_seq_cst:
6944; O0:       # %bb.0: # %entry
6945; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
6946; O0-NEXT:    movq foo, %rax
6947; O0-NEXT:  .Lpcsection274:
6948; O0-NEXT:    movl (%rdi), %eax
6949; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6950; O0-NEXT:  .LBB140_1: # %atomicrmw.start
6951; O0-NEXT:    # =>This Inner Loop Header: Depth=1
6952; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
6953; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
6954; O0-NEXT:    movl %eax, %edx
6955; O0-NEXT:  .Lpcsection275:
6956; O0-NEXT:    notl %edx
6957; O0-NEXT:  .Lpcsection276:
6958; O0-NEXT:    orl $-43, %edx
6959; O0-NEXT:  .Lpcsection277:
6960; O0-NEXT:    lock cmpxchgl %edx, (%rcx)
6961; O0-NEXT:  .Lpcsection278:
6962; O0-NEXT:    sete %cl
6963; O0-NEXT:  .Lpcsection279:
6964; O0-NEXT:    testb $1, %cl
6965; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
6966; O0-NEXT:  .Lpcsection280:
6967; O0-NEXT:    jne .LBB140_2
6968; O0-NEXT:    jmp .LBB140_1
6969; O0-NEXT:  .LBB140_2: # %atomicrmw.end
6970; O0-NEXT:    movq $1, foo
6971; O0-NEXT:    retq
6972;
6973; O1-LABEL: atomic32_nand_seq_cst:
6974; O1:       # %bb.0: # %entry
6975; O1-NEXT:    movq foo(%rip), %rax
6976; O1-NEXT:  .Lpcsection241:
6977; O1-NEXT:    movl (%rdi), %eax
6978; O1-NEXT:    .p2align 4
6979; O1-NEXT:  .LBB140_1: # %atomicrmw.start
6980; O1-NEXT:    # =>This Inner Loop Header: Depth=1
6981; O1-NEXT:    movl %eax, %ecx
6982; O1-NEXT:  .Lpcsection242:
6983; O1-NEXT:    notl %ecx
6984; O1-NEXT:  .Lpcsection243:
6985; O1-NEXT:    orl $-43, %ecx
6986; O1-NEXT:  .Lpcsection244:
6987; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
6988; O1-NEXT:  .Lpcsection245:
6989; O1-NEXT:    jne .LBB140_1
6990; O1-NEXT:  # %bb.2: # %atomicrmw.end
6991; O1-NEXT:    movq $1, foo(%rip)
6992; O1-NEXT:    retq
6993;
6994; O2-LABEL: atomic32_nand_seq_cst:
6995; O2:       # %bb.0: # %entry
6996; O2-NEXT:    movq foo(%rip), %rax
6997; O2-NEXT:  .Lpcsection241:
6998; O2-NEXT:    movl (%rdi), %eax
6999; O2-NEXT:    .p2align 4
7000; O2-NEXT:  .LBB140_1: # %atomicrmw.start
7001; O2-NEXT:    # =>This Inner Loop Header: Depth=1
7002; O2-NEXT:    movl %eax, %ecx
7003; O2-NEXT:  .Lpcsection242:
7004; O2-NEXT:    notl %ecx
7005; O2-NEXT:  .Lpcsection243:
7006; O2-NEXT:    orl $-43, %ecx
7007; O2-NEXT:  .Lpcsection244:
7008; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7009; O2-NEXT:  .Lpcsection245:
7010; O2-NEXT:    jne .LBB140_1
7011; O2-NEXT:  # %bb.2: # %atomicrmw.end
7012; O2-NEXT:    movq $1, foo(%rip)
7013; O2-NEXT:    retq
7014;
7015; O3-LABEL: atomic32_nand_seq_cst:
7016; O3:       # %bb.0: # %entry
7017; O3-NEXT:    movq foo(%rip), %rax
7018; O3-NEXT:  .Lpcsection241:
7019; O3-NEXT:    movl (%rdi), %eax
7020; O3-NEXT:    .p2align 4
7021; O3-NEXT:  .LBB140_1: # %atomicrmw.start
7022; O3-NEXT:    # =>This Inner Loop Header: Depth=1
7023; O3-NEXT:    movl %eax, %ecx
7024; O3-NEXT:  .Lpcsection242:
7025; O3-NEXT:    notl %ecx
7026; O3-NEXT:  .Lpcsection243:
7027; O3-NEXT:    orl $-43, %ecx
7028; O3-NEXT:  .Lpcsection244:
7029; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7030; O3-NEXT:  .Lpcsection245:
7031; O3-NEXT:    jne .LBB140_1
7032; O3-NEXT:  # %bb.2: # %atomicrmw.end
7033; O3-NEXT:    movq $1, foo(%rip)
7034; O3-NEXT:    retq
7035entry:
7036  load volatile i64, ptr @foo, align 8
7037  %x = atomicrmw nand ptr %a, i32 42 seq_cst, align 4, !pcsections !0
7038  store volatile i64 1, ptr @foo, align 8
7039  ret void
7040}
7041
7042define void @atomic32_cas_monotonic(ptr %a) {
7043; O0-LABEL: atomic32_cas_monotonic:
7044; O0:       # %bb.0: # %entry
7045; O0-NEXT:    movq foo(%rip), %rax
7046; O0-NEXT:    movl $42, %eax
7047; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
7048; O0-NEXT:    movl $1, %ecx
7049; O0-NEXT:  .Lpcsection281:
7050; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7051; O0-NEXT:  .Lpcsection282:
7052; O0-NEXT:    # kill: def $edx killed $eax
7053; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7054; O0-NEXT:  .Lpcsection283:
7055; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7056; O0-NEXT:  .Lpcsection284:
7057; O0-NEXT:    # kill: def $edx killed $eax
7058; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7059; O0-NEXT:  .Lpcsection285:
7060; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7061; O0-NEXT:    movq $1, foo
7062; O0-NEXT:    retq
7063;
7064; O1-LABEL: atomic32_cas_monotonic:
7065; O1:       # %bb.0: # %entry
7066; O1-NEXT:    movq foo(%rip), %rax
7067; O1-NEXT:    movl $1, %ecx
7068; O1-NEXT:  .Lpcsection246:
7069; O1-NEXT:    movl $42, %eax
7070; O1-NEXT:  .Lpcsection247:
7071; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7072; O1-NEXT:  .Lpcsection248:
7073; O1-NEXT:    movl $42, %eax
7074; O1-NEXT:  .Lpcsection249:
7075; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7076; O1-NEXT:  .Lpcsection250:
7077; O1-NEXT:    movl $42, %eax
7078; O1-NEXT:  .Lpcsection251:
7079; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7080; O1-NEXT:    movq $1, foo(%rip)
7081; O1-NEXT:    retq
7082;
7083; O2-LABEL: atomic32_cas_monotonic:
7084; O2:       # %bb.0: # %entry
7085; O2-NEXT:    movq foo(%rip), %rax
7086; O2-NEXT:    movl $1, %ecx
7087; O2-NEXT:  .Lpcsection246:
7088; O2-NEXT:    movl $42, %eax
7089; O2-NEXT:  .Lpcsection247:
7090; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7091; O2-NEXT:  .Lpcsection248:
7092; O2-NEXT:    movl $42, %eax
7093; O2-NEXT:  .Lpcsection249:
7094; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7095; O2-NEXT:  .Lpcsection250:
7096; O2-NEXT:    movl $42, %eax
7097; O2-NEXT:  .Lpcsection251:
7098; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7099; O2-NEXT:    movq $1, foo(%rip)
7100; O2-NEXT:    retq
7101;
7102; O3-LABEL: atomic32_cas_monotonic:
7103; O3:       # %bb.0: # %entry
7104; O3-NEXT:    movq foo(%rip), %rax
7105; O3-NEXT:    movl $1, %ecx
7106; O3-NEXT:  .Lpcsection246:
7107; O3-NEXT:    movl $42, %eax
7108; O3-NEXT:  .Lpcsection247:
7109; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7110; O3-NEXT:  .Lpcsection248:
7111; O3-NEXT:    movl $42, %eax
7112; O3-NEXT:  .Lpcsection249:
7113; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7114; O3-NEXT:  .Lpcsection250:
7115; O3-NEXT:    movl $42, %eax
7116; O3-NEXT:  .Lpcsection251:
7117; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7118; O3-NEXT:    movq $1, foo(%rip)
7119; O3-NEXT:    retq
7120entry:
7121  load volatile i64, ptr @foo, align 8
7122  %x = cmpxchg ptr %a, i32 42, i32 1 monotonic monotonic, align 4, !pcsections !0
7123  %y = cmpxchg ptr %a, i32 42, i32 1 monotonic acquire, align 4, !pcsections !0
7124  %z = cmpxchg ptr %a, i32 42, i32 1 monotonic seq_cst, align 4, !pcsections !0
7125  store volatile i64 1, ptr @foo, align 8
7126  ret void
7127}
7128
7129define void @atomic32_cas_acquire(ptr %a) {
7130; O0-LABEL: atomic32_cas_acquire:
7131; O0:       # %bb.0: # %entry
7132; O0-NEXT:    movq foo(%rip), %rax
7133; O0-NEXT:    movl $42, %eax
7134; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
7135; O0-NEXT:    movl $1, %ecx
7136; O0-NEXT:  .Lpcsection286:
7137; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7138; O0-NEXT:  .Lpcsection287:
7139; O0-NEXT:    # kill: def $edx killed $eax
7140; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7141; O0-NEXT:  .Lpcsection288:
7142; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7143; O0-NEXT:  .Lpcsection289:
7144; O0-NEXT:    # kill: def $edx killed $eax
7145; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7146; O0-NEXT:  .Lpcsection290:
7147; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7148; O0-NEXT:    movq $1, foo
7149; O0-NEXT:    retq
7150;
7151; O1-LABEL: atomic32_cas_acquire:
7152; O1:       # %bb.0: # %entry
7153; O1-NEXT:    movq foo(%rip), %rax
7154; O1-NEXT:    movl $1, %ecx
7155; O1-NEXT:  .Lpcsection252:
7156; O1-NEXT:    movl $42, %eax
7157; O1-NEXT:  .Lpcsection253:
7158; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7159; O1-NEXT:  .Lpcsection254:
7160; O1-NEXT:    movl $42, %eax
7161; O1-NEXT:  .Lpcsection255:
7162; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7163; O1-NEXT:  .Lpcsection256:
7164; O1-NEXT:    movl $42, %eax
7165; O1-NEXT:  .Lpcsection257:
7166; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7167; O1-NEXT:    movq $1, foo(%rip)
7168; O1-NEXT:    retq
7169;
7170; O2-LABEL: atomic32_cas_acquire:
7171; O2:       # %bb.0: # %entry
7172; O2-NEXT:    movq foo(%rip), %rax
7173; O2-NEXT:    movl $1, %ecx
7174; O2-NEXT:  .Lpcsection252:
7175; O2-NEXT:    movl $42, %eax
7176; O2-NEXT:  .Lpcsection253:
7177; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7178; O2-NEXT:  .Lpcsection254:
7179; O2-NEXT:    movl $42, %eax
7180; O2-NEXT:  .Lpcsection255:
7181; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7182; O2-NEXT:  .Lpcsection256:
7183; O2-NEXT:    movl $42, %eax
7184; O2-NEXT:  .Lpcsection257:
7185; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7186; O2-NEXT:    movq $1, foo(%rip)
7187; O2-NEXT:    retq
7188;
7189; O3-LABEL: atomic32_cas_acquire:
7190; O3:       # %bb.0: # %entry
7191; O3-NEXT:    movq foo(%rip), %rax
7192; O3-NEXT:    movl $1, %ecx
7193; O3-NEXT:  .Lpcsection252:
7194; O3-NEXT:    movl $42, %eax
7195; O3-NEXT:  .Lpcsection253:
7196; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7197; O3-NEXT:  .Lpcsection254:
7198; O3-NEXT:    movl $42, %eax
7199; O3-NEXT:  .Lpcsection255:
7200; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7201; O3-NEXT:  .Lpcsection256:
7202; O3-NEXT:    movl $42, %eax
7203; O3-NEXT:  .Lpcsection257:
7204; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7205; O3-NEXT:    movq $1, foo(%rip)
7206; O3-NEXT:    retq
7207entry:
7208  load volatile i64, ptr @foo, align 8
7209  %x = cmpxchg ptr %a, i32 42, i32 1 acquire monotonic, align 4, !pcsections !0
7210  %y = cmpxchg ptr %a, i32 42, i32 1 acquire acquire, align 4, !pcsections !0
7211  %z = cmpxchg ptr %a, i32 42, i32 1 acquire seq_cst, align 4, !pcsections !0
7212  store volatile i64 1, ptr @foo, align 8
7213  ret void
7214}
7215
7216define void @atomic32_cas_release(ptr %a) {
7217; O0-LABEL: atomic32_cas_release:
7218; O0:       # %bb.0: # %entry
7219; O0-NEXT:    movq foo(%rip), %rax
7220; O0-NEXT:    movl $42, %eax
7221; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
7222; O0-NEXT:    movl $1, %ecx
7223; O0-NEXT:  .Lpcsection291:
7224; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7225; O0-NEXT:  .Lpcsection292:
7226; O0-NEXT:    # kill: def $edx killed $eax
7227; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7228; O0-NEXT:  .Lpcsection293:
7229; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7230; O0-NEXT:  .Lpcsection294:
7231; O0-NEXT:    # kill: def $edx killed $eax
7232; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7233; O0-NEXT:  .Lpcsection295:
7234; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7235; O0-NEXT:    movq $1, foo
7236; O0-NEXT:    retq
7237;
7238; O1-LABEL: atomic32_cas_release:
7239; O1:       # %bb.0: # %entry
7240; O1-NEXT:    movq foo(%rip), %rax
7241; O1-NEXT:    movl $1, %ecx
7242; O1-NEXT:  .Lpcsection258:
7243; O1-NEXT:    movl $42, %eax
7244; O1-NEXT:  .Lpcsection259:
7245; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7246; O1-NEXT:  .Lpcsection260:
7247; O1-NEXT:    movl $42, %eax
7248; O1-NEXT:  .Lpcsection261:
7249; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7250; O1-NEXT:  .Lpcsection262:
7251; O1-NEXT:    movl $42, %eax
7252; O1-NEXT:  .Lpcsection263:
7253; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7254; O1-NEXT:    movq $1, foo(%rip)
7255; O1-NEXT:    retq
7256;
7257; O2-LABEL: atomic32_cas_release:
7258; O2:       # %bb.0: # %entry
7259; O2-NEXT:    movq foo(%rip), %rax
7260; O2-NEXT:    movl $1, %ecx
7261; O2-NEXT:  .Lpcsection258:
7262; O2-NEXT:    movl $42, %eax
7263; O2-NEXT:  .Lpcsection259:
7264; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7265; O2-NEXT:  .Lpcsection260:
7266; O2-NEXT:    movl $42, %eax
7267; O2-NEXT:  .Lpcsection261:
7268; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7269; O2-NEXT:  .Lpcsection262:
7270; O2-NEXT:    movl $42, %eax
7271; O2-NEXT:  .Lpcsection263:
7272; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7273; O2-NEXT:    movq $1, foo(%rip)
7274; O2-NEXT:    retq
7275;
7276; O3-LABEL: atomic32_cas_release:
7277; O3:       # %bb.0: # %entry
7278; O3-NEXT:    movq foo(%rip), %rax
7279; O3-NEXT:    movl $1, %ecx
7280; O3-NEXT:  .Lpcsection258:
7281; O3-NEXT:    movl $42, %eax
7282; O3-NEXT:  .Lpcsection259:
7283; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7284; O3-NEXT:  .Lpcsection260:
7285; O3-NEXT:    movl $42, %eax
7286; O3-NEXT:  .Lpcsection261:
7287; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7288; O3-NEXT:  .Lpcsection262:
7289; O3-NEXT:    movl $42, %eax
7290; O3-NEXT:  .Lpcsection263:
7291; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7292; O3-NEXT:    movq $1, foo(%rip)
7293; O3-NEXT:    retq
7294entry:
7295  load volatile i64, ptr @foo, align 8
7296  %x = cmpxchg ptr %a, i32 42, i32 1 release monotonic, align 4, !pcsections !0
7297  %y = cmpxchg ptr %a, i32 42, i32 1 release acquire, align 4, !pcsections !0
7298  %z = cmpxchg ptr %a, i32 42, i32 1 release seq_cst, align 4, !pcsections !0
7299  store volatile i64 1, ptr @foo, align 8
7300  ret void
7301}
7302
7303define void @atomic32_cas_acq_rel(ptr %a) {
7304; O0-LABEL: atomic32_cas_acq_rel:
7305; O0:       # %bb.0: # %entry
7306; O0-NEXT:    movq foo(%rip), %rax
7307; O0-NEXT:    movl $42, %eax
7308; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
7309; O0-NEXT:    movl $1, %ecx
7310; O0-NEXT:  .Lpcsection296:
7311; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7312; O0-NEXT:  .Lpcsection297:
7313; O0-NEXT:    # kill: def $edx killed $eax
7314; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7315; O0-NEXT:  .Lpcsection298:
7316; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7317; O0-NEXT:  .Lpcsection299:
7318; O0-NEXT:    # kill: def $edx killed $eax
7319; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7320; O0-NEXT:  .Lpcsection300:
7321; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7322; O0-NEXT:    movq $1, foo
7323; O0-NEXT:    retq
7324;
7325; O1-LABEL: atomic32_cas_acq_rel:
7326; O1:       # %bb.0: # %entry
7327; O1-NEXT:    movq foo(%rip), %rax
7328; O1-NEXT:    movl $1, %ecx
7329; O1-NEXT:  .Lpcsection264:
7330; O1-NEXT:    movl $42, %eax
7331; O1-NEXT:  .Lpcsection265:
7332; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7333; O1-NEXT:  .Lpcsection266:
7334; O1-NEXT:    movl $42, %eax
7335; O1-NEXT:  .Lpcsection267:
7336; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7337; O1-NEXT:  .Lpcsection268:
7338; O1-NEXT:    movl $42, %eax
7339; O1-NEXT:  .Lpcsection269:
7340; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7341; O1-NEXT:    movq $1, foo(%rip)
7342; O1-NEXT:    retq
7343;
7344; O2-LABEL: atomic32_cas_acq_rel:
7345; O2:       # %bb.0: # %entry
7346; O2-NEXT:    movq foo(%rip), %rax
7347; O2-NEXT:    movl $1, %ecx
7348; O2-NEXT:  .Lpcsection264:
7349; O2-NEXT:    movl $42, %eax
7350; O2-NEXT:  .Lpcsection265:
7351; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7352; O2-NEXT:  .Lpcsection266:
7353; O2-NEXT:    movl $42, %eax
7354; O2-NEXT:  .Lpcsection267:
7355; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7356; O2-NEXT:  .Lpcsection268:
7357; O2-NEXT:    movl $42, %eax
7358; O2-NEXT:  .Lpcsection269:
7359; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7360; O2-NEXT:    movq $1, foo(%rip)
7361; O2-NEXT:    retq
7362;
7363; O3-LABEL: atomic32_cas_acq_rel:
7364; O3:       # %bb.0: # %entry
7365; O3-NEXT:    movq foo(%rip), %rax
7366; O3-NEXT:    movl $1, %ecx
7367; O3-NEXT:  .Lpcsection264:
7368; O3-NEXT:    movl $42, %eax
7369; O3-NEXT:  .Lpcsection265:
7370; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7371; O3-NEXT:  .Lpcsection266:
7372; O3-NEXT:    movl $42, %eax
7373; O3-NEXT:  .Lpcsection267:
7374; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7375; O3-NEXT:  .Lpcsection268:
7376; O3-NEXT:    movl $42, %eax
7377; O3-NEXT:  .Lpcsection269:
7378; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7379; O3-NEXT:    movq $1, foo(%rip)
7380; O3-NEXT:    retq
7381entry:
7382  load volatile i64, ptr @foo, align 8
7383  %x = cmpxchg ptr %a, i32 42, i32 1 acq_rel monotonic, align 4, !pcsections !0
7384  %y = cmpxchg ptr %a, i32 42, i32 1 acq_rel acquire, align 4, !pcsections !0
7385  %z = cmpxchg ptr %a, i32 42, i32 1 acq_rel seq_cst, align 4, !pcsections !0
7386  store volatile i64 1, ptr @foo, align 8
7387  ret void
7388}
7389
7390define void @atomic32_cas_seq_cst(ptr %a) {
7391; O0-LABEL: atomic32_cas_seq_cst:
7392; O0:       # %bb.0: # %entry
7393; O0-NEXT:    movq foo(%rip), %rax
7394; O0-NEXT:    movl $42, %eax
7395; O0-NEXT:    movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
7396; O0-NEXT:    movl $1, %ecx
7397; O0-NEXT:  .Lpcsection301:
7398; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7399; O0-NEXT:  .Lpcsection302:
7400; O0-NEXT:    # kill: def $edx killed $eax
7401; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7402; O0-NEXT:  .Lpcsection303:
7403; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7404; O0-NEXT:  .Lpcsection304:
7405; O0-NEXT:    # kill: def $edx killed $eax
7406; O0-NEXT:    movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
7407; O0-NEXT:  .Lpcsection305:
7408; O0-NEXT:    lock cmpxchgl %ecx, (%rdi)
7409; O0-NEXT:    movq $1, foo
7410; O0-NEXT:    retq
7411;
7412; O1-LABEL: atomic32_cas_seq_cst:
7413; O1:       # %bb.0: # %entry
7414; O1-NEXT:    movq foo(%rip), %rax
7415; O1-NEXT:    movl $1, %ecx
7416; O1-NEXT:  .Lpcsection270:
7417; O1-NEXT:    movl $42, %eax
7418; O1-NEXT:  .Lpcsection271:
7419; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7420; O1-NEXT:  .Lpcsection272:
7421; O1-NEXT:    movl $42, %eax
7422; O1-NEXT:  .Lpcsection273:
7423; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7424; O1-NEXT:  .Lpcsection274:
7425; O1-NEXT:    movl $42, %eax
7426; O1-NEXT:  .Lpcsection275:
7427; O1-NEXT:    lock cmpxchgl %ecx, (%rdi)
7428; O1-NEXT:    movq $1, foo(%rip)
7429; O1-NEXT:    retq
7430;
7431; O2-LABEL: atomic32_cas_seq_cst:
7432; O2:       # %bb.0: # %entry
7433; O2-NEXT:    movq foo(%rip), %rax
7434; O2-NEXT:    movl $1, %ecx
7435; O2-NEXT:  .Lpcsection270:
7436; O2-NEXT:    movl $42, %eax
7437; O2-NEXT:  .Lpcsection271:
7438; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7439; O2-NEXT:  .Lpcsection272:
7440; O2-NEXT:    movl $42, %eax
7441; O2-NEXT:  .Lpcsection273:
7442; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7443; O2-NEXT:  .Lpcsection274:
7444; O2-NEXT:    movl $42, %eax
7445; O2-NEXT:  .Lpcsection275:
7446; O2-NEXT:    lock cmpxchgl %ecx, (%rdi)
7447; O2-NEXT:    movq $1, foo(%rip)
7448; O2-NEXT:    retq
7449;
7450; O3-LABEL: atomic32_cas_seq_cst:
7451; O3:       # %bb.0: # %entry
7452; O3-NEXT:    movq foo(%rip), %rax
7453; O3-NEXT:    movl $1, %ecx
7454; O3-NEXT:  .Lpcsection270:
7455; O3-NEXT:    movl $42, %eax
7456; O3-NEXT:  .Lpcsection271:
7457; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7458; O3-NEXT:  .Lpcsection272:
7459; O3-NEXT:    movl $42, %eax
7460; O3-NEXT:  .Lpcsection273:
7461; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7462; O3-NEXT:  .Lpcsection274:
7463; O3-NEXT:    movl $42, %eax
7464; O3-NEXT:  .Lpcsection275:
7465; O3-NEXT:    lock cmpxchgl %ecx, (%rdi)
7466; O3-NEXT:    movq $1, foo(%rip)
7467; O3-NEXT:    retq
7468entry:
7469  load volatile i64, ptr @foo, align 8
7470  %x = cmpxchg ptr %a, i32 42, i32 1 seq_cst monotonic, align 4, !pcsections !0
7471  %y = cmpxchg ptr %a, i32 42, i32 1 seq_cst acquire, align 4, !pcsections !0
7472  %z = cmpxchg ptr %a, i32 42, i32 1 seq_cst seq_cst, align 4, !pcsections !0
7473  store volatile i64 1, ptr @foo, align 8
7474  ret void
7475}
7476
7477define i64 @atomic64_load_unordered(ptr %a) {
7478; O0-LABEL: atomic64_load_unordered:
7479; O0:       # %bb.0: # %entry
7480; O0-NEXT:    movq foo(%rip), %rax
7481; O0-NEXT:  .Lpcsection306:
7482; O0-NEXT:    movq (%rdi), %rax
7483; O0-NEXT:    movq $1, foo
7484; O0-NEXT:    retq
7485;
7486; O1-LABEL: atomic64_load_unordered:
7487; O1:       # %bb.0: # %entry
7488; O1-NEXT:    movq foo(%rip), %rax
7489; O1-NEXT:  .Lpcsection276:
7490; O1-NEXT:    movq (%rdi), %rax
7491; O1-NEXT:    movq $1, foo(%rip)
7492; O1-NEXT:    retq
7493;
7494; O2-LABEL: atomic64_load_unordered:
7495; O2:       # %bb.0: # %entry
7496; O2-NEXT:    movq foo(%rip), %rax
7497; O2-NEXT:  .Lpcsection276:
7498; O2-NEXT:    movq (%rdi), %rax
7499; O2-NEXT:    movq $1, foo(%rip)
7500; O2-NEXT:    retq
7501;
7502; O3-LABEL: atomic64_load_unordered:
7503; O3:       # %bb.0: # %entry
7504; O3-NEXT:    movq foo(%rip), %rax
7505; O3-NEXT:  .Lpcsection276:
7506; O3-NEXT:    movq (%rdi), %rax
7507; O3-NEXT:    movq $1, foo(%rip)
7508; O3-NEXT:    retq
7509entry:
7510  load volatile i64, ptr @foo, align 8
7511  %x = load atomic i64, ptr %a unordered, align 8, !pcsections !0
7512  store volatile i64 1, ptr @foo, align 8
7513  ret i64 %x
7514}
7515
7516define i64 @atomic64_load_monotonic(ptr %a) {
7517; O0-LABEL: atomic64_load_monotonic:
7518; O0:       # %bb.0: # %entry
7519; O0-NEXT:    movq foo(%rip), %rax
7520; O0-NEXT:  .Lpcsection307:
7521; O0-NEXT:    movq (%rdi), %rax
7522; O0-NEXT:    movq $1, foo
7523; O0-NEXT:    retq
7524;
7525; O1-LABEL: atomic64_load_monotonic:
7526; O1:       # %bb.0: # %entry
7527; O1-NEXT:    movq foo(%rip), %rax
7528; O1-NEXT:  .Lpcsection277:
7529; O1-NEXT:    movq (%rdi), %rax
7530; O1-NEXT:    movq $1, foo(%rip)
7531; O1-NEXT:    retq
7532;
7533; O2-LABEL: atomic64_load_monotonic:
7534; O2:       # %bb.0: # %entry
7535; O2-NEXT:    movq foo(%rip), %rax
7536; O2-NEXT:  .Lpcsection277:
7537; O2-NEXT:    movq (%rdi), %rax
7538; O2-NEXT:    movq $1, foo(%rip)
7539; O2-NEXT:    retq
7540;
7541; O3-LABEL: atomic64_load_monotonic:
7542; O3:       # %bb.0: # %entry
7543; O3-NEXT:    movq foo(%rip), %rax
7544; O3-NEXT:  .Lpcsection277:
7545; O3-NEXT:    movq (%rdi), %rax
7546; O3-NEXT:    movq $1, foo(%rip)
7547; O3-NEXT:    retq
7548entry:
7549  load volatile i64, ptr @foo, align 8
7550  %x = load atomic i64, ptr %a monotonic, align 8, !pcsections !0
7551  store volatile i64 1, ptr @foo, align 8
7552  ret i64 %x
7553}
7554
7555define i64 @atomic64_load_acquire(ptr %a) {
7556; O0-LABEL: atomic64_load_acquire:
7557; O0:       # %bb.0: # %entry
7558; O0-NEXT:    movq foo(%rip), %rax
7559; O0-NEXT:  .Lpcsection308:
7560; O0-NEXT:    movq (%rdi), %rax
7561; O0-NEXT:    movq $1, foo
7562; O0-NEXT:    retq
7563;
7564; O1-LABEL: atomic64_load_acquire:
7565; O1:       # %bb.0: # %entry
7566; O1-NEXT:    movq foo(%rip), %rax
7567; O1-NEXT:  .Lpcsection278:
7568; O1-NEXT:    movq (%rdi), %rax
7569; O1-NEXT:    movq $1, foo(%rip)
7570; O1-NEXT:    retq
7571;
7572; O2-LABEL: atomic64_load_acquire:
7573; O2:       # %bb.0: # %entry
7574; O2-NEXT:    movq foo(%rip), %rax
7575; O2-NEXT:  .Lpcsection278:
7576; O2-NEXT:    movq (%rdi), %rax
7577; O2-NEXT:    movq $1, foo(%rip)
7578; O2-NEXT:    retq
7579;
7580; O3-LABEL: atomic64_load_acquire:
7581; O3:       # %bb.0: # %entry
7582; O3-NEXT:    movq foo(%rip), %rax
7583; O3-NEXT:  .Lpcsection278:
7584; O3-NEXT:    movq (%rdi), %rax
7585; O3-NEXT:    movq $1, foo(%rip)
7586; O3-NEXT:    retq
7587entry:
7588  load volatile i64, ptr @foo, align 8
7589  %x = load atomic i64, ptr %a acquire, align 8, !pcsections !0
7590  store volatile i64 1, ptr @foo, align 8
7591  ret i64 %x
7592}
7593
7594define i64 @atomic64_load_seq_cst(ptr %a) {
7595; O0-LABEL: atomic64_load_seq_cst:
7596; O0:       # %bb.0: # %entry
7597; O0-NEXT:    movq foo(%rip), %rax
7598; O0-NEXT:  .Lpcsection309:
7599; O0-NEXT:    movq (%rdi), %rax
7600; O0-NEXT:    movq $1, foo
7601; O0-NEXT:    retq
7602;
7603; O1-LABEL: atomic64_load_seq_cst:
7604; O1:       # %bb.0: # %entry
7605; O1-NEXT:    movq foo(%rip), %rax
7606; O1-NEXT:  .Lpcsection279:
7607; O1-NEXT:    movq (%rdi), %rax
7608; O1-NEXT:    movq $1, foo(%rip)
7609; O1-NEXT:    retq
7610;
7611; O2-LABEL: atomic64_load_seq_cst:
7612; O2:       # %bb.0: # %entry
7613; O2-NEXT:    movq foo(%rip), %rax
7614; O2-NEXT:  .Lpcsection279:
7615; O2-NEXT:    movq (%rdi), %rax
7616; O2-NEXT:    movq $1, foo(%rip)
7617; O2-NEXT:    retq
7618;
7619; O3-LABEL: atomic64_load_seq_cst:
7620; O3:       # %bb.0: # %entry
7621; O3-NEXT:    movq foo(%rip), %rax
7622; O3-NEXT:  .Lpcsection279:
7623; O3-NEXT:    movq (%rdi), %rax
7624; O3-NEXT:    movq $1, foo(%rip)
7625; O3-NEXT:    retq
7626entry:
7627  load volatile i64, ptr @foo, align 8
7628  %x = load atomic i64, ptr %a seq_cst, align 8, !pcsections !0
7629  store volatile i64 1, ptr @foo, align 8
7630  ret i64 %x
7631}
7632
7633define ptr @atomic64_load_seq_cst_ptr_ty(ptr %a) {
7634; O0-LABEL: atomic64_load_seq_cst_ptr_ty:
7635; O0:       # %bb.0: # %entry
7636; O0-NEXT:    movq foo(%rip), %rax
7637; O0-NEXT:  .Lpcsection310:
7638; O0-NEXT:    movq (%rdi), %rax
7639; O0-NEXT:    movq $1, foo
7640; O0-NEXT:    retq
7641;
7642; O1-LABEL: atomic64_load_seq_cst_ptr_ty:
7643; O1:       # %bb.0: # %entry
7644; O1-NEXT:    movq foo(%rip), %rax
7645; O1-NEXT:  .Lpcsection280:
7646; O1-NEXT:    movq (%rdi), %rax
7647; O1-NEXT:    movq $1, foo(%rip)
7648; O1-NEXT:    retq
7649;
7650; O2-LABEL: atomic64_load_seq_cst_ptr_ty:
7651; O2:       # %bb.0: # %entry
7652; O2-NEXT:    movq foo(%rip), %rax
7653; O2-NEXT:  .Lpcsection280:
7654; O2-NEXT:    movq (%rdi), %rax
7655; O2-NEXT:    movq $1, foo(%rip)
7656; O2-NEXT:    retq
7657;
7658; O3-LABEL: atomic64_load_seq_cst_ptr_ty:
7659; O3:       # %bb.0: # %entry
7660; O3-NEXT:    movq foo(%rip), %rax
7661; O3-NEXT:  .Lpcsection280:
7662; O3-NEXT:    movq (%rdi), %rax
7663; O3-NEXT:    movq $1, foo(%rip)
7664; O3-NEXT:    retq
7665entry:
7666  load volatile i64, ptr @foo, align 8
7667  %x = load atomic ptr, ptr %a seq_cst, align 8, !pcsections !0
7668  store volatile i64 1, ptr @foo, align 8
7669  ret ptr %x
7670}
7671
7672define void @atomic64_store_unordered(ptr %a) {
7673; O0-LABEL: atomic64_store_unordered:
7674; O0:       # %bb.0: # %entry
7675; O0-NEXT:    movq foo(%rip), %rax
7676; O0-NEXT:  .Lpcsection311:
7677; O0-NEXT:    movq $42, (%rdi)
7678; O0-NEXT:    movq $1, foo
7679; O0-NEXT:    retq
7680;
7681; O1-LABEL: atomic64_store_unordered:
7682; O1:       # %bb.0: # %entry
7683; O1-NEXT:    movq foo(%rip), %rax
7684; O1-NEXT:  .Lpcsection281:
7685; O1-NEXT:    movq $42, (%rdi)
7686; O1-NEXT:    movq $1, foo(%rip)
7687; O1-NEXT:    retq
7688;
7689; O2-LABEL: atomic64_store_unordered:
7690; O2:       # %bb.0: # %entry
7691; O2-NEXT:    movq foo(%rip), %rax
7692; O2-NEXT:  .Lpcsection281:
7693; O2-NEXT:    movq $42, (%rdi)
7694; O2-NEXT:    movq $1, foo(%rip)
7695; O2-NEXT:    retq
7696;
7697; O3-LABEL: atomic64_store_unordered:
7698; O3:       # %bb.0: # %entry
7699; O3-NEXT:    movq foo(%rip), %rax
7700; O3-NEXT:  .Lpcsection281:
7701; O3-NEXT:    movq $42, (%rdi)
7702; O3-NEXT:    movq $1, foo(%rip)
7703; O3-NEXT:    retq
7704entry:
7705  load volatile i64, ptr @foo, align 8
7706  store atomic i64 42, ptr %a unordered, align 8, !pcsections !0
7707  store volatile i64 1, ptr @foo, align 8
7708  ret void
7709}
7710
7711define void @atomic64_store_monotonic(ptr %a) {
7712; O0-LABEL: atomic64_store_monotonic:
7713; O0:       # %bb.0: # %entry
7714; O0-NEXT:    movq foo(%rip), %rax
7715; O0-NEXT:  .Lpcsection312:
7716; O0-NEXT:    movq $42, (%rdi)
7717; O0-NEXT:    movq $1, foo
7718; O0-NEXT:    retq
7719;
7720; O1-LABEL: atomic64_store_monotonic:
7721; O1:       # %bb.0: # %entry
7722; O1-NEXT:    movq foo(%rip), %rax
7723; O1-NEXT:  .Lpcsection282:
7724; O1-NEXT:    movq $42, (%rdi)
7725; O1-NEXT:    movq $1, foo(%rip)
7726; O1-NEXT:    retq
7727;
7728; O2-LABEL: atomic64_store_monotonic:
7729; O2:       # %bb.0: # %entry
7730; O2-NEXT:    movq foo(%rip), %rax
7731; O2-NEXT:  .Lpcsection282:
7732; O2-NEXT:    movq $42, (%rdi)
7733; O2-NEXT:    movq $1, foo(%rip)
7734; O2-NEXT:    retq
7735;
7736; O3-LABEL: atomic64_store_monotonic:
7737; O3:       # %bb.0: # %entry
7738; O3-NEXT:    movq foo(%rip), %rax
7739; O3-NEXT:  .Lpcsection282:
7740; O3-NEXT:    movq $42, (%rdi)
7741; O3-NEXT:    movq $1, foo(%rip)
7742; O3-NEXT:    retq
7743entry:
7744  load volatile i64, ptr @foo, align 8
7745  store atomic i64 42, ptr %a monotonic, align 8, !pcsections !0
7746  store volatile i64 1, ptr @foo, align 8
7747  ret void
7748}
7749
7750define void @atomic64_store_release(ptr %a) {
7751; O0-LABEL: atomic64_store_release:
7752; O0:       # %bb.0: # %entry
7753; O0-NEXT:    movq foo(%rip), %rax
7754; O0-NEXT:  .Lpcsection313:
7755; O0-NEXT:    movq $42, (%rdi)
7756; O0-NEXT:    movq $1, foo
7757; O0-NEXT:    retq
7758;
7759; O1-LABEL: atomic64_store_release:
7760; O1:       # %bb.0: # %entry
7761; O1-NEXT:    movq foo(%rip), %rax
7762; O1-NEXT:  .Lpcsection283:
7763; O1-NEXT:    movq $42, (%rdi)
7764; O1-NEXT:    movq $1, foo(%rip)
7765; O1-NEXT:    retq
7766;
7767; O2-LABEL: atomic64_store_release:
7768; O2:       # %bb.0: # %entry
7769; O2-NEXT:    movq foo(%rip), %rax
7770; O2-NEXT:  .Lpcsection283:
7771; O2-NEXT:    movq $42, (%rdi)
7772; O2-NEXT:    movq $1, foo(%rip)
7773; O2-NEXT:    retq
7774;
7775; O3-LABEL: atomic64_store_release:
7776; O3:       # %bb.0: # %entry
7777; O3-NEXT:    movq foo(%rip), %rax
7778; O3-NEXT:  .Lpcsection283:
7779; O3-NEXT:    movq $42, (%rdi)
7780; O3-NEXT:    movq $1, foo(%rip)
7781; O3-NEXT:    retq
7782entry:
7783  load volatile i64, ptr @foo, align 8
7784  store atomic i64 42, ptr %a release, align 8, !pcsections !0
7785  store volatile i64 1, ptr @foo, align 8
7786  ret void
7787}
7788
7789define void @atomic64_store_seq_cst(ptr %a) {
7790; O0-LABEL: atomic64_store_seq_cst:
7791; O0:       # %bb.0: # %entry
7792; O0-NEXT:    movq foo(%rip), %rax
7793; O0-NEXT:    movl $42, %eax
7794; O0-NEXT:  .Lpcsection314:
7795; O0-NEXT:    xchgq %rax, (%rdi)
7796; O0-NEXT:    movq $1, foo
7797; O0-NEXT:    retq
7798;
7799; O1-LABEL: atomic64_store_seq_cst:
7800; O1:       # %bb.0: # %entry
7801; O1-NEXT:    movq foo(%rip), %rax
7802; O1-NEXT:    movl $42, %eax
7803; O1-NEXT:  .Lpcsection284:
7804; O1-NEXT:    xchgq %rax, (%rdi)
7805; O1-NEXT:    movq $1, foo(%rip)
7806; O1-NEXT:    retq
7807;
7808; O2-LABEL: atomic64_store_seq_cst:
7809; O2:       # %bb.0: # %entry
7810; O2-NEXT:    movq foo(%rip), %rax
7811; O2-NEXT:    movl $42, %eax
7812; O2-NEXT:  .Lpcsection284:
7813; O2-NEXT:    xchgq %rax, (%rdi)
7814; O2-NEXT:    movq $1, foo(%rip)
7815; O2-NEXT:    retq
7816;
7817; O3-LABEL: atomic64_store_seq_cst:
7818; O3:       # %bb.0: # %entry
7819; O3-NEXT:    movq foo(%rip), %rax
7820; O3-NEXT:    movl $42, %eax
7821; O3-NEXT:  .Lpcsection284:
7822; O3-NEXT:    xchgq %rax, (%rdi)
7823; O3-NEXT:    movq $1, foo(%rip)
7824; O3-NEXT:    retq
7825entry:
7826  load volatile i64, ptr @foo, align 8
7827  store atomic i64 42, ptr %a seq_cst, align 8, !pcsections !0
7828  store volatile i64 1, ptr @foo, align 8
7829  ret void
7830}
7831
7832define void @atomic64_store_seq_cst_ptr_ty(ptr %a, ptr %v) {
7833; O0-LABEL: atomic64_store_seq_cst_ptr_ty:
7834; O0:       # %bb.0: # %entry
7835; O0-NEXT:    movq foo(%rip), %rax
7836; O0-NEXT:  .Lpcsection315:
7837; O0-NEXT:    xchgq %rsi, (%rdi)
7838; O0-NEXT:    movq $1, foo
7839; O0-NEXT:    retq
7840;
7841; O1-LABEL: atomic64_store_seq_cst_ptr_ty:
7842; O1:       # %bb.0: # %entry
7843; O1-NEXT:    movq foo(%rip), %rax
7844; O1-NEXT:  .Lpcsection285:
7845; O1-NEXT:    xchgq %rsi, (%rdi)
7846; O1-NEXT:    movq $1, foo(%rip)
7847; O1-NEXT:    retq
7848;
7849; O2-LABEL: atomic64_store_seq_cst_ptr_ty:
7850; O2:       # %bb.0: # %entry
7851; O2-NEXT:    movq foo(%rip), %rax
7852; O2-NEXT:  .Lpcsection285:
7853; O2-NEXT:    xchgq %rsi, (%rdi)
7854; O2-NEXT:    movq $1, foo(%rip)
7855; O2-NEXT:    retq
7856;
7857; O3-LABEL: atomic64_store_seq_cst_ptr_ty:
7858; O3:       # %bb.0: # %entry
7859; O3-NEXT:    movq foo(%rip), %rax
7860; O3-NEXT:  .Lpcsection285:
7861; O3-NEXT:    xchgq %rsi, (%rdi)
7862; O3-NEXT:    movq $1, foo(%rip)
7863; O3-NEXT:    retq
7864entry:
7865  load volatile i64, ptr @foo, align 8
7866  store atomic ptr %v, ptr %a seq_cst, align 8, !pcsections !0
7867  store volatile i64 1, ptr @foo, align 8
7868  ret void
7869}
7870
7871define void @atomic64_xchg_monotonic(ptr %a) {
7872; O0-LABEL: atomic64_xchg_monotonic:
7873; O0:       # %bb.0: # %entry
7874; O0-NEXT:    movq foo(%rip), %rax
7875; O0-NEXT:    movl $42, %eax
7876; O0-NEXT:  .Lpcsection316:
7877; O0-NEXT:    xchgq %rax, (%rdi)
7878; O0-NEXT:    movq $1, foo
7879; O0-NEXT:    retq
7880;
7881; O1-LABEL: atomic64_xchg_monotonic:
7882; O1:       # %bb.0: # %entry
7883; O1-NEXT:    movq foo(%rip), %rax
7884; O1-NEXT:    movl $42, %eax
7885; O1-NEXT:  .Lpcsection286:
7886; O1-NEXT:    xchgq %rax, (%rdi)
7887; O1-NEXT:    movq $1, foo(%rip)
7888; O1-NEXT:    retq
7889;
7890; O2-LABEL: atomic64_xchg_monotonic:
7891; O2:       # %bb.0: # %entry
7892; O2-NEXT:    movq foo(%rip), %rax
7893; O2-NEXT:    movl $42, %eax
7894; O2-NEXT:  .Lpcsection286:
7895; O2-NEXT:    xchgq %rax, (%rdi)
7896; O2-NEXT:    movq $1, foo(%rip)
7897; O2-NEXT:    retq
7898;
7899; O3-LABEL: atomic64_xchg_monotonic:
7900; O3:       # %bb.0: # %entry
7901; O3-NEXT:    movq foo(%rip), %rax
7902; O3-NEXT:    movl $42, %eax
7903; O3-NEXT:  .Lpcsection286:
7904; O3-NEXT:    xchgq %rax, (%rdi)
7905; O3-NEXT:    movq $1, foo(%rip)
7906; O3-NEXT:    retq
7907entry:
7908  load volatile i64, ptr @foo, align 8
7909  %x = atomicrmw xchg ptr %a, i64 42 monotonic, align 8, !pcsections !0
7910  store volatile i64 1, ptr @foo, align 8
7911  ret void
7912}
7913
7914define void @atomic64_add_monotonic(ptr %a) {
7915; O0-LABEL: atomic64_add_monotonic:
7916; O0:       # %bb.0: # %entry
7917; O0-NEXT:    movq foo(%rip), %rax
7918; O0-NEXT:  .Lpcsection317:
7919; O0-NEXT:    lock addq $42, (%rdi)
7920; O0-NEXT:    movq $1, foo
7921; O0-NEXT:    retq
7922;
7923; O1-LABEL: atomic64_add_monotonic:
7924; O1:       # %bb.0: # %entry
7925; O1-NEXT:    movq foo(%rip), %rax
7926; O1-NEXT:  .Lpcsection287:
7927; O1-NEXT:    lock addq $42, (%rdi)
7928; O1-NEXT:    movq $1, foo(%rip)
7929; O1-NEXT:    retq
7930;
7931; O2-LABEL: atomic64_add_monotonic:
7932; O2:       # %bb.0: # %entry
7933; O2-NEXT:    movq foo(%rip), %rax
7934; O2-NEXT:  .Lpcsection287:
7935; O2-NEXT:    lock addq $42, (%rdi)
7936; O2-NEXT:    movq $1, foo(%rip)
7937; O2-NEXT:    retq
7938;
7939; O3-LABEL: atomic64_add_monotonic:
7940; O3:       # %bb.0: # %entry
7941; O3-NEXT:    movq foo(%rip), %rax
7942; O3-NEXT:  .Lpcsection287:
7943; O3-NEXT:    lock addq $42, (%rdi)
7944; O3-NEXT:    movq $1, foo(%rip)
7945; O3-NEXT:    retq
7946entry:
7947  load volatile i64, ptr @foo, align 8
7948  %x = atomicrmw add ptr %a, i64 42 monotonic, align 8, !pcsections !0
7949  store volatile i64 1, ptr @foo, align 8
7950  ret void
7951}
7952
7953define void @atomic64_sub_monotonic(ptr %a) {
7954; O0-LABEL: atomic64_sub_monotonic:
7955; O0:       # %bb.0: # %entry
7956; O0-NEXT:    movq foo(%rip), %rax
7957; O0-NEXT:  .Lpcsection318:
7958; O0-NEXT:    lock subq $42, (%rdi)
7959; O0-NEXT:    movq $1, foo
7960; O0-NEXT:    retq
7961;
7962; O1-LABEL: atomic64_sub_monotonic:
7963; O1:       # %bb.0: # %entry
7964; O1-NEXT:    movq foo(%rip), %rax
7965; O1-NEXT:  .Lpcsection288:
7966; O1-NEXT:    lock subq $42, (%rdi)
7967; O1-NEXT:    movq $1, foo(%rip)
7968; O1-NEXT:    retq
7969;
7970; O2-LABEL: atomic64_sub_monotonic:
7971; O2:       # %bb.0: # %entry
7972; O2-NEXT:    movq foo(%rip), %rax
7973; O2-NEXT:  .Lpcsection288:
7974; O2-NEXT:    lock subq $42, (%rdi)
7975; O2-NEXT:    movq $1, foo(%rip)
7976; O2-NEXT:    retq
7977;
7978; O3-LABEL: atomic64_sub_monotonic:
7979; O3:       # %bb.0: # %entry
7980; O3-NEXT:    movq foo(%rip), %rax
7981; O3-NEXT:  .Lpcsection288:
7982; O3-NEXT:    lock subq $42, (%rdi)
7983; O3-NEXT:    movq $1, foo(%rip)
7984; O3-NEXT:    retq
7985entry:
7986  load volatile i64, ptr @foo, align 8
7987  %x = atomicrmw sub ptr %a, i64 42 monotonic, align 8, !pcsections !0
7988  store volatile i64 1, ptr @foo, align 8
7989  ret void
7990}
7991
7992define void @atomic64_and_monotonic(ptr %a) {
7993; O0-LABEL: atomic64_and_monotonic:
7994; O0:       # %bb.0: # %entry
7995; O0-NEXT:    movq foo(%rip), %rax
7996; O0-NEXT:  .Lpcsection319:
7997; O0-NEXT:    lock andq $42, (%rdi)
7998; O0-NEXT:    movq $1, foo
7999; O0-NEXT:    retq
8000;
8001; O1-LABEL: atomic64_and_monotonic:
8002; O1:       # %bb.0: # %entry
8003; O1-NEXT:    movq foo(%rip), %rax
8004; O1-NEXT:  .Lpcsection289:
8005; O1-NEXT:    lock andq $42, (%rdi)
8006; O1-NEXT:    movq $1, foo(%rip)
8007; O1-NEXT:    retq
8008;
8009; O2-LABEL: atomic64_and_monotonic:
8010; O2:       # %bb.0: # %entry
8011; O2-NEXT:    movq foo(%rip), %rax
8012; O2-NEXT:  .Lpcsection289:
8013; O2-NEXT:    lock andq $42, (%rdi)
8014; O2-NEXT:    movq $1, foo(%rip)
8015; O2-NEXT:    retq
8016;
8017; O3-LABEL: atomic64_and_monotonic:
8018; O3:       # %bb.0: # %entry
8019; O3-NEXT:    movq foo(%rip), %rax
8020; O3-NEXT:  .Lpcsection289:
8021; O3-NEXT:    lock andq $42, (%rdi)
8022; O3-NEXT:    movq $1, foo(%rip)
8023; O3-NEXT:    retq
8024entry:
8025  load volatile i64, ptr @foo, align 8
8026  %x = atomicrmw and ptr %a, i64 42 monotonic, align 8, !pcsections !0
8027  store volatile i64 1, ptr @foo, align 8
8028  ret void
8029}
8030
8031define void @atomic64_or_monotonic(ptr %a) {
8032; O0-LABEL: atomic64_or_monotonic:
8033; O0:       # %bb.0: # %entry
8034; O0-NEXT:    movq foo(%rip), %rax
8035; O0-NEXT:  .Lpcsection320:
8036; O0-NEXT:    lock orq $42, (%rdi)
8037; O0-NEXT:    movq $1, foo
8038; O0-NEXT:    retq
8039;
8040; O1-LABEL: atomic64_or_monotonic:
8041; O1:       # %bb.0: # %entry
8042; O1-NEXT:    movq foo(%rip), %rax
8043; O1-NEXT:  .Lpcsection290:
8044; O1-NEXT:    lock orq $42, (%rdi)
8045; O1-NEXT:    movq $1, foo(%rip)
8046; O1-NEXT:    retq
8047;
8048; O2-LABEL: atomic64_or_monotonic:
8049; O2:       # %bb.0: # %entry
8050; O2-NEXT:    movq foo(%rip), %rax
8051; O2-NEXT:  .Lpcsection290:
8052; O2-NEXT:    lock orq $42, (%rdi)
8053; O2-NEXT:    movq $1, foo(%rip)
8054; O2-NEXT:    retq
8055;
8056; O3-LABEL: atomic64_or_monotonic:
8057; O3:       # %bb.0: # %entry
8058; O3-NEXT:    movq foo(%rip), %rax
8059; O3-NEXT:  .Lpcsection290:
8060; O3-NEXT:    lock orq $42, (%rdi)
8061; O3-NEXT:    movq $1, foo(%rip)
8062; O3-NEXT:    retq
8063entry:
8064  load volatile i64, ptr @foo, align 8
8065  %x = atomicrmw or ptr %a, i64 42 monotonic, align 8, !pcsections !0
8066  store volatile i64 1, ptr @foo, align 8
8067  ret void
8068}
8069
8070define void @atomic64_xor_monotonic(ptr %a) {
8071; O0-LABEL: atomic64_xor_monotonic:
8072; O0:       # %bb.0: # %entry
8073; O0-NEXT:    movq foo(%rip), %rax
8074; O0-NEXT:  .Lpcsection321:
8075; O0-NEXT:    lock xorq $42, (%rdi)
8076; O0-NEXT:    movq $1, foo
8077; O0-NEXT:    retq
8078;
8079; O1-LABEL: atomic64_xor_monotonic:
8080; O1:       # %bb.0: # %entry
8081; O1-NEXT:    movq foo(%rip), %rax
8082; O1-NEXT:  .Lpcsection291:
8083; O1-NEXT:    lock xorq $42, (%rdi)
8084; O1-NEXT:    movq $1, foo(%rip)
8085; O1-NEXT:    retq
8086;
8087; O2-LABEL: atomic64_xor_monotonic:
8088; O2:       # %bb.0: # %entry
8089; O2-NEXT:    movq foo(%rip), %rax
8090; O2-NEXT:  .Lpcsection291:
8091; O2-NEXT:    lock xorq $42, (%rdi)
8092; O2-NEXT:    movq $1, foo(%rip)
8093; O2-NEXT:    retq
8094;
8095; O3-LABEL: atomic64_xor_monotonic:
8096; O3:       # %bb.0: # %entry
8097; O3-NEXT:    movq foo(%rip), %rax
8098; O3-NEXT:  .Lpcsection291:
8099; O3-NEXT:    lock xorq $42, (%rdi)
8100; O3-NEXT:    movq $1, foo(%rip)
8101; O3-NEXT:    retq
8102entry:
8103  load volatile i64, ptr @foo, align 8
8104  %x = atomicrmw xor ptr %a, i64 42 monotonic, align 8, !pcsections !0
8105  store volatile i64 1, ptr @foo, align 8
8106  ret void
8107}
8108
8109define void @atomic64_nand_monotonic(ptr %a) {
8110; O0-LABEL: atomic64_nand_monotonic:
8111; O0:       # %bb.0: # %entry
8112; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8113; O0-NEXT:    movq foo, %rax
8114; O0-NEXT:  .Lpcsection322:
8115; O0-NEXT:    movq (%rdi), %rax
8116; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8117; O0-NEXT:  .LBB162_1: # %atomicrmw.start
8118; O0-NEXT:    # =>This Inner Loop Header: Depth=1
8119; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
8120; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
8121; O0-NEXT:    movl %eax, %esi
8122; O0-NEXT:  .Lpcsection323:
8123; O0-NEXT:    notl %esi
8124; O0-NEXT:  .Lpcsection324:
8125; O0-NEXT:    # implicit-def: $rdx
8126; O0-NEXT:    movl %esi, %edx
8127; O0-NEXT:  .Lpcsection325:
8128; O0-NEXT:    orq $-43, %rdx
8129; O0-NEXT:  .Lpcsection326:
8130; O0-NEXT:    lock cmpxchgq %rdx, (%rcx)
8131; O0-NEXT:  .Lpcsection327:
8132; O0-NEXT:    sete %cl
8133; O0-NEXT:  .Lpcsection328:
8134; O0-NEXT:    testb $1, %cl
8135; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8136; O0-NEXT:  .Lpcsection329:
8137; O0-NEXT:    jne .LBB162_2
8138; O0-NEXT:    jmp .LBB162_1
8139; O0-NEXT:  .LBB162_2: # %atomicrmw.end
8140; O0-NEXT:    movq $1, foo
8141; O0-NEXT:    retq
8142;
8143; O1-LABEL: atomic64_nand_monotonic:
8144; O1:       # %bb.0: # %entry
8145; O1-NEXT:    movq foo(%rip), %rax
8146; O1-NEXT:  .Lpcsection292:
8147; O1-NEXT:    movq (%rdi), %rax
8148; O1-NEXT:    .p2align 4
8149; O1-NEXT:  .LBB162_1: # %atomicrmw.start
8150; O1-NEXT:    # =>This Inner Loop Header: Depth=1
8151; O1-NEXT:    movl %eax, %ecx
8152; O1-NEXT:  .Lpcsection293:
8153; O1-NEXT:    notl %ecx
8154; O1-NEXT:  .Lpcsection294:
8155; O1-NEXT:    orq $-43, %rcx
8156; O1-NEXT:  .Lpcsection295:
8157; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
8158; O1-NEXT:  .Lpcsection296:
8159; O1-NEXT:    jne .LBB162_1
8160; O1-NEXT:  # %bb.2: # %atomicrmw.end
8161; O1-NEXT:    movq $1, foo(%rip)
8162; O1-NEXT:    retq
8163;
8164; O2-LABEL: atomic64_nand_monotonic:
8165; O2:       # %bb.0: # %entry
8166; O2-NEXT:    movq foo(%rip), %rax
8167; O2-NEXT:  .Lpcsection292:
8168; O2-NEXT:    movq (%rdi), %rax
8169; O2-NEXT:    .p2align 4
8170; O2-NEXT:  .LBB162_1: # %atomicrmw.start
8171; O2-NEXT:    # =>This Inner Loop Header: Depth=1
8172; O2-NEXT:    movl %eax, %ecx
8173; O2-NEXT:  .Lpcsection293:
8174; O2-NEXT:    notl %ecx
8175; O2-NEXT:  .Lpcsection294:
8176; O2-NEXT:    orq $-43, %rcx
8177; O2-NEXT:  .Lpcsection295:
8178; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
8179; O2-NEXT:  .Lpcsection296:
8180; O2-NEXT:    jne .LBB162_1
8181; O2-NEXT:  # %bb.2: # %atomicrmw.end
8182; O2-NEXT:    movq $1, foo(%rip)
8183; O2-NEXT:    retq
8184;
8185; O3-LABEL: atomic64_nand_monotonic:
8186; O3:       # %bb.0: # %entry
8187; O3-NEXT:    movq foo(%rip), %rax
8188; O3-NEXT:  .Lpcsection292:
8189; O3-NEXT:    movq (%rdi), %rax
8190; O3-NEXT:    .p2align 4
8191; O3-NEXT:  .LBB162_1: # %atomicrmw.start
8192; O3-NEXT:    # =>This Inner Loop Header: Depth=1
8193; O3-NEXT:    movl %eax, %ecx
8194; O3-NEXT:  .Lpcsection293:
8195; O3-NEXT:    notl %ecx
8196; O3-NEXT:  .Lpcsection294:
8197; O3-NEXT:    orq $-43, %rcx
8198; O3-NEXT:  .Lpcsection295:
8199; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
8200; O3-NEXT:  .Lpcsection296:
8201; O3-NEXT:    jne .LBB162_1
8202; O3-NEXT:  # %bb.2: # %atomicrmw.end
8203; O3-NEXT:    movq $1, foo(%rip)
8204; O3-NEXT:    retq
8205entry:
8206  load volatile i64, ptr @foo, align 8
8207  %x = atomicrmw nand ptr %a, i64 42 monotonic, align 8, !pcsections !0
8208  store volatile i64 1, ptr @foo, align 8
8209  ret void
8210}
8211
8212define void @atomic64_xchg_acquire(ptr %a) {
8213; O0-LABEL: atomic64_xchg_acquire:
8214; O0:       # %bb.0: # %entry
8215; O0-NEXT:    movq foo(%rip), %rax
8216; O0-NEXT:    movl $42, %eax
8217; O0-NEXT:  .Lpcsection330:
8218; O0-NEXT:    xchgq %rax, (%rdi)
8219; O0-NEXT:    movq $1, foo
8220; O0-NEXT:    retq
8221;
8222; O1-LABEL: atomic64_xchg_acquire:
8223; O1:       # %bb.0: # %entry
8224; O1-NEXT:    movq foo(%rip), %rax
8225; O1-NEXT:    movl $42, %eax
8226; O1-NEXT:  .Lpcsection297:
8227; O1-NEXT:    xchgq %rax, (%rdi)
8228; O1-NEXT:    movq $1, foo(%rip)
8229; O1-NEXT:    retq
8230;
8231; O2-LABEL: atomic64_xchg_acquire:
8232; O2:       # %bb.0: # %entry
8233; O2-NEXT:    movq foo(%rip), %rax
8234; O2-NEXT:    movl $42, %eax
8235; O2-NEXT:  .Lpcsection297:
8236; O2-NEXT:    xchgq %rax, (%rdi)
8237; O2-NEXT:    movq $1, foo(%rip)
8238; O2-NEXT:    retq
8239;
8240; O3-LABEL: atomic64_xchg_acquire:
8241; O3:       # %bb.0: # %entry
8242; O3-NEXT:    movq foo(%rip), %rax
8243; O3-NEXT:    movl $42, %eax
8244; O3-NEXT:  .Lpcsection297:
8245; O3-NEXT:    xchgq %rax, (%rdi)
8246; O3-NEXT:    movq $1, foo(%rip)
8247; O3-NEXT:    retq
8248entry:
8249  load volatile i64, ptr @foo, align 8
8250  %x = atomicrmw xchg ptr %a, i64 42 acquire, align 8, !pcsections !0
8251  store volatile i64 1, ptr @foo, align 8
8252  ret void
8253}
8254
8255define void @atomic64_add_acquire(ptr %a) {
8256; O0-LABEL: atomic64_add_acquire:
8257; O0:       # %bb.0: # %entry
8258; O0-NEXT:    movq foo(%rip), %rax
8259; O0-NEXT:  .Lpcsection331:
8260; O0-NEXT:    lock addq $42, (%rdi)
8261; O0-NEXT:    movq $1, foo
8262; O0-NEXT:    retq
8263;
8264; O1-LABEL: atomic64_add_acquire:
8265; O1:       # %bb.0: # %entry
8266; O1-NEXT:    movq foo(%rip), %rax
8267; O1-NEXT:  .Lpcsection298:
8268; O1-NEXT:    lock addq $42, (%rdi)
8269; O1-NEXT:    movq $1, foo(%rip)
8270; O1-NEXT:    retq
8271;
8272; O2-LABEL: atomic64_add_acquire:
8273; O2:       # %bb.0: # %entry
8274; O2-NEXT:    movq foo(%rip), %rax
8275; O2-NEXT:  .Lpcsection298:
8276; O2-NEXT:    lock addq $42, (%rdi)
8277; O2-NEXT:    movq $1, foo(%rip)
8278; O2-NEXT:    retq
8279;
8280; O3-LABEL: atomic64_add_acquire:
8281; O3:       # %bb.0: # %entry
8282; O3-NEXT:    movq foo(%rip), %rax
8283; O3-NEXT:  .Lpcsection298:
8284; O3-NEXT:    lock addq $42, (%rdi)
8285; O3-NEXT:    movq $1, foo(%rip)
8286; O3-NEXT:    retq
8287entry:
8288  load volatile i64, ptr @foo, align 8
8289  %x = atomicrmw add ptr %a, i64 42 acquire, align 8, !pcsections !0
8290  store volatile i64 1, ptr @foo, align 8
8291  ret void
8292}
8293
8294define void @atomic64_sub_acquire(ptr %a) {
8295; O0-LABEL: atomic64_sub_acquire:
8296; O0:       # %bb.0: # %entry
8297; O0-NEXT:    movq foo(%rip), %rax
8298; O0-NEXT:  .Lpcsection332:
8299; O0-NEXT:    lock subq $42, (%rdi)
8300; O0-NEXT:    movq $1, foo
8301; O0-NEXT:    retq
8302;
8303; O1-LABEL: atomic64_sub_acquire:
8304; O1:       # %bb.0: # %entry
8305; O1-NEXT:    movq foo(%rip), %rax
8306; O1-NEXT:  .Lpcsection299:
8307; O1-NEXT:    lock subq $42, (%rdi)
8308; O1-NEXT:    movq $1, foo(%rip)
8309; O1-NEXT:    retq
8310;
8311; O2-LABEL: atomic64_sub_acquire:
8312; O2:       # %bb.0: # %entry
8313; O2-NEXT:    movq foo(%rip), %rax
8314; O2-NEXT:  .Lpcsection299:
8315; O2-NEXT:    lock subq $42, (%rdi)
8316; O2-NEXT:    movq $1, foo(%rip)
8317; O2-NEXT:    retq
8318;
8319; O3-LABEL: atomic64_sub_acquire:
8320; O3:       # %bb.0: # %entry
8321; O3-NEXT:    movq foo(%rip), %rax
8322; O3-NEXT:  .Lpcsection299:
8323; O3-NEXT:    lock subq $42, (%rdi)
8324; O3-NEXT:    movq $1, foo(%rip)
8325; O3-NEXT:    retq
8326entry:
8327  load volatile i64, ptr @foo, align 8
8328  %x = atomicrmw sub ptr %a, i64 42 acquire, align 8, !pcsections !0
8329  store volatile i64 1, ptr @foo, align 8
8330  ret void
8331}
8332
8333define void @atomic64_and_acquire(ptr %a) {
8334; O0-LABEL: atomic64_and_acquire:
8335; O0:       # %bb.0: # %entry
8336; O0-NEXT:    movq foo(%rip), %rax
8337; O0-NEXT:  .Lpcsection333:
8338; O0-NEXT:    lock andq $42, (%rdi)
8339; O0-NEXT:    movq $1, foo
8340; O0-NEXT:    retq
8341;
8342; O1-LABEL: atomic64_and_acquire:
8343; O1:       # %bb.0: # %entry
8344; O1-NEXT:    movq foo(%rip), %rax
8345; O1-NEXT:  .Lpcsection300:
8346; O1-NEXT:    lock andq $42, (%rdi)
8347; O1-NEXT:    movq $1, foo(%rip)
8348; O1-NEXT:    retq
8349;
8350; O2-LABEL: atomic64_and_acquire:
8351; O2:       # %bb.0: # %entry
8352; O2-NEXT:    movq foo(%rip), %rax
8353; O2-NEXT:  .Lpcsection300:
8354; O2-NEXT:    lock andq $42, (%rdi)
8355; O2-NEXT:    movq $1, foo(%rip)
8356; O2-NEXT:    retq
8357;
8358; O3-LABEL: atomic64_and_acquire:
8359; O3:       # %bb.0: # %entry
8360; O3-NEXT:    movq foo(%rip), %rax
8361; O3-NEXT:  .Lpcsection300:
8362; O3-NEXT:    lock andq $42, (%rdi)
8363; O3-NEXT:    movq $1, foo(%rip)
8364; O3-NEXT:    retq
8365entry:
8366  load volatile i64, ptr @foo, align 8
8367  %x = atomicrmw and ptr %a, i64 42 acquire, align 8, !pcsections !0
8368  store volatile i64 1, ptr @foo, align 8
8369  ret void
8370}
8371
8372define void @atomic64_or_acquire(ptr %a) {
8373; O0-LABEL: atomic64_or_acquire:
8374; O0:       # %bb.0: # %entry
8375; O0-NEXT:    movq foo(%rip), %rax
8376; O0-NEXT:  .Lpcsection334:
8377; O0-NEXT:    lock orq $42, (%rdi)
8378; O0-NEXT:    movq $1, foo
8379; O0-NEXT:    retq
8380;
8381; O1-LABEL: atomic64_or_acquire:
8382; O1:       # %bb.0: # %entry
8383; O1-NEXT:    movq foo(%rip), %rax
8384; O1-NEXT:  .Lpcsection301:
8385; O1-NEXT:    lock orq $42, (%rdi)
8386; O1-NEXT:    movq $1, foo(%rip)
8387; O1-NEXT:    retq
8388;
8389; O2-LABEL: atomic64_or_acquire:
8390; O2:       # %bb.0: # %entry
8391; O2-NEXT:    movq foo(%rip), %rax
8392; O2-NEXT:  .Lpcsection301:
8393; O2-NEXT:    lock orq $42, (%rdi)
8394; O2-NEXT:    movq $1, foo(%rip)
8395; O2-NEXT:    retq
8396;
8397; O3-LABEL: atomic64_or_acquire:
8398; O3:       # %bb.0: # %entry
8399; O3-NEXT:    movq foo(%rip), %rax
8400; O3-NEXT:  .Lpcsection301:
8401; O3-NEXT:    lock orq $42, (%rdi)
8402; O3-NEXT:    movq $1, foo(%rip)
8403; O3-NEXT:    retq
8404entry:
8405  load volatile i64, ptr @foo, align 8
8406  %x = atomicrmw or ptr %a, i64 42 acquire, align 8, !pcsections !0
8407  store volatile i64 1, ptr @foo, align 8
8408  ret void
8409}
8410
8411define void @atomic64_xor_acquire(ptr %a) {
8412; O0-LABEL: atomic64_xor_acquire:
8413; O0:       # %bb.0: # %entry
8414; O0-NEXT:    movq foo(%rip), %rax
8415; O0-NEXT:  .Lpcsection335:
8416; O0-NEXT:    lock xorq $42, (%rdi)
8417; O0-NEXT:    movq $1, foo
8418; O0-NEXT:    retq
8419;
8420; O1-LABEL: atomic64_xor_acquire:
8421; O1:       # %bb.0: # %entry
8422; O1-NEXT:    movq foo(%rip), %rax
8423; O1-NEXT:  .Lpcsection302:
8424; O1-NEXT:    lock xorq $42, (%rdi)
8425; O1-NEXT:    movq $1, foo(%rip)
8426; O1-NEXT:    retq
8427;
8428; O2-LABEL: atomic64_xor_acquire:
8429; O2:       # %bb.0: # %entry
8430; O2-NEXT:    movq foo(%rip), %rax
8431; O2-NEXT:  .Lpcsection302:
8432; O2-NEXT:    lock xorq $42, (%rdi)
8433; O2-NEXT:    movq $1, foo(%rip)
8434; O2-NEXT:    retq
8435;
8436; O3-LABEL: atomic64_xor_acquire:
8437; O3:       # %bb.0: # %entry
8438; O3-NEXT:    movq foo(%rip), %rax
8439; O3-NEXT:  .Lpcsection302:
8440; O3-NEXT:    lock xorq $42, (%rdi)
8441; O3-NEXT:    movq $1, foo(%rip)
8442; O3-NEXT:    retq
8443entry:
8444  load volatile i64, ptr @foo, align 8
8445  %x = atomicrmw xor ptr %a, i64 42 acquire, align 8, !pcsections !0
8446  store volatile i64 1, ptr @foo, align 8
8447  ret void
8448}
8449
8450define void @atomic64_nand_acquire(ptr %a) {
8451; O0-LABEL: atomic64_nand_acquire:
8452; O0:       # %bb.0: # %entry
8453; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8454; O0-NEXT:    movq foo, %rax
8455; O0-NEXT:  .Lpcsection336:
8456; O0-NEXT:    movq (%rdi), %rax
8457; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8458; O0-NEXT:  .LBB169_1: # %atomicrmw.start
8459; O0-NEXT:    # =>This Inner Loop Header: Depth=1
8460; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
8461; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
8462; O0-NEXT:    movl %eax, %esi
8463; O0-NEXT:  .Lpcsection337:
8464; O0-NEXT:    notl %esi
8465; O0-NEXT:  .Lpcsection338:
8466; O0-NEXT:    # implicit-def: $rdx
8467; O0-NEXT:    movl %esi, %edx
8468; O0-NEXT:  .Lpcsection339:
8469; O0-NEXT:    orq $-43, %rdx
8470; O0-NEXT:  .Lpcsection340:
8471; O0-NEXT:    lock cmpxchgq %rdx, (%rcx)
8472; O0-NEXT:  .Lpcsection341:
8473; O0-NEXT:    sete %cl
8474; O0-NEXT:  .Lpcsection342:
8475; O0-NEXT:    testb $1, %cl
8476; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8477; O0-NEXT:  .Lpcsection343:
8478; O0-NEXT:    jne .LBB169_2
8479; O0-NEXT:    jmp .LBB169_1
8480; O0-NEXT:  .LBB169_2: # %atomicrmw.end
8481; O0-NEXT:    movq $1, foo
8482; O0-NEXT:    retq
8483;
8484; O1-LABEL: atomic64_nand_acquire:
8485; O1:       # %bb.0: # %entry
8486; O1-NEXT:    movq foo(%rip), %rax
8487; O1-NEXT:  .Lpcsection303:
8488; O1-NEXT:    movq (%rdi), %rax
8489; O1-NEXT:    .p2align 4
8490; O1-NEXT:  .LBB169_1: # %atomicrmw.start
8491; O1-NEXT:    # =>This Inner Loop Header: Depth=1
8492; O1-NEXT:    movl %eax, %ecx
8493; O1-NEXT:  .Lpcsection304:
8494; O1-NEXT:    notl %ecx
8495; O1-NEXT:  .Lpcsection305:
8496; O1-NEXT:    orq $-43, %rcx
8497; O1-NEXT:  .Lpcsection306:
8498; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
8499; O1-NEXT:  .Lpcsection307:
8500; O1-NEXT:    jne .LBB169_1
8501; O1-NEXT:  # %bb.2: # %atomicrmw.end
8502; O1-NEXT:    movq $1, foo(%rip)
8503; O1-NEXT:    retq
8504;
8505; O2-LABEL: atomic64_nand_acquire:
8506; O2:       # %bb.0: # %entry
8507; O2-NEXT:    movq foo(%rip), %rax
8508; O2-NEXT:  .Lpcsection303:
8509; O2-NEXT:    movq (%rdi), %rax
8510; O2-NEXT:    .p2align 4
8511; O2-NEXT:  .LBB169_1: # %atomicrmw.start
8512; O2-NEXT:    # =>This Inner Loop Header: Depth=1
8513; O2-NEXT:    movl %eax, %ecx
8514; O2-NEXT:  .Lpcsection304:
8515; O2-NEXT:    notl %ecx
8516; O2-NEXT:  .Lpcsection305:
8517; O2-NEXT:    orq $-43, %rcx
8518; O2-NEXT:  .Lpcsection306:
8519; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
8520; O2-NEXT:  .Lpcsection307:
8521; O2-NEXT:    jne .LBB169_1
8522; O2-NEXT:  # %bb.2: # %atomicrmw.end
8523; O2-NEXT:    movq $1, foo(%rip)
8524; O2-NEXT:    retq
8525;
8526; O3-LABEL: atomic64_nand_acquire:
8527; O3:       # %bb.0: # %entry
8528; O3-NEXT:    movq foo(%rip), %rax
8529; O3-NEXT:  .Lpcsection303:
8530; O3-NEXT:    movq (%rdi), %rax
8531; O3-NEXT:    .p2align 4
8532; O3-NEXT:  .LBB169_1: # %atomicrmw.start
8533; O3-NEXT:    # =>This Inner Loop Header: Depth=1
8534; O3-NEXT:    movl %eax, %ecx
8535; O3-NEXT:  .Lpcsection304:
8536; O3-NEXT:    notl %ecx
8537; O3-NEXT:  .Lpcsection305:
8538; O3-NEXT:    orq $-43, %rcx
8539; O3-NEXT:  .Lpcsection306:
8540; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
8541; O3-NEXT:  .Lpcsection307:
8542; O3-NEXT:    jne .LBB169_1
8543; O3-NEXT:  # %bb.2: # %atomicrmw.end
8544; O3-NEXT:    movq $1, foo(%rip)
8545; O3-NEXT:    retq
8546entry:
8547  load volatile i64, ptr @foo, align 8
8548  %x = atomicrmw nand ptr %a, i64 42 acquire, align 8, !pcsections !0
8549  store volatile i64 1, ptr @foo, align 8
8550  ret void
8551}
8552
8553define void @atomic64_xchg_release(ptr %a) {
8554; O0-LABEL: atomic64_xchg_release:
8555; O0:       # %bb.0: # %entry
8556; O0-NEXT:    movq foo(%rip), %rax
8557; O0-NEXT:    movl $42, %eax
8558; O0-NEXT:  .Lpcsection344:
8559; O0-NEXT:    xchgq %rax, (%rdi)
8560; O0-NEXT:    movq $1, foo
8561; O0-NEXT:    retq
8562;
8563; O1-LABEL: atomic64_xchg_release:
8564; O1:       # %bb.0: # %entry
8565; O1-NEXT:    movq foo(%rip), %rax
8566; O1-NEXT:    movl $42, %eax
8567; O1-NEXT:  .Lpcsection308:
8568; O1-NEXT:    xchgq %rax, (%rdi)
8569; O1-NEXT:    movq $1, foo(%rip)
8570; O1-NEXT:    retq
8571;
8572; O2-LABEL: atomic64_xchg_release:
8573; O2:       # %bb.0: # %entry
8574; O2-NEXT:    movq foo(%rip), %rax
8575; O2-NEXT:    movl $42, %eax
8576; O2-NEXT:  .Lpcsection308:
8577; O2-NEXT:    xchgq %rax, (%rdi)
8578; O2-NEXT:    movq $1, foo(%rip)
8579; O2-NEXT:    retq
8580;
8581; O3-LABEL: atomic64_xchg_release:
8582; O3:       # %bb.0: # %entry
8583; O3-NEXT:    movq foo(%rip), %rax
8584; O3-NEXT:    movl $42, %eax
8585; O3-NEXT:  .Lpcsection308:
8586; O3-NEXT:    xchgq %rax, (%rdi)
8587; O3-NEXT:    movq $1, foo(%rip)
8588; O3-NEXT:    retq
8589entry:
8590  load volatile i64, ptr @foo, align 8
8591  %x = atomicrmw xchg ptr %a, i64 42 release, align 8, !pcsections !0
8592  store volatile i64 1, ptr @foo, align 8
8593  ret void
8594}
8595
8596define void @atomic64_add_release(ptr %a) {
8597; O0-LABEL: atomic64_add_release:
8598; O0:       # %bb.0: # %entry
8599; O0-NEXT:    movq foo(%rip), %rax
8600; O0-NEXT:  .Lpcsection345:
8601; O0-NEXT:    lock addq $42, (%rdi)
8602; O0-NEXT:    movq $1, foo
8603; O0-NEXT:    retq
8604;
8605; O1-LABEL: atomic64_add_release:
8606; O1:       # %bb.0: # %entry
8607; O1-NEXT:    movq foo(%rip), %rax
8608; O1-NEXT:  .Lpcsection309:
8609; O1-NEXT:    lock addq $42, (%rdi)
8610; O1-NEXT:    movq $1, foo(%rip)
8611; O1-NEXT:    retq
8612;
8613; O2-LABEL: atomic64_add_release:
8614; O2:       # %bb.0: # %entry
8615; O2-NEXT:    movq foo(%rip), %rax
8616; O2-NEXT:  .Lpcsection309:
8617; O2-NEXT:    lock addq $42, (%rdi)
8618; O2-NEXT:    movq $1, foo(%rip)
8619; O2-NEXT:    retq
8620;
8621; O3-LABEL: atomic64_add_release:
8622; O3:       # %bb.0: # %entry
8623; O3-NEXT:    movq foo(%rip), %rax
8624; O3-NEXT:  .Lpcsection309:
8625; O3-NEXT:    lock addq $42, (%rdi)
8626; O3-NEXT:    movq $1, foo(%rip)
8627; O3-NEXT:    retq
8628entry:
8629  load volatile i64, ptr @foo, align 8
8630  %x = atomicrmw add ptr %a, i64 42 release, align 8, !pcsections !0
8631  store volatile i64 1, ptr @foo, align 8
8632  ret void
8633}
8634
8635define void @atomic64_sub_release(ptr %a) {
8636; O0-LABEL: atomic64_sub_release:
8637; O0:       # %bb.0: # %entry
8638; O0-NEXT:    movq foo(%rip), %rax
8639; O0-NEXT:  .Lpcsection346:
8640; O0-NEXT:    lock subq $42, (%rdi)
8641; O0-NEXT:    movq $1, foo
8642; O0-NEXT:    retq
8643;
8644; O1-LABEL: atomic64_sub_release:
8645; O1:       # %bb.0: # %entry
8646; O1-NEXT:    movq foo(%rip), %rax
8647; O1-NEXT:  .Lpcsection310:
8648; O1-NEXT:    lock subq $42, (%rdi)
8649; O1-NEXT:    movq $1, foo(%rip)
8650; O1-NEXT:    retq
8651;
8652; O2-LABEL: atomic64_sub_release:
8653; O2:       # %bb.0: # %entry
8654; O2-NEXT:    movq foo(%rip), %rax
8655; O2-NEXT:  .Lpcsection310:
8656; O2-NEXT:    lock subq $42, (%rdi)
8657; O2-NEXT:    movq $1, foo(%rip)
8658; O2-NEXT:    retq
8659;
8660; O3-LABEL: atomic64_sub_release:
8661; O3:       # %bb.0: # %entry
8662; O3-NEXT:    movq foo(%rip), %rax
8663; O3-NEXT:  .Lpcsection310:
8664; O3-NEXT:    lock subq $42, (%rdi)
8665; O3-NEXT:    movq $1, foo(%rip)
8666; O3-NEXT:    retq
8667entry:
8668  load volatile i64, ptr @foo, align 8
8669  %x = atomicrmw sub ptr %a, i64 42 release, align 8, !pcsections !0
8670  store volatile i64 1, ptr @foo, align 8
8671  ret void
8672}
8673
8674define void @atomic64_and_release(ptr %a) {
8675; O0-LABEL: atomic64_and_release:
8676; O0:       # %bb.0: # %entry
8677; O0-NEXT:    movq foo(%rip), %rax
8678; O0-NEXT:  .Lpcsection347:
8679; O0-NEXT:    lock andq $42, (%rdi)
8680; O0-NEXT:    movq $1, foo
8681; O0-NEXT:    retq
8682;
8683; O1-LABEL: atomic64_and_release:
8684; O1:       # %bb.0: # %entry
8685; O1-NEXT:    movq foo(%rip), %rax
8686; O1-NEXT:  .Lpcsection311:
8687; O1-NEXT:    lock andq $42, (%rdi)
8688; O1-NEXT:    movq $1, foo(%rip)
8689; O1-NEXT:    retq
8690;
8691; O2-LABEL: atomic64_and_release:
8692; O2:       # %bb.0: # %entry
8693; O2-NEXT:    movq foo(%rip), %rax
8694; O2-NEXT:  .Lpcsection311:
8695; O2-NEXT:    lock andq $42, (%rdi)
8696; O2-NEXT:    movq $1, foo(%rip)
8697; O2-NEXT:    retq
8698;
8699; O3-LABEL: atomic64_and_release:
8700; O3:       # %bb.0: # %entry
8701; O3-NEXT:    movq foo(%rip), %rax
8702; O3-NEXT:  .Lpcsection311:
8703; O3-NEXT:    lock andq $42, (%rdi)
8704; O3-NEXT:    movq $1, foo(%rip)
8705; O3-NEXT:    retq
8706entry:
8707  load volatile i64, ptr @foo, align 8
8708  %x = atomicrmw and ptr %a, i64 42 release, align 8, !pcsections !0
8709  store volatile i64 1, ptr @foo, align 8
8710  ret void
8711}
8712
8713define void @atomic64_or_release(ptr %a) {
8714; O0-LABEL: atomic64_or_release:
8715; O0:       # %bb.0: # %entry
8716; O0-NEXT:    movq foo(%rip), %rax
8717; O0-NEXT:  .Lpcsection348:
8718; O0-NEXT:    lock orq $42, (%rdi)
8719; O0-NEXT:    movq $1, foo
8720; O0-NEXT:    retq
8721;
8722; O1-LABEL: atomic64_or_release:
8723; O1:       # %bb.0: # %entry
8724; O1-NEXT:    movq foo(%rip), %rax
8725; O1-NEXT:  .Lpcsection312:
8726; O1-NEXT:    lock orq $42, (%rdi)
8727; O1-NEXT:    movq $1, foo(%rip)
8728; O1-NEXT:    retq
8729;
8730; O2-LABEL: atomic64_or_release:
8731; O2:       # %bb.0: # %entry
8732; O2-NEXT:    movq foo(%rip), %rax
8733; O2-NEXT:  .Lpcsection312:
8734; O2-NEXT:    lock orq $42, (%rdi)
8735; O2-NEXT:    movq $1, foo(%rip)
8736; O2-NEXT:    retq
8737;
8738; O3-LABEL: atomic64_or_release:
8739; O3:       # %bb.0: # %entry
8740; O3-NEXT:    movq foo(%rip), %rax
8741; O3-NEXT:  .Lpcsection312:
8742; O3-NEXT:    lock orq $42, (%rdi)
8743; O3-NEXT:    movq $1, foo(%rip)
8744; O3-NEXT:    retq
8745entry:
8746  load volatile i64, ptr @foo, align 8
8747  %x = atomicrmw or ptr %a, i64 42 release, align 8, !pcsections !0
8748  store volatile i64 1, ptr @foo, align 8
8749  ret void
8750}
8751
8752define void @atomic64_xor_release(ptr %a) {
8753; O0-LABEL: atomic64_xor_release:
8754; O0:       # %bb.0: # %entry
8755; O0-NEXT:    movq foo(%rip), %rax
8756; O0-NEXT:  .Lpcsection349:
8757; O0-NEXT:    lock xorq $42, (%rdi)
8758; O0-NEXT:    movq $1, foo
8759; O0-NEXT:    retq
8760;
8761; O1-LABEL: atomic64_xor_release:
8762; O1:       # %bb.0: # %entry
8763; O1-NEXT:    movq foo(%rip), %rax
8764; O1-NEXT:  .Lpcsection313:
8765; O1-NEXT:    lock xorq $42, (%rdi)
8766; O1-NEXT:    movq $1, foo(%rip)
8767; O1-NEXT:    retq
8768;
8769; O2-LABEL: atomic64_xor_release:
8770; O2:       # %bb.0: # %entry
8771; O2-NEXT:    movq foo(%rip), %rax
8772; O2-NEXT:  .Lpcsection313:
8773; O2-NEXT:    lock xorq $42, (%rdi)
8774; O2-NEXT:    movq $1, foo(%rip)
8775; O2-NEXT:    retq
8776;
8777; O3-LABEL: atomic64_xor_release:
8778; O3:       # %bb.0: # %entry
8779; O3-NEXT:    movq foo(%rip), %rax
8780; O3-NEXT:  .Lpcsection313:
8781; O3-NEXT:    lock xorq $42, (%rdi)
8782; O3-NEXT:    movq $1, foo(%rip)
8783; O3-NEXT:    retq
8784entry:
8785  load volatile i64, ptr @foo, align 8
8786  %x = atomicrmw xor ptr %a, i64 42 release, align 8, !pcsections !0
8787  store volatile i64 1, ptr @foo, align 8
8788  ret void
8789}
8790
8791define void @atomic64_nand_release(ptr %a) {
8792; O0-LABEL: atomic64_nand_release:
8793; O0:       # %bb.0: # %entry
8794; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8795; O0-NEXT:    movq foo, %rax
8796; O0-NEXT:  .Lpcsection350:
8797; O0-NEXT:    movq (%rdi), %rax
8798; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8799; O0-NEXT:  .LBB176_1: # %atomicrmw.start
8800; O0-NEXT:    # =>This Inner Loop Header: Depth=1
8801; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
8802; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
8803; O0-NEXT:    movl %eax, %esi
8804; O0-NEXT:  .Lpcsection351:
8805; O0-NEXT:    notl %esi
8806; O0-NEXT:  .Lpcsection352:
8807; O0-NEXT:    # implicit-def: $rdx
8808; O0-NEXT:    movl %esi, %edx
8809; O0-NEXT:  .Lpcsection353:
8810; O0-NEXT:    orq $-43, %rdx
8811; O0-NEXT:  .Lpcsection354:
8812; O0-NEXT:    lock cmpxchgq %rdx, (%rcx)
8813; O0-NEXT:  .Lpcsection355:
8814; O0-NEXT:    sete %cl
8815; O0-NEXT:  .Lpcsection356:
8816; O0-NEXT:    testb $1, %cl
8817; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
8818; O0-NEXT:  .Lpcsection357:
8819; O0-NEXT:    jne .LBB176_2
8820; O0-NEXT:    jmp .LBB176_1
8821; O0-NEXT:  .LBB176_2: # %atomicrmw.end
8822; O0-NEXT:    movq $1, foo
8823; O0-NEXT:    retq
8824;
8825; O1-LABEL: atomic64_nand_release:
8826; O1:       # %bb.0: # %entry
8827; O1-NEXT:    movq foo(%rip), %rax
8828; O1-NEXT:  .Lpcsection314:
8829; O1-NEXT:    movq (%rdi), %rax
8830; O1-NEXT:    .p2align 4
8831; O1-NEXT:  .LBB176_1: # %atomicrmw.start
8832; O1-NEXT:    # =>This Inner Loop Header: Depth=1
8833; O1-NEXT:    movl %eax, %ecx
8834; O1-NEXT:  .Lpcsection315:
8835; O1-NEXT:    notl %ecx
8836; O1-NEXT:  .Lpcsection316:
8837; O1-NEXT:    orq $-43, %rcx
8838; O1-NEXT:  .Lpcsection317:
8839; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
8840; O1-NEXT:  .Lpcsection318:
8841; O1-NEXT:    jne .LBB176_1
8842; O1-NEXT:  # %bb.2: # %atomicrmw.end
8843; O1-NEXT:    movq $1, foo(%rip)
8844; O1-NEXT:    retq
8845;
8846; O2-LABEL: atomic64_nand_release:
8847; O2:       # %bb.0: # %entry
8848; O2-NEXT:    movq foo(%rip), %rax
8849; O2-NEXT:  .Lpcsection314:
8850; O2-NEXT:    movq (%rdi), %rax
8851; O2-NEXT:    .p2align 4
8852; O2-NEXT:  .LBB176_1: # %atomicrmw.start
8853; O2-NEXT:    # =>This Inner Loop Header: Depth=1
8854; O2-NEXT:    movl %eax, %ecx
8855; O2-NEXT:  .Lpcsection315:
8856; O2-NEXT:    notl %ecx
8857; O2-NEXT:  .Lpcsection316:
8858; O2-NEXT:    orq $-43, %rcx
8859; O2-NEXT:  .Lpcsection317:
8860; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
8861; O2-NEXT:  .Lpcsection318:
8862; O2-NEXT:    jne .LBB176_1
8863; O2-NEXT:  # %bb.2: # %atomicrmw.end
8864; O2-NEXT:    movq $1, foo(%rip)
8865; O2-NEXT:    retq
8866;
8867; O3-LABEL: atomic64_nand_release:
8868; O3:       # %bb.0: # %entry
8869; O3-NEXT:    movq foo(%rip), %rax
8870; O3-NEXT:  .Lpcsection314:
8871; O3-NEXT:    movq (%rdi), %rax
8872; O3-NEXT:    .p2align 4
8873; O3-NEXT:  .LBB176_1: # %atomicrmw.start
8874; O3-NEXT:    # =>This Inner Loop Header: Depth=1
8875; O3-NEXT:    movl %eax, %ecx
8876; O3-NEXT:  .Lpcsection315:
8877; O3-NEXT:    notl %ecx
8878; O3-NEXT:  .Lpcsection316:
8879; O3-NEXT:    orq $-43, %rcx
8880; O3-NEXT:  .Lpcsection317:
8881; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
8882; O3-NEXT:  .Lpcsection318:
8883; O3-NEXT:    jne .LBB176_1
8884; O3-NEXT:  # %bb.2: # %atomicrmw.end
8885; O3-NEXT:    movq $1, foo(%rip)
8886; O3-NEXT:    retq
8887entry:
8888  load volatile i64, ptr @foo, align 8
8889  %x = atomicrmw nand ptr %a, i64 42 release, align 8, !pcsections !0
8890  store volatile i64 1, ptr @foo, align 8
8891  ret void
8892}
8893
8894define void @atomic64_xchg_acq_rel(ptr %a) {
8895; O0-LABEL: atomic64_xchg_acq_rel:
8896; O0:       # %bb.0: # %entry
8897; O0-NEXT:    movq foo(%rip), %rax
8898; O0-NEXT:    movl $42, %eax
8899; O0-NEXT:  .Lpcsection358:
8900; O0-NEXT:    xchgq %rax, (%rdi)
8901; O0-NEXT:    movq $1, foo
8902; O0-NEXT:    retq
8903;
8904; O1-LABEL: atomic64_xchg_acq_rel:
8905; O1:       # %bb.0: # %entry
8906; O1-NEXT:    movq foo(%rip), %rax
8907; O1-NEXT:    movl $42, %eax
8908; O1-NEXT:  .Lpcsection319:
8909; O1-NEXT:    xchgq %rax, (%rdi)
8910; O1-NEXT:    movq $1, foo(%rip)
8911; O1-NEXT:    retq
8912;
8913; O2-LABEL: atomic64_xchg_acq_rel:
8914; O2:       # %bb.0: # %entry
8915; O2-NEXT:    movq foo(%rip), %rax
8916; O2-NEXT:    movl $42, %eax
8917; O2-NEXT:  .Lpcsection319:
8918; O2-NEXT:    xchgq %rax, (%rdi)
8919; O2-NEXT:    movq $1, foo(%rip)
8920; O2-NEXT:    retq
8921;
8922; O3-LABEL: atomic64_xchg_acq_rel:
8923; O3:       # %bb.0: # %entry
8924; O3-NEXT:    movq foo(%rip), %rax
8925; O3-NEXT:    movl $42, %eax
8926; O3-NEXT:  .Lpcsection319:
8927; O3-NEXT:    xchgq %rax, (%rdi)
8928; O3-NEXT:    movq $1, foo(%rip)
8929; O3-NEXT:    retq
8930entry:
8931  load volatile i64, ptr @foo, align 8
8932  %x = atomicrmw xchg ptr %a, i64 42 acq_rel, align 8, !pcsections !0
8933  store volatile i64 1, ptr @foo, align 8
8934  ret void
8935}
8936
8937define void @atomic64_add_acq_rel(ptr %a) {
8938; O0-LABEL: atomic64_add_acq_rel:
8939; O0:       # %bb.0: # %entry
8940; O0-NEXT:    movq foo(%rip), %rax
8941; O0-NEXT:  .Lpcsection359:
8942; O0-NEXT:    lock addq $42, (%rdi)
8943; O0-NEXT:    movq $1, foo
8944; O0-NEXT:    retq
8945;
8946; O1-LABEL: atomic64_add_acq_rel:
8947; O1:       # %bb.0: # %entry
8948; O1-NEXT:    movq foo(%rip), %rax
8949; O1-NEXT:  .Lpcsection320:
8950; O1-NEXT:    lock addq $42, (%rdi)
8951; O1-NEXT:    movq $1, foo(%rip)
8952; O1-NEXT:    retq
8953;
8954; O2-LABEL: atomic64_add_acq_rel:
8955; O2:       # %bb.0: # %entry
8956; O2-NEXT:    movq foo(%rip), %rax
8957; O2-NEXT:  .Lpcsection320:
8958; O2-NEXT:    lock addq $42, (%rdi)
8959; O2-NEXT:    movq $1, foo(%rip)
8960; O2-NEXT:    retq
8961;
8962; O3-LABEL: atomic64_add_acq_rel:
8963; O3:       # %bb.0: # %entry
8964; O3-NEXT:    movq foo(%rip), %rax
8965; O3-NEXT:  .Lpcsection320:
8966; O3-NEXT:    lock addq $42, (%rdi)
8967; O3-NEXT:    movq $1, foo(%rip)
8968; O3-NEXT:    retq
8969entry:
8970  load volatile i64, ptr @foo, align 8
8971  %x = atomicrmw add ptr %a, i64 42 acq_rel, align 8, !pcsections !0
8972  store volatile i64 1, ptr @foo, align 8
8973  ret void
8974}
8975
8976define void @atomic64_sub_acq_rel(ptr %a) {
8977; O0-LABEL: atomic64_sub_acq_rel:
8978; O0:       # %bb.0: # %entry
8979; O0-NEXT:    movq foo(%rip), %rax
8980; O0-NEXT:  .Lpcsection360:
8981; O0-NEXT:    lock subq $42, (%rdi)
8982; O0-NEXT:    movq $1, foo
8983; O0-NEXT:    retq
8984;
8985; O1-LABEL: atomic64_sub_acq_rel:
8986; O1:       # %bb.0: # %entry
8987; O1-NEXT:    movq foo(%rip), %rax
8988; O1-NEXT:  .Lpcsection321:
8989; O1-NEXT:    lock subq $42, (%rdi)
8990; O1-NEXT:    movq $1, foo(%rip)
8991; O1-NEXT:    retq
8992;
8993; O2-LABEL: atomic64_sub_acq_rel:
8994; O2:       # %bb.0: # %entry
8995; O2-NEXT:    movq foo(%rip), %rax
8996; O2-NEXT:  .Lpcsection321:
8997; O2-NEXT:    lock subq $42, (%rdi)
8998; O2-NEXT:    movq $1, foo(%rip)
8999; O2-NEXT:    retq
9000;
9001; O3-LABEL: atomic64_sub_acq_rel:
9002; O3:       # %bb.0: # %entry
9003; O3-NEXT:    movq foo(%rip), %rax
9004; O3-NEXT:  .Lpcsection321:
9005; O3-NEXT:    lock subq $42, (%rdi)
9006; O3-NEXT:    movq $1, foo(%rip)
9007; O3-NEXT:    retq
9008entry:
9009  load volatile i64, ptr @foo, align 8
9010  %x = atomicrmw sub ptr %a, i64 42 acq_rel, align 8, !pcsections !0
9011  store volatile i64 1, ptr @foo, align 8
9012  ret void
9013}
9014
9015define void @atomic64_and_acq_rel(ptr %a) {
9016; O0-LABEL: atomic64_and_acq_rel:
9017; O0:       # %bb.0: # %entry
9018; O0-NEXT:    movq foo(%rip), %rax
9019; O0-NEXT:  .Lpcsection361:
9020; O0-NEXT:    lock andq $42, (%rdi)
9021; O0-NEXT:    movq $1, foo
9022; O0-NEXT:    retq
9023;
9024; O1-LABEL: atomic64_and_acq_rel:
9025; O1:       # %bb.0: # %entry
9026; O1-NEXT:    movq foo(%rip), %rax
9027; O1-NEXT:  .Lpcsection322:
9028; O1-NEXT:    lock andq $42, (%rdi)
9029; O1-NEXT:    movq $1, foo(%rip)
9030; O1-NEXT:    retq
9031;
9032; O2-LABEL: atomic64_and_acq_rel:
9033; O2:       # %bb.0: # %entry
9034; O2-NEXT:    movq foo(%rip), %rax
9035; O2-NEXT:  .Lpcsection322:
9036; O2-NEXT:    lock andq $42, (%rdi)
9037; O2-NEXT:    movq $1, foo(%rip)
9038; O2-NEXT:    retq
9039;
9040; O3-LABEL: atomic64_and_acq_rel:
9041; O3:       # %bb.0: # %entry
9042; O3-NEXT:    movq foo(%rip), %rax
9043; O3-NEXT:  .Lpcsection322:
9044; O3-NEXT:    lock andq $42, (%rdi)
9045; O3-NEXT:    movq $1, foo(%rip)
9046; O3-NEXT:    retq
9047entry:
9048  load volatile i64, ptr @foo, align 8
9049  %x = atomicrmw and ptr %a, i64 42 acq_rel, align 8, !pcsections !0
9050  store volatile i64 1, ptr @foo, align 8
9051  ret void
9052}
9053
9054define void @atomic64_or_acq_rel(ptr %a) {
9055; O0-LABEL: atomic64_or_acq_rel:
9056; O0:       # %bb.0: # %entry
9057; O0-NEXT:    movq foo(%rip), %rax
9058; O0-NEXT:  .Lpcsection362:
9059; O0-NEXT:    lock orq $42, (%rdi)
9060; O0-NEXT:    movq $1, foo
9061; O0-NEXT:    retq
9062;
9063; O1-LABEL: atomic64_or_acq_rel:
9064; O1:       # %bb.0: # %entry
9065; O1-NEXT:    movq foo(%rip), %rax
9066; O1-NEXT:  .Lpcsection323:
9067; O1-NEXT:    lock orq $42, (%rdi)
9068; O1-NEXT:    movq $1, foo(%rip)
9069; O1-NEXT:    retq
9070;
9071; O2-LABEL: atomic64_or_acq_rel:
9072; O2:       # %bb.0: # %entry
9073; O2-NEXT:    movq foo(%rip), %rax
9074; O2-NEXT:  .Lpcsection323:
9075; O2-NEXT:    lock orq $42, (%rdi)
9076; O2-NEXT:    movq $1, foo(%rip)
9077; O2-NEXT:    retq
9078;
9079; O3-LABEL: atomic64_or_acq_rel:
9080; O3:       # %bb.0: # %entry
9081; O3-NEXT:    movq foo(%rip), %rax
9082; O3-NEXT:  .Lpcsection323:
9083; O3-NEXT:    lock orq $42, (%rdi)
9084; O3-NEXT:    movq $1, foo(%rip)
9085; O3-NEXT:    retq
9086entry:
9087  load volatile i64, ptr @foo, align 8
9088  %x = atomicrmw or ptr %a, i64 42 acq_rel, align 8, !pcsections !0
9089  store volatile i64 1, ptr @foo, align 8
9090  ret void
9091}
9092
9093define void @atomic64_xor_acq_rel(ptr %a) {
9094; O0-LABEL: atomic64_xor_acq_rel:
9095; O0:       # %bb.0: # %entry
9096; O0-NEXT:    movq foo(%rip), %rax
9097; O0-NEXT:  .Lpcsection363:
9098; O0-NEXT:    lock xorq $42, (%rdi)
9099; O0-NEXT:    movq $1, foo
9100; O0-NEXT:    retq
9101;
9102; O1-LABEL: atomic64_xor_acq_rel:
9103; O1:       # %bb.0: # %entry
9104; O1-NEXT:    movq foo(%rip), %rax
9105; O1-NEXT:  .Lpcsection324:
9106; O1-NEXT:    lock xorq $42, (%rdi)
9107; O1-NEXT:    movq $1, foo(%rip)
9108; O1-NEXT:    retq
9109;
9110; O2-LABEL: atomic64_xor_acq_rel:
9111; O2:       # %bb.0: # %entry
9112; O2-NEXT:    movq foo(%rip), %rax
9113; O2-NEXT:  .Lpcsection324:
9114; O2-NEXT:    lock xorq $42, (%rdi)
9115; O2-NEXT:    movq $1, foo(%rip)
9116; O2-NEXT:    retq
9117;
9118; O3-LABEL: atomic64_xor_acq_rel:
9119; O3:       # %bb.0: # %entry
9120; O3-NEXT:    movq foo(%rip), %rax
9121; O3-NEXT:  .Lpcsection324:
9122; O3-NEXT:    lock xorq $42, (%rdi)
9123; O3-NEXT:    movq $1, foo(%rip)
9124; O3-NEXT:    retq
9125entry:
9126  load volatile i64, ptr @foo, align 8
9127  %x = atomicrmw xor ptr %a, i64 42 acq_rel, align 8, !pcsections !0
9128  store volatile i64 1, ptr @foo, align 8
9129  ret void
9130}
9131
9132define void @atomic64_nand_acq_rel(ptr %a) {
9133; O0-LABEL: atomic64_nand_acq_rel:
9134; O0:       # %bb.0: # %entry
9135; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9136; O0-NEXT:    movq foo, %rax
9137; O0-NEXT:  .Lpcsection364:
9138; O0-NEXT:    movq (%rdi), %rax
9139; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9140; O0-NEXT:  .LBB183_1: # %atomicrmw.start
9141; O0-NEXT:    # =>This Inner Loop Header: Depth=1
9142; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9143; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
9144; O0-NEXT:    movl %eax, %esi
9145; O0-NEXT:  .Lpcsection365:
9146; O0-NEXT:    notl %esi
9147; O0-NEXT:  .Lpcsection366:
9148; O0-NEXT:    # implicit-def: $rdx
9149; O0-NEXT:    movl %esi, %edx
9150; O0-NEXT:  .Lpcsection367:
9151; O0-NEXT:    orq $-43, %rdx
9152; O0-NEXT:  .Lpcsection368:
9153; O0-NEXT:    lock cmpxchgq %rdx, (%rcx)
9154; O0-NEXT:  .Lpcsection369:
9155; O0-NEXT:    sete %cl
9156; O0-NEXT:  .Lpcsection370:
9157; O0-NEXT:    testb $1, %cl
9158; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9159; O0-NEXT:  .Lpcsection371:
9160; O0-NEXT:    jne .LBB183_2
9161; O0-NEXT:    jmp .LBB183_1
9162; O0-NEXT:  .LBB183_2: # %atomicrmw.end
9163; O0-NEXT:    movq $1, foo
9164; O0-NEXT:    retq
9165;
9166; O1-LABEL: atomic64_nand_acq_rel:
9167; O1:       # %bb.0: # %entry
9168; O1-NEXT:    movq foo(%rip), %rax
9169; O1-NEXT:  .Lpcsection325:
9170; O1-NEXT:    movq (%rdi), %rax
9171; O1-NEXT:    .p2align 4
9172; O1-NEXT:  .LBB183_1: # %atomicrmw.start
9173; O1-NEXT:    # =>This Inner Loop Header: Depth=1
9174; O1-NEXT:    movl %eax, %ecx
9175; O1-NEXT:  .Lpcsection326:
9176; O1-NEXT:    notl %ecx
9177; O1-NEXT:  .Lpcsection327:
9178; O1-NEXT:    orq $-43, %rcx
9179; O1-NEXT:  .Lpcsection328:
9180; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9181; O1-NEXT:  .Lpcsection329:
9182; O1-NEXT:    jne .LBB183_1
9183; O1-NEXT:  # %bb.2: # %atomicrmw.end
9184; O1-NEXT:    movq $1, foo(%rip)
9185; O1-NEXT:    retq
9186;
9187; O2-LABEL: atomic64_nand_acq_rel:
9188; O2:       # %bb.0: # %entry
9189; O2-NEXT:    movq foo(%rip), %rax
9190; O2-NEXT:  .Lpcsection325:
9191; O2-NEXT:    movq (%rdi), %rax
9192; O2-NEXT:    .p2align 4
9193; O2-NEXT:  .LBB183_1: # %atomicrmw.start
9194; O2-NEXT:    # =>This Inner Loop Header: Depth=1
9195; O2-NEXT:    movl %eax, %ecx
9196; O2-NEXT:  .Lpcsection326:
9197; O2-NEXT:    notl %ecx
9198; O2-NEXT:  .Lpcsection327:
9199; O2-NEXT:    orq $-43, %rcx
9200; O2-NEXT:  .Lpcsection328:
9201; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9202; O2-NEXT:  .Lpcsection329:
9203; O2-NEXT:    jne .LBB183_1
9204; O2-NEXT:  # %bb.2: # %atomicrmw.end
9205; O2-NEXT:    movq $1, foo(%rip)
9206; O2-NEXT:    retq
9207;
9208; O3-LABEL: atomic64_nand_acq_rel:
9209; O3:       # %bb.0: # %entry
9210; O3-NEXT:    movq foo(%rip), %rax
9211; O3-NEXT:  .Lpcsection325:
9212; O3-NEXT:    movq (%rdi), %rax
9213; O3-NEXT:    .p2align 4
9214; O3-NEXT:  .LBB183_1: # %atomicrmw.start
9215; O3-NEXT:    # =>This Inner Loop Header: Depth=1
9216; O3-NEXT:    movl %eax, %ecx
9217; O3-NEXT:  .Lpcsection326:
9218; O3-NEXT:    notl %ecx
9219; O3-NEXT:  .Lpcsection327:
9220; O3-NEXT:    orq $-43, %rcx
9221; O3-NEXT:  .Lpcsection328:
9222; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9223; O3-NEXT:  .Lpcsection329:
9224; O3-NEXT:    jne .LBB183_1
9225; O3-NEXT:  # %bb.2: # %atomicrmw.end
9226; O3-NEXT:    movq $1, foo(%rip)
9227; O3-NEXT:    retq
9228entry:
9229  load volatile i64, ptr @foo, align 8
9230  %x = atomicrmw nand ptr %a, i64 42 acq_rel, align 8, !pcsections !0
9231  store volatile i64 1, ptr @foo, align 8
9232  ret void
9233}
9234
9235define void @atomic64_xchg_seq_cst(ptr %a) {
9236; O0-LABEL: atomic64_xchg_seq_cst:
9237; O0:       # %bb.0: # %entry
9238; O0-NEXT:    movq foo(%rip), %rax
9239; O0-NEXT:    movl $42, %eax
9240; O0-NEXT:  .Lpcsection372:
9241; O0-NEXT:    xchgq %rax, (%rdi)
9242; O0-NEXT:    movq $1, foo
9243; O0-NEXT:    retq
9244;
9245; O1-LABEL: atomic64_xchg_seq_cst:
9246; O1:       # %bb.0: # %entry
9247; O1-NEXT:    movq foo(%rip), %rax
9248; O1-NEXT:    movl $42, %eax
9249; O1-NEXT:  .Lpcsection330:
9250; O1-NEXT:    xchgq %rax, (%rdi)
9251; O1-NEXT:    movq $1, foo(%rip)
9252; O1-NEXT:    retq
9253;
9254; O2-LABEL: atomic64_xchg_seq_cst:
9255; O2:       # %bb.0: # %entry
9256; O2-NEXT:    movq foo(%rip), %rax
9257; O2-NEXT:    movl $42, %eax
9258; O2-NEXT:  .Lpcsection330:
9259; O2-NEXT:    xchgq %rax, (%rdi)
9260; O2-NEXT:    movq $1, foo(%rip)
9261; O2-NEXT:    retq
9262;
9263; O3-LABEL: atomic64_xchg_seq_cst:
9264; O3:       # %bb.0: # %entry
9265; O3-NEXT:    movq foo(%rip), %rax
9266; O3-NEXT:    movl $42, %eax
9267; O3-NEXT:  .Lpcsection330:
9268; O3-NEXT:    xchgq %rax, (%rdi)
9269; O3-NEXT:    movq $1, foo(%rip)
9270; O3-NEXT:    retq
9271entry:
9272  load volatile i64, ptr @foo, align 8
9273  %x = atomicrmw xchg ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9274  store volatile i64 1, ptr @foo, align 8
9275  ret void
9276}
9277
9278define void @atomic64_add_seq_cst(ptr %a) {
9279; O0-LABEL: atomic64_add_seq_cst:
9280; O0:       # %bb.0: # %entry
9281; O0-NEXT:    movq foo(%rip), %rax
9282; O0-NEXT:  .Lpcsection373:
9283; O0-NEXT:    lock addq $42, (%rdi)
9284; O0-NEXT:    movq $1, foo
9285; O0-NEXT:    retq
9286;
9287; O1-LABEL: atomic64_add_seq_cst:
9288; O1:       # %bb.0: # %entry
9289; O1-NEXT:    movq foo(%rip), %rax
9290; O1-NEXT:  .Lpcsection331:
9291; O1-NEXT:    lock addq $42, (%rdi)
9292; O1-NEXT:    movq $1, foo(%rip)
9293; O1-NEXT:    retq
9294;
9295; O2-LABEL: atomic64_add_seq_cst:
9296; O2:       # %bb.0: # %entry
9297; O2-NEXT:    movq foo(%rip), %rax
9298; O2-NEXT:  .Lpcsection331:
9299; O2-NEXT:    lock addq $42, (%rdi)
9300; O2-NEXT:    movq $1, foo(%rip)
9301; O2-NEXT:    retq
9302;
9303; O3-LABEL: atomic64_add_seq_cst:
9304; O3:       # %bb.0: # %entry
9305; O3-NEXT:    movq foo(%rip), %rax
9306; O3-NEXT:  .Lpcsection331:
9307; O3-NEXT:    lock addq $42, (%rdi)
9308; O3-NEXT:    movq $1, foo(%rip)
9309; O3-NEXT:    retq
9310entry:
9311  load volatile i64, ptr @foo, align 8
9312  %x = atomicrmw add ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9313  store volatile i64 1, ptr @foo, align 8
9314  ret void
9315}
9316
9317define void @atomic64_sub_seq_cst(ptr %a) {
9318; O0-LABEL: atomic64_sub_seq_cst:
9319; O0:       # %bb.0: # %entry
9320; O0-NEXT:    movq foo(%rip), %rax
9321; O0-NEXT:  .Lpcsection374:
9322; O0-NEXT:    lock subq $42, (%rdi)
9323; O0-NEXT:    movq $1, foo
9324; O0-NEXT:    retq
9325;
9326; O1-LABEL: atomic64_sub_seq_cst:
9327; O1:       # %bb.0: # %entry
9328; O1-NEXT:    movq foo(%rip), %rax
9329; O1-NEXT:  .Lpcsection332:
9330; O1-NEXT:    lock subq $42, (%rdi)
9331; O1-NEXT:    movq $1, foo(%rip)
9332; O1-NEXT:    retq
9333;
9334; O2-LABEL: atomic64_sub_seq_cst:
9335; O2:       # %bb.0: # %entry
9336; O2-NEXT:    movq foo(%rip), %rax
9337; O2-NEXT:  .Lpcsection332:
9338; O2-NEXT:    lock subq $42, (%rdi)
9339; O2-NEXT:    movq $1, foo(%rip)
9340; O2-NEXT:    retq
9341;
9342; O3-LABEL: atomic64_sub_seq_cst:
9343; O3:       # %bb.0: # %entry
9344; O3-NEXT:    movq foo(%rip), %rax
9345; O3-NEXT:  .Lpcsection332:
9346; O3-NEXT:    lock subq $42, (%rdi)
9347; O3-NEXT:    movq $1, foo(%rip)
9348; O3-NEXT:    retq
9349entry:
9350  load volatile i64, ptr @foo, align 8
9351  %x = atomicrmw sub ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9352  store volatile i64 1, ptr @foo, align 8
9353  ret void
9354}
9355
9356define void @atomic64_and_seq_cst(ptr %a) {
9357; O0-LABEL: atomic64_and_seq_cst:
9358; O0:       # %bb.0: # %entry
9359; O0-NEXT:    movq foo(%rip), %rax
9360; O0-NEXT:  .Lpcsection375:
9361; O0-NEXT:    lock andq $42, (%rdi)
9362; O0-NEXT:    movq $1, foo
9363; O0-NEXT:    retq
9364;
9365; O1-LABEL: atomic64_and_seq_cst:
9366; O1:       # %bb.0: # %entry
9367; O1-NEXT:    movq foo(%rip), %rax
9368; O1-NEXT:  .Lpcsection333:
9369; O1-NEXT:    lock andq $42, (%rdi)
9370; O1-NEXT:    movq $1, foo(%rip)
9371; O1-NEXT:    retq
9372;
9373; O2-LABEL: atomic64_and_seq_cst:
9374; O2:       # %bb.0: # %entry
9375; O2-NEXT:    movq foo(%rip), %rax
9376; O2-NEXT:  .Lpcsection333:
9377; O2-NEXT:    lock andq $42, (%rdi)
9378; O2-NEXT:    movq $1, foo(%rip)
9379; O2-NEXT:    retq
9380;
9381; O3-LABEL: atomic64_and_seq_cst:
9382; O3:       # %bb.0: # %entry
9383; O3-NEXT:    movq foo(%rip), %rax
9384; O3-NEXT:  .Lpcsection333:
9385; O3-NEXT:    lock andq $42, (%rdi)
9386; O3-NEXT:    movq $1, foo(%rip)
9387; O3-NEXT:    retq
9388entry:
9389  load volatile i64, ptr @foo, align 8
9390  %x = atomicrmw and ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9391  store volatile i64 1, ptr @foo, align 8
9392  ret void
9393}
9394
9395define void @atomic64_or_seq_cst(ptr %a) {
9396; O0-LABEL: atomic64_or_seq_cst:
9397; O0:       # %bb.0: # %entry
9398; O0-NEXT:    movq foo(%rip), %rax
9399; O0-NEXT:  .Lpcsection376:
9400; O0-NEXT:    lock orq $42, (%rdi)
9401; O0-NEXT:    movq $1, foo
9402; O0-NEXT:    retq
9403;
9404; O1-LABEL: atomic64_or_seq_cst:
9405; O1:       # %bb.0: # %entry
9406; O1-NEXT:    movq foo(%rip), %rax
9407; O1-NEXT:  .Lpcsection334:
9408; O1-NEXT:    lock orq $42, (%rdi)
9409; O1-NEXT:    movq $1, foo(%rip)
9410; O1-NEXT:    retq
9411;
9412; O2-LABEL: atomic64_or_seq_cst:
9413; O2:       # %bb.0: # %entry
9414; O2-NEXT:    movq foo(%rip), %rax
9415; O2-NEXT:  .Lpcsection334:
9416; O2-NEXT:    lock orq $42, (%rdi)
9417; O2-NEXT:    movq $1, foo(%rip)
9418; O2-NEXT:    retq
9419;
9420; O3-LABEL: atomic64_or_seq_cst:
9421; O3:       # %bb.0: # %entry
9422; O3-NEXT:    movq foo(%rip), %rax
9423; O3-NEXT:  .Lpcsection334:
9424; O3-NEXT:    lock orq $42, (%rdi)
9425; O3-NEXT:    movq $1, foo(%rip)
9426; O3-NEXT:    retq
9427entry:
9428  load volatile i64, ptr @foo, align 8
9429  %x = atomicrmw or ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9430  store volatile i64 1, ptr @foo, align 8
9431  ret void
9432}
9433
9434define void @atomic64_xor_seq_cst(ptr %a) {
9435; O0-LABEL: atomic64_xor_seq_cst:
9436; O0:       # %bb.0: # %entry
9437; O0-NEXT:    movq foo(%rip), %rax
9438; O0-NEXT:  .Lpcsection377:
9439; O0-NEXT:    lock xorq $42, (%rdi)
9440; O0-NEXT:    movq $1, foo
9441; O0-NEXT:    retq
9442;
9443; O1-LABEL: atomic64_xor_seq_cst:
9444; O1:       # %bb.0: # %entry
9445; O1-NEXT:    movq foo(%rip), %rax
9446; O1-NEXT:  .Lpcsection335:
9447; O1-NEXT:    lock xorq $42, (%rdi)
9448; O1-NEXT:    movq $1, foo(%rip)
9449; O1-NEXT:    retq
9450;
9451; O2-LABEL: atomic64_xor_seq_cst:
9452; O2:       # %bb.0: # %entry
9453; O2-NEXT:    movq foo(%rip), %rax
9454; O2-NEXT:  .Lpcsection335:
9455; O2-NEXT:    lock xorq $42, (%rdi)
9456; O2-NEXT:    movq $1, foo(%rip)
9457; O2-NEXT:    retq
9458;
9459; O3-LABEL: atomic64_xor_seq_cst:
9460; O3:       # %bb.0: # %entry
9461; O3-NEXT:    movq foo(%rip), %rax
9462; O3-NEXT:  .Lpcsection335:
9463; O3-NEXT:    lock xorq $42, (%rdi)
9464; O3-NEXT:    movq $1, foo(%rip)
9465; O3-NEXT:    retq
9466entry:
9467  load volatile i64, ptr @foo, align 8
9468  %x = atomicrmw xor ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9469  store volatile i64 1, ptr @foo, align 8
9470  ret void
9471}
9472
9473define void @atomic64_nand_seq_cst(ptr %a) {
9474; O0-LABEL: atomic64_nand_seq_cst:
9475; O0:       # %bb.0: # %entry
9476; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9477; O0-NEXT:    movq foo, %rax
9478; O0-NEXT:  .Lpcsection378:
9479; O0-NEXT:    movq (%rdi), %rax
9480; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9481; O0-NEXT:  .LBB190_1: # %atomicrmw.start
9482; O0-NEXT:    # =>This Inner Loop Header: Depth=1
9483; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9484; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
9485; O0-NEXT:    movl %eax, %esi
9486; O0-NEXT:  .Lpcsection379:
9487; O0-NEXT:    notl %esi
9488; O0-NEXT:  .Lpcsection380:
9489; O0-NEXT:    # implicit-def: $rdx
9490; O0-NEXT:    movl %esi, %edx
9491; O0-NEXT:  .Lpcsection381:
9492; O0-NEXT:    orq $-43, %rdx
9493; O0-NEXT:  .Lpcsection382:
9494; O0-NEXT:    lock cmpxchgq %rdx, (%rcx)
9495; O0-NEXT:  .Lpcsection383:
9496; O0-NEXT:    sete %cl
9497; O0-NEXT:  .Lpcsection384:
9498; O0-NEXT:    testb $1, %cl
9499; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9500; O0-NEXT:  .Lpcsection385:
9501; O0-NEXT:    jne .LBB190_2
9502; O0-NEXT:    jmp .LBB190_1
9503; O0-NEXT:  .LBB190_2: # %atomicrmw.end
9504; O0-NEXT:    movq $1, foo
9505; O0-NEXT:    retq
9506;
9507; O1-LABEL: atomic64_nand_seq_cst:
9508; O1:       # %bb.0: # %entry
9509; O1-NEXT:    movq foo(%rip), %rax
9510; O1-NEXT:  .Lpcsection336:
9511; O1-NEXT:    movq (%rdi), %rax
9512; O1-NEXT:    .p2align 4
9513; O1-NEXT:  .LBB190_1: # %atomicrmw.start
9514; O1-NEXT:    # =>This Inner Loop Header: Depth=1
9515; O1-NEXT:    movl %eax, %ecx
9516; O1-NEXT:  .Lpcsection337:
9517; O1-NEXT:    notl %ecx
9518; O1-NEXT:  .Lpcsection338:
9519; O1-NEXT:    orq $-43, %rcx
9520; O1-NEXT:  .Lpcsection339:
9521; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9522; O1-NEXT:  .Lpcsection340:
9523; O1-NEXT:    jne .LBB190_1
9524; O1-NEXT:  # %bb.2: # %atomicrmw.end
9525; O1-NEXT:    movq $1, foo(%rip)
9526; O1-NEXT:    retq
9527;
9528; O2-LABEL: atomic64_nand_seq_cst:
9529; O2:       # %bb.0: # %entry
9530; O2-NEXT:    movq foo(%rip), %rax
9531; O2-NEXT:  .Lpcsection336:
9532; O2-NEXT:    movq (%rdi), %rax
9533; O2-NEXT:    .p2align 4
9534; O2-NEXT:  .LBB190_1: # %atomicrmw.start
9535; O2-NEXT:    # =>This Inner Loop Header: Depth=1
9536; O2-NEXT:    movl %eax, %ecx
9537; O2-NEXT:  .Lpcsection337:
9538; O2-NEXT:    notl %ecx
9539; O2-NEXT:  .Lpcsection338:
9540; O2-NEXT:    orq $-43, %rcx
9541; O2-NEXT:  .Lpcsection339:
9542; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9543; O2-NEXT:  .Lpcsection340:
9544; O2-NEXT:    jne .LBB190_1
9545; O2-NEXT:  # %bb.2: # %atomicrmw.end
9546; O2-NEXT:    movq $1, foo(%rip)
9547; O2-NEXT:    retq
9548;
9549; O3-LABEL: atomic64_nand_seq_cst:
9550; O3:       # %bb.0: # %entry
9551; O3-NEXT:    movq foo(%rip), %rax
9552; O3-NEXT:  .Lpcsection336:
9553; O3-NEXT:    movq (%rdi), %rax
9554; O3-NEXT:    .p2align 4
9555; O3-NEXT:  .LBB190_1: # %atomicrmw.start
9556; O3-NEXT:    # =>This Inner Loop Header: Depth=1
9557; O3-NEXT:    movl %eax, %ecx
9558; O3-NEXT:  .Lpcsection337:
9559; O3-NEXT:    notl %ecx
9560; O3-NEXT:  .Lpcsection338:
9561; O3-NEXT:    orq $-43, %rcx
9562; O3-NEXT:  .Lpcsection339:
9563; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9564; O3-NEXT:  .Lpcsection340:
9565; O3-NEXT:    jne .LBB190_1
9566; O3-NEXT:  # %bb.2: # %atomicrmw.end
9567; O3-NEXT:    movq $1, foo(%rip)
9568; O3-NEXT:    retq
9569entry:
9570  load volatile i64, ptr @foo, align 8
9571  %x = atomicrmw nand ptr %a, i64 42 seq_cst, align 8, !pcsections !0
9572  store volatile i64 1, ptr @foo, align 8
9573  ret void
9574}
9575
9576define void @atomic64_cas_monotonic(ptr %a) {
9577; O0-LABEL: atomic64_cas_monotonic:
9578; O0:       # %bb.0: # %entry
9579; O0-NEXT:    movq foo(%rip), %rax
9580; O0-NEXT:    movl $42, %eax
9581; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9582; O0-NEXT:    movl $1, %ecx
9583; O0-NEXT:  .Lpcsection386:
9584; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9585; O0-NEXT:  .Lpcsection387:
9586; O0-NEXT:    # kill: def $rdx killed $rax
9587; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9588; O0-NEXT:  .Lpcsection388:
9589; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9590; O0-NEXT:  .Lpcsection389:
9591; O0-NEXT:    # kill: def $rdx killed $rax
9592; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9593; O0-NEXT:  .Lpcsection390:
9594; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9595; O0-NEXT:    movq $1, foo
9596; O0-NEXT:    retq
9597;
9598; O1-LABEL: atomic64_cas_monotonic:
9599; O1:       # %bb.0: # %entry
9600; O1-NEXT:    movq foo(%rip), %rax
9601; O1-NEXT:    movl $1, %ecx
9602; O1-NEXT:  .Lpcsection341:
9603; O1-NEXT:    movl $42, %eax
9604; O1-NEXT:  .Lpcsection342:
9605; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9606; O1-NEXT:  .Lpcsection343:
9607; O1-NEXT:    movl $42, %eax
9608; O1-NEXT:  .Lpcsection344:
9609; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9610; O1-NEXT:  .Lpcsection345:
9611; O1-NEXT:    movl $42, %eax
9612; O1-NEXT:  .Lpcsection346:
9613; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9614; O1-NEXT:    movq $1, foo(%rip)
9615; O1-NEXT:    retq
9616;
9617; O2-LABEL: atomic64_cas_monotonic:
9618; O2:       # %bb.0: # %entry
9619; O2-NEXT:    movq foo(%rip), %rax
9620; O2-NEXT:    movl $1, %ecx
9621; O2-NEXT:  .Lpcsection341:
9622; O2-NEXT:    movl $42, %eax
9623; O2-NEXT:  .Lpcsection342:
9624; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9625; O2-NEXT:  .Lpcsection343:
9626; O2-NEXT:    movl $42, %eax
9627; O2-NEXT:  .Lpcsection344:
9628; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9629; O2-NEXT:  .Lpcsection345:
9630; O2-NEXT:    movl $42, %eax
9631; O2-NEXT:  .Lpcsection346:
9632; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9633; O2-NEXT:    movq $1, foo(%rip)
9634; O2-NEXT:    retq
9635;
9636; O3-LABEL: atomic64_cas_monotonic:
9637; O3:       # %bb.0: # %entry
9638; O3-NEXT:    movq foo(%rip), %rax
9639; O3-NEXT:    movl $1, %ecx
9640; O3-NEXT:  .Lpcsection341:
9641; O3-NEXT:    movl $42, %eax
9642; O3-NEXT:  .Lpcsection342:
9643; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9644; O3-NEXT:  .Lpcsection343:
9645; O3-NEXT:    movl $42, %eax
9646; O3-NEXT:  .Lpcsection344:
9647; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9648; O3-NEXT:  .Lpcsection345:
9649; O3-NEXT:    movl $42, %eax
9650; O3-NEXT:  .Lpcsection346:
9651; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9652; O3-NEXT:    movq $1, foo(%rip)
9653; O3-NEXT:    retq
9654entry:
9655  load volatile i64, ptr @foo, align 8
9656  %x = cmpxchg ptr %a, i64 42, i64 1 monotonic monotonic, align 8, !pcsections !0
9657  %y = cmpxchg ptr %a, i64 42, i64 1 monotonic acquire, align 8, !pcsections !0
9658  %z = cmpxchg ptr %a, i64 42, i64 1 monotonic seq_cst, align 8, !pcsections !0
9659  store volatile i64 1, ptr @foo, align 8
9660  ret void
9661}
9662
9663define void @atomic64_cas_acquire(ptr %a) {
9664; O0-LABEL: atomic64_cas_acquire:
9665; O0:       # %bb.0: # %entry
9666; O0-NEXT:    movq foo(%rip), %rax
9667; O0-NEXT:    movl $42, %eax
9668; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9669; O0-NEXT:    movl $1, %ecx
9670; O0-NEXT:  .Lpcsection391:
9671; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9672; O0-NEXT:  .Lpcsection392:
9673; O0-NEXT:    # kill: def $rdx killed $rax
9674; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9675; O0-NEXT:  .Lpcsection393:
9676; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9677; O0-NEXT:  .Lpcsection394:
9678; O0-NEXT:    # kill: def $rdx killed $rax
9679; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9680; O0-NEXT:  .Lpcsection395:
9681; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9682; O0-NEXT:    movq $1, foo
9683; O0-NEXT:    retq
9684;
9685; O1-LABEL: atomic64_cas_acquire:
9686; O1:       # %bb.0: # %entry
9687; O1-NEXT:    movq foo(%rip), %rax
9688; O1-NEXT:    movl $1, %ecx
9689; O1-NEXT:  .Lpcsection347:
9690; O1-NEXT:    movl $42, %eax
9691; O1-NEXT:  .Lpcsection348:
9692; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9693; O1-NEXT:  .Lpcsection349:
9694; O1-NEXT:    movl $42, %eax
9695; O1-NEXT:  .Lpcsection350:
9696; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9697; O1-NEXT:  .Lpcsection351:
9698; O1-NEXT:    movl $42, %eax
9699; O1-NEXT:  .Lpcsection352:
9700; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9701; O1-NEXT:    movq $1, foo(%rip)
9702; O1-NEXT:    retq
9703;
9704; O2-LABEL: atomic64_cas_acquire:
9705; O2:       # %bb.0: # %entry
9706; O2-NEXT:    movq foo(%rip), %rax
9707; O2-NEXT:    movl $1, %ecx
9708; O2-NEXT:  .Lpcsection347:
9709; O2-NEXT:    movl $42, %eax
9710; O2-NEXT:  .Lpcsection348:
9711; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9712; O2-NEXT:  .Lpcsection349:
9713; O2-NEXT:    movl $42, %eax
9714; O2-NEXT:  .Lpcsection350:
9715; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9716; O2-NEXT:  .Lpcsection351:
9717; O2-NEXT:    movl $42, %eax
9718; O2-NEXT:  .Lpcsection352:
9719; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9720; O2-NEXT:    movq $1, foo(%rip)
9721; O2-NEXT:    retq
9722;
9723; O3-LABEL: atomic64_cas_acquire:
9724; O3:       # %bb.0: # %entry
9725; O3-NEXT:    movq foo(%rip), %rax
9726; O3-NEXT:    movl $1, %ecx
9727; O3-NEXT:  .Lpcsection347:
9728; O3-NEXT:    movl $42, %eax
9729; O3-NEXT:  .Lpcsection348:
9730; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9731; O3-NEXT:  .Lpcsection349:
9732; O3-NEXT:    movl $42, %eax
9733; O3-NEXT:  .Lpcsection350:
9734; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9735; O3-NEXT:  .Lpcsection351:
9736; O3-NEXT:    movl $42, %eax
9737; O3-NEXT:  .Lpcsection352:
9738; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9739; O3-NEXT:    movq $1, foo(%rip)
9740; O3-NEXT:    retq
9741entry:
9742  load volatile i64, ptr @foo, align 8
9743  %x = cmpxchg ptr %a, i64 42, i64 1 acquire monotonic, align 8, !pcsections !0
9744  %y = cmpxchg ptr %a, i64 42, i64 1 acquire acquire, align 8, !pcsections !0
9745  %z = cmpxchg ptr %a, i64 42, i64 1 acquire seq_cst, align 8, !pcsections !0
9746  store volatile i64 1, ptr @foo, align 8
9747  ret void
9748}
9749
9750define void @atomic64_cas_release(ptr %a) {
9751; O0-LABEL: atomic64_cas_release:
9752; O0:       # %bb.0: # %entry
9753; O0-NEXT:    movq foo(%rip), %rax
9754; O0-NEXT:    movl $42, %eax
9755; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9756; O0-NEXT:    movl $1, %ecx
9757; O0-NEXT:  .Lpcsection396:
9758; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9759; O0-NEXT:  .Lpcsection397:
9760; O0-NEXT:    # kill: def $rdx killed $rax
9761; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9762; O0-NEXT:  .Lpcsection398:
9763; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9764; O0-NEXT:  .Lpcsection399:
9765; O0-NEXT:    # kill: def $rdx killed $rax
9766; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9767; O0-NEXT:  .Lpcsection400:
9768; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9769; O0-NEXT:    movq $1, foo
9770; O0-NEXT:    retq
9771;
9772; O1-LABEL: atomic64_cas_release:
9773; O1:       # %bb.0: # %entry
9774; O1-NEXT:    movq foo(%rip), %rax
9775; O1-NEXT:    movl $1, %ecx
9776; O1-NEXT:  .Lpcsection353:
9777; O1-NEXT:    movl $42, %eax
9778; O1-NEXT:  .Lpcsection354:
9779; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9780; O1-NEXT:  .Lpcsection355:
9781; O1-NEXT:    movl $42, %eax
9782; O1-NEXT:  .Lpcsection356:
9783; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9784; O1-NEXT:  .Lpcsection357:
9785; O1-NEXT:    movl $42, %eax
9786; O1-NEXT:  .Lpcsection358:
9787; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9788; O1-NEXT:    movq $1, foo(%rip)
9789; O1-NEXT:    retq
9790;
9791; O2-LABEL: atomic64_cas_release:
9792; O2:       # %bb.0: # %entry
9793; O2-NEXT:    movq foo(%rip), %rax
9794; O2-NEXT:    movl $1, %ecx
9795; O2-NEXT:  .Lpcsection353:
9796; O2-NEXT:    movl $42, %eax
9797; O2-NEXT:  .Lpcsection354:
9798; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9799; O2-NEXT:  .Lpcsection355:
9800; O2-NEXT:    movl $42, %eax
9801; O2-NEXT:  .Lpcsection356:
9802; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9803; O2-NEXT:  .Lpcsection357:
9804; O2-NEXT:    movl $42, %eax
9805; O2-NEXT:  .Lpcsection358:
9806; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9807; O2-NEXT:    movq $1, foo(%rip)
9808; O2-NEXT:    retq
9809;
9810; O3-LABEL: atomic64_cas_release:
9811; O3:       # %bb.0: # %entry
9812; O3-NEXT:    movq foo(%rip), %rax
9813; O3-NEXT:    movl $1, %ecx
9814; O3-NEXT:  .Lpcsection353:
9815; O3-NEXT:    movl $42, %eax
9816; O3-NEXT:  .Lpcsection354:
9817; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9818; O3-NEXT:  .Lpcsection355:
9819; O3-NEXT:    movl $42, %eax
9820; O3-NEXT:  .Lpcsection356:
9821; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9822; O3-NEXT:  .Lpcsection357:
9823; O3-NEXT:    movl $42, %eax
9824; O3-NEXT:  .Lpcsection358:
9825; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9826; O3-NEXT:    movq $1, foo(%rip)
9827; O3-NEXT:    retq
9828entry:
9829  load volatile i64, ptr @foo, align 8
9830  %x = cmpxchg ptr %a, i64 42, i64 1 release monotonic, align 8, !pcsections !0
9831  %y = cmpxchg ptr %a, i64 42, i64 1 release acquire, align 8, !pcsections !0
9832  %z = cmpxchg ptr %a, i64 42, i64 1 release seq_cst, align 8, !pcsections !0
9833  store volatile i64 1, ptr @foo, align 8
9834  ret void
9835}
9836
9837define void @atomic64_cas_acq_rel(ptr %a) {
9838; O0-LABEL: atomic64_cas_acq_rel:
9839; O0:       # %bb.0: # %entry
9840; O0-NEXT:    movq foo(%rip), %rax
9841; O0-NEXT:    movl $42, %eax
9842; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9843; O0-NEXT:    movl $1, %ecx
9844; O0-NEXT:  .Lpcsection401:
9845; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9846; O0-NEXT:  .Lpcsection402:
9847; O0-NEXT:    # kill: def $rdx killed $rax
9848; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9849; O0-NEXT:  .Lpcsection403:
9850; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9851; O0-NEXT:  .Lpcsection404:
9852; O0-NEXT:    # kill: def $rdx killed $rax
9853; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9854; O0-NEXT:  .Lpcsection405:
9855; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9856; O0-NEXT:    movq $1, foo
9857; O0-NEXT:    retq
9858;
9859; O1-LABEL: atomic64_cas_acq_rel:
9860; O1:       # %bb.0: # %entry
9861; O1-NEXT:    movq foo(%rip), %rax
9862; O1-NEXT:    movl $1, %ecx
9863; O1-NEXT:  .Lpcsection359:
9864; O1-NEXT:    movl $42, %eax
9865; O1-NEXT:  .Lpcsection360:
9866; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9867; O1-NEXT:  .Lpcsection361:
9868; O1-NEXT:    movl $42, %eax
9869; O1-NEXT:  .Lpcsection362:
9870; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9871; O1-NEXT:  .Lpcsection363:
9872; O1-NEXT:    movl $42, %eax
9873; O1-NEXT:  .Lpcsection364:
9874; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9875; O1-NEXT:    movq $1, foo(%rip)
9876; O1-NEXT:    retq
9877;
9878; O2-LABEL: atomic64_cas_acq_rel:
9879; O2:       # %bb.0: # %entry
9880; O2-NEXT:    movq foo(%rip), %rax
9881; O2-NEXT:    movl $1, %ecx
9882; O2-NEXT:  .Lpcsection359:
9883; O2-NEXT:    movl $42, %eax
9884; O2-NEXT:  .Lpcsection360:
9885; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9886; O2-NEXT:  .Lpcsection361:
9887; O2-NEXT:    movl $42, %eax
9888; O2-NEXT:  .Lpcsection362:
9889; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9890; O2-NEXT:  .Lpcsection363:
9891; O2-NEXT:    movl $42, %eax
9892; O2-NEXT:  .Lpcsection364:
9893; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9894; O2-NEXT:    movq $1, foo(%rip)
9895; O2-NEXT:    retq
9896;
9897; O3-LABEL: atomic64_cas_acq_rel:
9898; O3:       # %bb.0: # %entry
9899; O3-NEXT:    movq foo(%rip), %rax
9900; O3-NEXT:    movl $1, %ecx
9901; O3-NEXT:  .Lpcsection359:
9902; O3-NEXT:    movl $42, %eax
9903; O3-NEXT:  .Lpcsection360:
9904; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9905; O3-NEXT:  .Lpcsection361:
9906; O3-NEXT:    movl $42, %eax
9907; O3-NEXT:  .Lpcsection362:
9908; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9909; O3-NEXT:  .Lpcsection363:
9910; O3-NEXT:    movl $42, %eax
9911; O3-NEXT:  .Lpcsection364:
9912; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9913; O3-NEXT:    movq $1, foo(%rip)
9914; O3-NEXT:    retq
9915entry:
9916  load volatile i64, ptr @foo, align 8
9917  %x = cmpxchg ptr %a, i64 42, i64 1 acq_rel monotonic, align 8, !pcsections !0
9918  %y = cmpxchg ptr %a, i64 42, i64 1 acq_rel acquire, align 8, !pcsections !0
9919  %z = cmpxchg ptr %a, i64 42, i64 1 acq_rel seq_cst, align 8, !pcsections !0
9920  store volatile i64 1, ptr @foo, align 8
9921  ret void
9922}
9923
9924define void @atomic64_cas_seq_cst(ptr %a) {
9925; O0-LABEL: atomic64_cas_seq_cst:
9926; O0:       # %bb.0: # %entry
9927; O0-NEXT:    movq foo(%rip), %rax
9928; O0-NEXT:    movl $42, %eax
9929; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
9930; O0-NEXT:    movl $1, %ecx
9931; O0-NEXT:  .Lpcsection406:
9932; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9933; O0-NEXT:  .Lpcsection407:
9934; O0-NEXT:    # kill: def $rdx killed $rax
9935; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9936; O0-NEXT:  .Lpcsection408:
9937; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9938; O0-NEXT:  .Lpcsection409:
9939; O0-NEXT:    # kill: def $rdx killed $rax
9940; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
9941; O0-NEXT:  .Lpcsection410:
9942; O0-NEXT:    lock cmpxchgq %rcx, (%rdi)
9943; O0-NEXT:    movq $3, foo
9944; O0-NEXT:    retq
9945;
9946; O1-LABEL: atomic64_cas_seq_cst:
9947; O1:       # %bb.0: # %entry
9948; O1-NEXT:    movq foo(%rip), %rax
9949; O1-NEXT:    movl $1, %ecx
9950; O1-NEXT:  .Lpcsection365:
9951; O1-NEXT:    movl $42, %eax
9952; O1-NEXT:  .Lpcsection366:
9953; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9954; O1-NEXT:  .Lpcsection367:
9955; O1-NEXT:    movl $42, %eax
9956; O1-NEXT:  .Lpcsection368:
9957; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9958; O1-NEXT:  .Lpcsection369:
9959; O1-NEXT:    movl $42, %eax
9960; O1-NEXT:  .Lpcsection370:
9961; O1-NEXT:    lock cmpxchgq %rcx, (%rdi)
9962; O1-NEXT:    movq $3, foo(%rip)
9963; O1-NEXT:    retq
9964;
9965; O2-LABEL: atomic64_cas_seq_cst:
9966; O2:       # %bb.0: # %entry
9967; O2-NEXT:    movq foo(%rip), %rax
9968; O2-NEXT:    movl $1, %ecx
9969; O2-NEXT:  .Lpcsection365:
9970; O2-NEXT:    movl $42, %eax
9971; O2-NEXT:  .Lpcsection366:
9972; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9973; O2-NEXT:  .Lpcsection367:
9974; O2-NEXT:    movl $42, %eax
9975; O2-NEXT:  .Lpcsection368:
9976; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9977; O2-NEXT:  .Lpcsection369:
9978; O2-NEXT:    movl $42, %eax
9979; O2-NEXT:  .Lpcsection370:
9980; O2-NEXT:    lock cmpxchgq %rcx, (%rdi)
9981; O2-NEXT:    movq $3, foo(%rip)
9982; O2-NEXT:    retq
9983;
9984; O3-LABEL: atomic64_cas_seq_cst:
9985; O3:       # %bb.0: # %entry
9986; O3-NEXT:    movq foo(%rip), %rax
9987; O3-NEXT:    movl $1, %ecx
9988; O3-NEXT:  .Lpcsection365:
9989; O3-NEXT:    movl $42, %eax
9990; O3-NEXT:  .Lpcsection366:
9991; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9992; O3-NEXT:  .Lpcsection367:
9993; O3-NEXT:    movl $42, %eax
9994; O3-NEXT:  .Lpcsection368:
9995; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
9996; O3-NEXT:  .Lpcsection369:
9997; O3-NEXT:    movl $42, %eax
9998; O3-NEXT:  .Lpcsection370:
9999; O3-NEXT:    lock cmpxchgq %rcx, (%rdi)
10000; O3-NEXT:    movq $3, foo(%rip)
10001; O3-NEXT:    retq
10002entry:
10003  load volatile i64, ptr @foo, align 8
10004  %x = cmpxchg ptr %a, i64 42, i64 1 seq_cst monotonic, align 8, !pcsections !0
10005  %y = cmpxchg ptr %a, i64 42, i64 1 seq_cst acquire, align 8, !pcsections !0
10006  %z = cmpxchg ptr %a, i64 42, i64 1 seq_cst seq_cst, align 8, !pcsections !0
10007  store volatile i64 3, ptr @foo, align 8
10008  ret void
10009}
10010
10011define void @atomic64_cas_seq_cst_ptr_ty(ptr %a, ptr %v1, ptr %v2) {
10012; O0-LABEL: atomic64_cas_seq_cst_ptr_ty:
10013; O0:       # %bb.0: # %entry
10014; O0-NEXT:    movq %rsi, %rax
10015; O0-NEXT:    movq foo(%rip), %rcx
10016; O0-NEXT:  .Lpcsection411:
10017; O0-NEXT:    lock cmpxchgq %rdx, (%rdi)
10018; O0-NEXT:    movq $1, foo
10019; O0-NEXT:    retq
10020;
10021; O1-LABEL: atomic64_cas_seq_cst_ptr_ty:
10022; O1:       # %bb.0: # %entry
10023; O1-NEXT:    movq %rsi, %rax
10024; O1-NEXT:    movq foo(%rip), %rcx
10025; O1-NEXT:  .Lpcsection371:
10026; O1-NEXT:    lock cmpxchgq %rdx, (%rdi)
10027; O1-NEXT:    movq $1, foo(%rip)
10028; O1-NEXT:    retq
10029;
10030; O2-LABEL: atomic64_cas_seq_cst_ptr_ty:
10031; O2:       # %bb.0: # %entry
10032; O2-NEXT:    movq %rsi, %rax
10033; O2-NEXT:    movq foo(%rip), %rcx
10034; O2-NEXT:  .Lpcsection371:
10035; O2-NEXT:    lock cmpxchgq %rdx, (%rdi)
10036; O2-NEXT:    movq $1, foo(%rip)
10037; O2-NEXT:    retq
10038;
10039; O3-LABEL: atomic64_cas_seq_cst_ptr_ty:
10040; O3:       # %bb.0: # %entry
10041; O3-NEXT:    movq %rsi, %rax
10042; O3-NEXT:    movq foo(%rip), %rcx
10043; O3-NEXT:  .Lpcsection371:
10044; O3-NEXT:    lock cmpxchgq %rdx, (%rdi)
10045; O3-NEXT:    movq $1, foo(%rip)
10046; O3-NEXT:    retq
10047entry:
10048  load volatile i64, ptr @foo, align 8
10049  %x = cmpxchg ptr %a, ptr %v1, ptr %v2 seq_cst seq_cst, align 8, !pcsections !0
10050  store volatile i64 1, ptr @foo, align 8
10051  ret void
10052}
10053
10054define i64 @atomic_use_cond(ptr %a) {
10055; O0-LABEL: atomic_use_cond:
10056; O0:       # %bb.0: # %entry
10057; O0-NEXT:  .Lpcsection412:
10058; O0-NEXT:    lock decq (%rdi)
10059; O0-NEXT:  .Lpcsection413:
10060; O0-NEXT:    sete %al
10061; O0-NEXT:    testb $1, %al
10062; O0-NEXT:    je .LBB197_2
10063; O0-NEXT:  # %bb.1: # %then
10064; O0-NEXT:    movl $1, %eax
10065; O0-NEXT:    retq
10066; O0-NEXT:  .LBB197_2: # %else
10067; O0-NEXT:    movl $2, %eax
10068; O0-NEXT:    retq
10069;
10070; O1-LABEL: atomic_use_cond:
10071; O1:       # %bb.0: # %entry
10072; O1-NEXT:  .Lpcsection372:
10073; O1-NEXT:    lock decq (%rdi)
10074; O1-NEXT:    jne .LBB197_2
10075; O1-NEXT:  # %bb.1: # %then
10076; O1-NEXT:    movl $1, %eax
10077; O1-NEXT:    retq
10078; O1-NEXT:  .LBB197_2: # %else
10079; O1-NEXT:    movl $2, %eax
10080; O1-NEXT:    retq
10081;
10082; O2-LABEL: atomic_use_cond:
10083; O2:       # %bb.0: # %entry
10084; O2-NEXT:  .Lpcsection372:
10085; O2-NEXT:    lock decq (%rdi)
10086; O2-NEXT:    jne .LBB197_2
10087; O2-NEXT:  # %bb.1: # %then
10088; O2-NEXT:    movl $1, %eax
10089; O2-NEXT:    retq
10090; O2-NEXT:  .LBB197_2: # %else
10091; O2-NEXT:    movl $2, %eax
10092; O2-NEXT:    retq
10093;
10094; O3-LABEL: atomic_use_cond:
10095; O3:       # %bb.0: # %entry
10096; O3-NEXT:  .Lpcsection372:
10097; O3-NEXT:    lock decq (%rdi)
10098; O3-NEXT:    jne .LBB197_2
10099; O3-NEXT:  # %bb.1: # %then
10100; O3-NEXT:    movl $1, %eax
10101; O3-NEXT:    retq
10102; O3-NEXT:  .LBB197_2: # %else
10103; O3-NEXT:    movl $2, %eax
10104; O3-NEXT:    retq
10105entry:
10106  %x = atomicrmw sub ptr %a, i64 1 seq_cst, align 8, !pcsections !0
10107  %y = icmp eq i64 %x, 1
10108  br i1 %y, label %then, label %else
10109
10110then:
10111  ret i64 1
10112
10113else:
10114  ret i64 2
10115}
10116
10117define i128 @atomic128_load_unordered(ptr %a) {
10118; O0-LABEL: atomic128_load_unordered:
10119; O0:       # %bb.0: # %entry
10120; O0-NEXT:    pushq %rbx
10121; O0-NEXT:    .cfi_def_cfa_offset 16
10122; O0-NEXT:    .cfi_offset %rbx, -16
10123; O0-NEXT:    movq foo(%rip), %rax
10124; O0-NEXT:  .Lpcsection414:
10125; O0-NEXT:    xorl %eax, %eax
10126; O0-NEXT:    movl %eax, %ebx
10127; O0-NEXT:    movq %rbx, %rax
10128; O0-NEXT:    movq %rbx, %rdx
10129; O0-NEXT:    movq %rbx, %rcx
10130; O0-NEXT:  .Lpcsection415:
10131; O0-NEXT:    lock cmpxchg16b (%rdi)
10132; O0-NEXT:    movq $1, foo(%rip)
10133; O0-NEXT:    popq %rbx
10134; O0-NEXT:    .cfi_def_cfa_offset 8
10135; O0-NEXT:    retq
10136;
10137; O1-LABEL: atomic128_load_unordered:
10138; O1:       # %bb.0: # %entry
10139; O1-NEXT:    pushq %rbx
10140; O1-NEXT:    .cfi_def_cfa_offset 16
10141; O1-NEXT:    .cfi_offset %rbx, -16
10142; O1-NEXT:    movq foo(%rip), %rax
10143; O1-NEXT:  .Lpcsection373:
10144; O1-NEXT:    xorl %eax, %eax
10145; O1-NEXT:  .Lpcsection374:
10146; O1-NEXT:    xorl %edx, %edx
10147; O1-NEXT:  .Lpcsection375:
10148; O1-NEXT:    xorl %ecx, %ecx
10149; O1-NEXT:  .Lpcsection376:
10150; O1-NEXT:    xorl %ebx, %ebx
10151; O1-NEXT:  .Lpcsection377:
10152; O1-NEXT:    lock cmpxchg16b (%rdi)
10153; O1-NEXT:    movq $1, foo(%rip)
10154; O1-NEXT:    popq %rbx
10155; O1-NEXT:    .cfi_def_cfa_offset 8
10156; O1-NEXT:    retq
10157;
10158; O2-LABEL: atomic128_load_unordered:
10159; O2:       # %bb.0: # %entry
10160; O2-NEXT:    pushq %rbx
10161; O2-NEXT:    .cfi_def_cfa_offset 16
10162; O2-NEXT:    .cfi_offset %rbx, -16
10163; O2-NEXT:    movq foo(%rip), %rax
10164; O2-NEXT:  .Lpcsection373:
10165; O2-NEXT:    xorl %eax, %eax
10166; O2-NEXT:  .Lpcsection374:
10167; O2-NEXT:    xorl %edx, %edx
10168; O2-NEXT:  .Lpcsection375:
10169; O2-NEXT:    xorl %ecx, %ecx
10170; O2-NEXT:  .Lpcsection376:
10171; O2-NEXT:    xorl %ebx, %ebx
10172; O2-NEXT:  .Lpcsection377:
10173; O2-NEXT:    lock cmpxchg16b (%rdi)
10174; O2-NEXT:    movq $1, foo(%rip)
10175; O2-NEXT:    popq %rbx
10176; O2-NEXT:    .cfi_def_cfa_offset 8
10177; O2-NEXT:    retq
10178;
10179; O3-LABEL: atomic128_load_unordered:
10180; O3:       # %bb.0: # %entry
10181; O3-NEXT:    pushq %rbx
10182; O3-NEXT:    .cfi_def_cfa_offset 16
10183; O3-NEXT:    .cfi_offset %rbx, -16
10184; O3-NEXT:    movq foo(%rip), %rax
10185; O3-NEXT:  .Lpcsection373:
10186; O3-NEXT:    xorl %eax, %eax
10187; O3-NEXT:  .Lpcsection374:
10188; O3-NEXT:    xorl %edx, %edx
10189; O3-NEXT:  .Lpcsection375:
10190; O3-NEXT:    xorl %ecx, %ecx
10191; O3-NEXT:  .Lpcsection376:
10192; O3-NEXT:    xorl %ebx, %ebx
10193; O3-NEXT:  .Lpcsection377:
10194; O3-NEXT:    lock cmpxchg16b (%rdi)
10195; O3-NEXT:    movq $1, foo(%rip)
10196; O3-NEXT:    popq %rbx
10197; O3-NEXT:    .cfi_def_cfa_offset 8
10198; O3-NEXT:    retq
10199entry:
10200  load volatile i64, ptr @foo, align 8
10201  %x = load atomic i128, ptr %a unordered, align 16, !pcsections !0
10202  store volatile i64 1, ptr @foo, align 8
10203  ret i128 %x
10204}
10205
10206define i128 @atomic128_load_monotonic(ptr %a) {
10207; O0-LABEL: atomic128_load_monotonic:
10208; O0:       # %bb.0: # %entry
10209; O0-NEXT:    pushq %rbx
10210; O0-NEXT:    .cfi_def_cfa_offset 16
10211; O0-NEXT:    .cfi_offset %rbx, -16
10212; O0-NEXT:    movq foo(%rip), %rax
10213; O0-NEXT:  .Lpcsection416:
10214; O0-NEXT:    xorl %eax, %eax
10215; O0-NEXT:    movl %eax, %ebx
10216; O0-NEXT:    movq %rbx, %rax
10217; O0-NEXT:    movq %rbx, %rdx
10218; O0-NEXT:    movq %rbx, %rcx
10219; O0-NEXT:  .Lpcsection417:
10220; O0-NEXT:    lock cmpxchg16b (%rdi)
10221; O0-NEXT:    movq $1, foo(%rip)
10222; O0-NEXT:    popq %rbx
10223; O0-NEXT:    .cfi_def_cfa_offset 8
10224; O0-NEXT:    retq
10225;
10226; O1-LABEL: atomic128_load_monotonic:
10227; O1:       # %bb.0: # %entry
10228; O1-NEXT:    pushq %rbx
10229; O1-NEXT:    .cfi_def_cfa_offset 16
10230; O1-NEXT:    .cfi_offset %rbx, -16
10231; O1-NEXT:    movq foo(%rip), %rax
10232; O1-NEXT:  .Lpcsection378:
10233; O1-NEXT:    xorl %eax, %eax
10234; O1-NEXT:  .Lpcsection379:
10235; O1-NEXT:    xorl %edx, %edx
10236; O1-NEXT:  .Lpcsection380:
10237; O1-NEXT:    xorl %ecx, %ecx
10238; O1-NEXT:  .Lpcsection381:
10239; O1-NEXT:    xorl %ebx, %ebx
10240; O1-NEXT:  .Lpcsection382:
10241; O1-NEXT:    lock cmpxchg16b (%rdi)
10242; O1-NEXT:    movq $1, foo(%rip)
10243; O1-NEXT:    popq %rbx
10244; O1-NEXT:    .cfi_def_cfa_offset 8
10245; O1-NEXT:    retq
10246;
10247; O2-LABEL: atomic128_load_monotonic:
10248; O2:       # %bb.0: # %entry
10249; O2-NEXT:    pushq %rbx
10250; O2-NEXT:    .cfi_def_cfa_offset 16
10251; O2-NEXT:    .cfi_offset %rbx, -16
10252; O2-NEXT:    movq foo(%rip), %rax
10253; O2-NEXT:  .Lpcsection378:
10254; O2-NEXT:    xorl %eax, %eax
10255; O2-NEXT:  .Lpcsection379:
10256; O2-NEXT:    xorl %edx, %edx
10257; O2-NEXT:  .Lpcsection380:
10258; O2-NEXT:    xorl %ecx, %ecx
10259; O2-NEXT:  .Lpcsection381:
10260; O2-NEXT:    xorl %ebx, %ebx
10261; O2-NEXT:  .Lpcsection382:
10262; O2-NEXT:    lock cmpxchg16b (%rdi)
10263; O2-NEXT:    movq $1, foo(%rip)
10264; O2-NEXT:    popq %rbx
10265; O2-NEXT:    .cfi_def_cfa_offset 8
10266; O2-NEXT:    retq
10267;
10268; O3-LABEL: atomic128_load_monotonic:
10269; O3:       # %bb.0: # %entry
10270; O3-NEXT:    pushq %rbx
10271; O3-NEXT:    .cfi_def_cfa_offset 16
10272; O3-NEXT:    .cfi_offset %rbx, -16
10273; O3-NEXT:    movq foo(%rip), %rax
10274; O3-NEXT:  .Lpcsection378:
10275; O3-NEXT:    xorl %eax, %eax
10276; O3-NEXT:  .Lpcsection379:
10277; O3-NEXT:    xorl %edx, %edx
10278; O3-NEXT:  .Lpcsection380:
10279; O3-NEXT:    xorl %ecx, %ecx
10280; O3-NEXT:  .Lpcsection381:
10281; O3-NEXT:    xorl %ebx, %ebx
10282; O3-NEXT:  .Lpcsection382:
10283; O3-NEXT:    lock cmpxchg16b (%rdi)
10284; O3-NEXT:    movq $1, foo(%rip)
10285; O3-NEXT:    popq %rbx
10286; O3-NEXT:    .cfi_def_cfa_offset 8
10287; O3-NEXT:    retq
10288entry:
10289  load volatile i64, ptr @foo, align 8
10290  %x = load atomic i128, ptr %a monotonic, align 16, !pcsections !0
10291  store volatile i64 1, ptr @foo, align 8
10292  ret i128 %x
10293}
10294
10295define i128 @atomic128_load_acquire(ptr %a) {
10296; O0-LABEL: atomic128_load_acquire:
10297; O0:       # %bb.0: # %entry
10298; O0-NEXT:    pushq %rbx
10299; O0-NEXT:    .cfi_def_cfa_offset 16
10300; O0-NEXT:    .cfi_offset %rbx, -16
10301; O0-NEXT:    movq foo(%rip), %rax
10302; O0-NEXT:  .Lpcsection418:
10303; O0-NEXT:    xorl %eax, %eax
10304; O0-NEXT:    movl %eax, %ebx
10305; O0-NEXT:    movq %rbx, %rax
10306; O0-NEXT:    movq %rbx, %rdx
10307; O0-NEXT:    movq %rbx, %rcx
10308; O0-NEXT:  .Lpcsection419:
10309; O0-NEXT:    lock cmpxchg16b (%rdi)
10310; O0-NEXT:    movq $1, foo(%rip)
10311; O0-NEXT:    popq %rbx
10312; O0-NEXT:    .cfi_def_cfa_offset 8
10313; O0-NEXT:    retq
10314;
10315; O1-LABEL: atomic128_load_acquire:
10316; O1:       # %bb.0: # %entry
10317; O1-NEXT:    pushq %rbx
10318; O1-NEXT:    .cfi_def_cfa_offset 16
10319; O1-NEXT:    .cfi_offset %rbx, -16
10320; O1-NEXT:    movq foo(%rip), %rax
10321; O1-NEXT:  .Lpcsection383:
10322; O1-NEXT:    xorl %eax, %eax
10323; O1-NEXT:  .Lpcsection384:
10324; O1-NEXT:    xorl %edx, %edx
10325; O1-NEXT:  .Lpcsection385:
10326; O1-NEXT:    xorl %ecx, %ecx
10327; O1-NEXT:  .Lpcsection386:
10328; O1-NEXT:    xorl %ebx, %ebx
10329; O1-NEXT:  .Lpcsection387:
10330; O1-NEXT:    lock cmpxchg16b (%rdi)
10331; O1-NEXT:    movq $1, foo(%rip)
10332; O1-NEXT:    popq %rbx
10333; O1-NEXT:    .cfi_def_cfa_offset 8
10334; O1-NEXT:    retq
10335;
10336; O2-LABEL: atomic128_load_acquire:
10337; O2:       # %bb.0: # %entry
10338; O2-NEXT:    pushq %rbx
10339; O2-NEXT:    .cfi_def_cfa_offset 16
10340; O2-NEXT:    .cfi_offset %rbx, -16
10341; O2-NEXT:    movq foo(%rip), %rax
10342; O2-NEXT:  .Lpcsection383:
10343; O2-NEXT:    xorl %eax, %eax
10344; O2-NEXT:  .Lpcsection384:
10345; O2-NEXT:    xorl %edx, %edx
10346; O2-NEXT:  .Lpcsection385:
10347; O2-NEXT:    xorl %ecx, %ecx
10348; O2-NEXT:  .Lpcsection386:
10349; O2-NEXT:    xorl %ebx, %ebx
10350; O2-NEXT:  .Lpcsection387:
10351; O2-NEXT:    lock cmpxchg16b (%rdi)
10352; O2-NEXT:    movq $1, foo(%rip)
10353; O2-NEXT:    popq %rbx
10354; O2-NEXT:    .cfi_def_cfa_offset 8
10355; O2-NEXT:    retq
10356;
10357; O3-LABEL: atomic128_load_acquire:
10358; O3:       # %bb.0: # %entry
10359; O3-NEXT:    pushq %rbx
10360; O3-NEXT:    .cfi_def_cfa_offset 16
10361; O3-NEXT:    .cfi_offset %rbx, -16
10362; O3-NEXT:    movq foo(%rip), %rax
10363; O3-NEXT:  .Lpcsection383:
10364; O3-NEXT:    xorl %eax, %eax
10365; O3-NEXT:  .Lpcsection384:
10366; O3-NEXT:    xorl %edx, %edx
10367; O3-NEXT:  .Lpcsection385:
10368; O3-NEXT:    xorl %ecx, %ecx
10369; O3-NEXT:  .Lpcsection386:
10370; O3-NEXT:    xorl %ebx, %ebx
10371; O3-NEXT:  .Lpcsection387:
10372; O3-NEXT:    lock cmpxchg16b (%rdi)
10373; O3-NEXT:    movq $1, foo(%rip)
10374; O3-NEXT:    popq %rbx
10375; O3-NEXT:    .cfi_def_cfa_offset 8
10376; O3-NEXT:    retq
10377entry:
10378  load volatile i64, ptr @foo, align 8
10379  %x = load atomic i128, ptr %a acquire, align 16, !pcsections !0
10380  store volatile i64 1, ptr @foo, align 8
10381  ret i128 %x
10382}
10383
10384define i128 @atomic128_load_seq_cst(ptr %a) {
10385; O0-LABEL: atomic128_load_seq_cst:
10386; O0:       # %bb.0: # %entry
10387; O0-NEXT:    pushq %rbx
10388; O0-NEXT:    .cfi_def_cfa_offset 16
10389; O0-NEXT:    .cfi_offset %rbx, -16
10390; O0-NEXT:    movq foo(%rip), %rax
10391; O0-NEXT:  .Lpcsection420:
10392; O0-NEXT:    xorl %eax, %eax
10393; O0-NEXT:    movl %eax, %ebx
10394; O0-NEXT:    movq %rbx, %rax
10395; O0-NEXT:    movq %rbx, %rdx
10396; O0-NEXT:    movq %rbx, %rcx
10397; O0-NEXT:  .Lpcsection421:
10398; O0-NEXT:    lock cmpxchg16b (%rdi)
10399; O0-NEXT:    movq $1, foo(%rip)
10400; O0-NEXT:    popq %rbx
10401; O0-NEXT:    .cfi_def_cfa_offset 8
10402; O0-NEXT:    retq
10403;
10404; O1-LABEL: atomic128_load_seq_cst:
10405; O1:       # %bb.0: # %entry
10406; O1-NEXT:    pushq %rbx
10407; O1-NEXT:    .cfi_def_cfa_offset 16
10408; O1-NEXT:    .cfi_offset %rbx, -16
10409; O1-NEXT:    movq foo(%rip), %rax
10410; O1-NEXT:  .Lpcsection388:
10411; O1-NEXT:    xorl %eax, %eax
10412; O1-NEXT:  .Lpcsection389:
10413; O1-NEXT:    xorl %edx, %edx
10414; O1-NEXT:  .Lpcsection390:
10415; O1-NEXT:    xorl %ecx, %ecx
10416; O1-NEXT:  .Lpcsection391:
10417; O1-NEXT:    xorl %ebx, %ebx
10418; O1-NEXT:  .Lpcsection392:
10419; O1-NEXT:    lock cmpxchg16b (%rdi)
10420; O1-NEXT:    movq $1, foo(%rip)
10421; O1-NEXT:    popq %rbx
10422; O1-NEXT:    .cfi_def_cfa_offset 8
10423; O1-NEXT:    retq
10424;
10425; O2-LABEL: atomic128_load_seq_cst:
10426; O2:       # %bb.0: # %entry
10427; O2-NEXT:    pushq %rbx
10428; O2-NEXT:    .cfi_def_cfa_offset 16
10429; O2-NEXT:    .cfi_offset %rbx, -16
10430; O2-NEXT:    movq foo(%rip), %rax
10431; O2-NEXT:  .Lpcsection388:
10432; O2-NEXT:    xorl %eax, %eax
10433; O2-NEXT:  .Lpcsection389:
10434; O2-NEXT:    xorl %edx, %edx
10435; O2-NEXT:  .Lpcsection390:
10436; O2-NEXT:    xorl %ecx, %ecx
10437; O2-NEXT:  .Lpcsection391:
10438; O2-NEXT:    xorl %ebx, %ebx
10439; O2-NEXT:  .Lpcsection392:
10440; O2-NEXT:    lock cmpxchg16b (%rdi)
10441; O2-NEXT:    movq $1, foo(%rip)
10442; O2-NEXT:    popq %rbx
10443; O2-NEXT:    .cfi_def_cfa_offset 8
10444; O2-NEXT:    retq
10445;
10446; O3-LABEL: atomic128_load_seq_cst:
10447; O3:       # %bb.0: # %entry
10448; O3-NEXT:    pushq %rbx
10449; O3-NEXT:    .cfi_def_cfa_offset 16
10450; O3-NEXT:    .cfi_offset %rbx, -16
10451; O3-NEXT:    movq foo(%rip), %rax
10452; O3-NEXT:  .Lpcsection388:
10453; O3-NEXT:    xorl %eax, %eax
10454; O3-NEXT:  .Lpcsection389:
10455; O3-NEXT:    xorl %edx, %edx
10456; O3-NEXT:  .Lpcsection390:
10457; O3-NEXT:    xorl %ecx, %ecx
10458; O3-NEXT:  .Lpcsection391:
10459; O3-NEXT:    xorl %ebx, %ebx
10460; O3-NEXT:  .Lpcsection392:
10461; O3-NEXT:    lock cmpxchg16b (%rdi)
10462; O3-NEXT:    movq $1, foo(%rip)
10463; O3-NEXT:    popq %rbx
10464; O3-NEXT:    .cfi_def_cfa_offset 8
10465; O3-NEXT:    retq
10466entry:
10467  load volatile i64, ptr @foo, align 8
10468  %x = load atomic i128, ptr %a seq_cst, align 16, !pcsections !0
10469  store volatile i64 1, ptr @foo, align 8
10470  ret i128 %x
10471}
10472
10473define ptr @atomic128_load_seq_cst_ptr_ty(ptr %a) {
10474; O0-LABEL: atomic128_load_seq_cst_ptr_ty:
10475; O0:       # %bb.0: # %entry
10476; O0-NEXT:    movq foo(%rip), %rax
10477; O0-NEXT:  .Lpcsection422:
10478; O0-NEXT:    movq (%rdi), %rax
10479; O0-NEXT:    movq $1, foo
10480; O0-NEXT:    retq
10481;
10482; O1-LABEL: atomic128_load_seq_cst_ptr_ty:
10483; O1:       # %bb.0: # %entry
10484; O1-NEXT:    movq foo(%rip), %rax
10485; O1-NEXT:  .Lpcsection393:
10486; O1-NEXT:    movq (%rdi), %rax
10487; O1-NEXT:    movq $1, foo(%rip)
10488; O1-NEXT:    retq
10489;
10490; O2-LABEL: atomic128_load_seq_cst_ptr_ty:
10491; O2:       # %bb.0: # %entry
10492; O2-NEXT:    movq foo(%rip), %rax
10493; O2-NEXT:  .Lpcsection393:
10494; O2-NEXT:    movq (%rdi), %rax
10495; O2-NEXT:    movq $1, foo(%rip)
10496; O2-NEXT:    retq
10497;
10498; O3-LABEL: atomic128_load_seq_cst_ptr_ty:
10499; O3:       # %bb.0: # %entry
10500; O3-NEXT:    movq foo(%rip), %rax
10501; O3-NEXT:  .Lpcsection393:
10502; O3-NEXT:    movq (%rdi), %rax
10503; O3-NEXT:    movq $1, foo(%rip)
10504; O3-NEXT:    retq
10505entry:
10506  load volatile i64, ptr @foo, align 8
10507  %x = load atomic ptr, ptr %a seq_cst, align 16, !pcsections !0
10508  store volatile i64 1, ptr @foo, align 8
10509  ret ptr %x
10510}
10511
10512define void @atomic128_store_unordered(ptr %a) {
10513; O0-LABEL: atomic128_store_unordered:
10514; O0:       # %bb.0: # %entry
10515; O0-NEXT:    pushq %rbx
10516; O0-NEXT:    .cfi_def_cfa_offset 16
10517; O0-NEXT:    .cfi_offset %rbx, -16
10518; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10519; O0-NEXT:    movq foo(%rip), %rax
10520; O0-NEXT:  .Lpcsection423:
10521; O0-NEXT:    movq (%rdi), %rax
10522; O0-NEXT:  .Lpcsection424:
10523; O0-NEXT:    movq 8(%rdi), %rdx
10524; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10525; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10526; O0-NEXT:  .Lpcsection425:
10527; O0-NEXT:    jmp .LBB203_1
10528; O0-NEXT:  .LBB203_1: # %atomicrmw.start
10529; O0-NEXT:    # =>This Inner Loop Header: Depth=1
10530; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
10531; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
10532; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
10533; O0-NEXT:  .Lpcsection426:
10534; O0-NEXT:    xorl %ecx, %ecx
10535; O0-NEXT:  .Lpcsection427:
10536; O0-NEXT:    # kill: def $rcx killed $ecx
10537; O0-NEXT:  .Lpcsection428:
10538; O0-NEXT:    movl $42, %ebx
10539; O0-NEXT:  .Lpcsection429:
10540; O0-NEXT:    lock cmpxchg16b (%rsi)
10541; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10542; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10543; O0-NEXT:  .Lpcsection430:
10544; O0-NEXT:    jne .LBB203_1
10545; O0-NEXT:    jmp .LBB203_2
10546; O0-NEXT:  .LBB203_2: # %atomicrmw.end
10547; O0-NEXT:    movq $1, foo
10548; O0-NEXT:    popq %rbx
10549; O0-NEXT:    .cfi_def_cfa_offset 8
10550; O0-NEXT:    retq
10551;
10552; O1-LABEL: atomic128_store_unordered:
10553; O1:       # %bb.0: # %entry
10554; O1-NEXT:    pushq %rbx
10555; O1-NEXT:    .cfi_def_cfa_offset 16
10556; O1-NEXT:    .cfi_offset %rbx, -16
10557; O1-NEXT:    movq foo(%rip), %rax
10558; O1-NEXT:  .Lpcsection394:
10559; O1-NEXT:    movq (%rdi), %rax
10560; O1-NEXT:  .Lpcsection395:
10561; O1-NEXT:    movq 8(%rdi), %rdx
10562; O1-NEXT:  .Lpcsection396:
10563; O1-NEXT:    movl $42, %ebx
10564; O1-NEXT:    .p2align 4
10565; O1-NEXT:  .LBB203_1: # %atomicrmw.start
10566; O1-NEXT:    # =>This Inner Loop Header: Depth=1
10567; O1-NEXT:  .Lpcsection397:
10568; O1-NEXT:    xorl %ecx, %ecx
10569; O1-NEXT:  .Lpcsection398:
10570; O1-NEXT:    lock cmpxchg16b (%rdi)
10571; O1-NEXT:  .Lpcsection399:
10572; O1-NEXT:    jne .LBB203_1
10573; O1-NEXT:  # %bb.2: # %atomicrmw.end
10574; O1-NEXT:    movq $1, foo(%rip)
10575; O1-NEXT:    popq %rbx
10576; O1-NEXT:    .cfi_def_cfa_offset 8
10577; O1-NEXT:    retq
10578;
10579; O2-LABEL: atomic128_store_unordered:
10580; O2:       # %bb.0: # %entry
10581; O2-NEXT:    pushq %rbx
10582; O2-NEXT:    .cfi_def_cfa_offset 16
10583; O2-NEXT:    .cfi_offset %rbx, -16
10584; O2-NEXT:    movq foo(%rip), %rax
10585; O2-NEXT:  .Lpcsection394:
10586; O2-NEXT:    movq (%rdi), %rax
10587; O2-NEXT:  .Lpcsection395:
10588; O2-NEXT:    movq 8(%rdi), %rdx
10589; O2-NEXT:  .Lpcsection396:
10590; O2-NEXT:    movl $42, %ebx
10591; O2-NEXT:    .p2align 4
10592; O2-NEXT:  .LBB203_1: # %atomicrmw.start
10593; O2-NEXT:    # =>This Inner Loop Header: Depth=1
10594; O2-NEXT:  .Lpcsection397:
10595; O2-NEXT:    xorl %ecx, %ecx
10596; O2-NEXT:  .Lpcsection398:
10597; O2-NEXT:    lock cmpxchg16b (%rdi)
10598; O2-NEXT:  .Lpcsection399:
10599; O2-NEXT:    jne .LBB203_1
10600; O2-NEXT:  # %bb.2: # %atomicrmw.end
10601; O2-NEXT:    movq $1, foo(%rip)
10602; O2-NEXT:    popq %rbx
10603; O2-NEXT:    .cfi_def_cfa_offset 8
10604; O2-NEXT:    retq
10605;
10606; O3-LABEL: atomic128_store_unordered:
10607; O3:       # %bb.0: # %entry
10608; O3-NEXT:    pushq %rbx
10609; O3-NEXT:    .cfi_def_cfa_offset 16
10610; O3-NEXT:    .cfi_offset %rbx, -16
10611; O3-NEXT:    movq foo(%rip), %rax
10612; O3-NEXT:  .Lpcsection394:
10613; O3-NEXT:    movq (%rdi), %rax
10614; O3-NEXT:  .Lpcsection395:
10615; O3-NEXT:    movq 8(%rdi), %rdx
10616; O3-NEXT:  .Lpcsection396:
10617; O3-NEXT:    movl $42, %ebx
10618; O3-NEXT:    .p2align 4
10619; O3-NEXT:  .LBB203_1: # %atomicrmw.start
10620; O3-NEXT:    # =>This Inner Loop Header: Depth=1
10621; O3-NEXT:  .Lpcsection397:
10622; O3-NEXT:    xorl %ecx, %ecx
10623; O3-NEXT:  .Lpcsection398:
10624; O3-NEXT:    lock cmpxchg16b (%rdi)
10625; O3-NEXT:  .Lpcsection399:
10626; O3-NEXT:    jne .LBB203_1
10627; O3-NEXT:  # %bb.2: # %atomicrmw.end
10628; O3-NEXT:    movq $1, foo(%rip)
10629; O3-NEXT:    popq %rbx
10630; O3-NEXT:    .cfi_def_cfa_offset 8
10631; O3-NEXT:    retq
10632entry:
10633  load volatile i64, ptr @foo, align 8
10634  store atomic i128 42, ptr %a unordered, align 16, !pcsections !0
10635  store volatile i64 1, ptr @foo, align 8
10636  ret void
10637}
10638
10639define void @atomic128_store_monotonic(ptr %a) {
10640; O0-LABEL: atomic128_store_monotonic:
10641; O0:       # %bb.0: # %entry
10642; O0-NEXT:    pushq %rbx
10643; O0-NEXT:    .cfi_def_cfa_offset 16
10644; O0-NEXT:    .cfi_offset %rbx, -16
10645; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10646; O0-NEXT:    movq foo(%rip), %rax
10647; O0-NEXT:  .Lpcsection431:
10648; O0-NEXT:    movq (%rdi), %rax
10649; O0-NEXT:  .Lpcsection432:
10650; O0-NEXT:    movq 8(%rdi), %rdx
10651; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10652; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10653; O0-NEXT:  .Lpcsection433:
10654; O0-NEXT:    jmp .LBB204_1
10655; O0-NEXT:  .LBB204_1: # %atomicrmw.start
10656; O0-NEXT:    # =>This Inner Loop Header: Depth=1
10657; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
10658; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
10659; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
10660; O0-NEXT:  .Lpcsection434:
10661; O0-NEXT:    xorl %ecx, %ecx
10662; O0-NEXT:  .Lpcsection435:
10663; O0-NEXT:    # kill: def $rcx killed $ecx
10664; O0-NEXT:  .Lpcsection436:
10665; O0-NEXT:    movl $42, %ebx
10666; O0-NEXT:  .Lpcsection437:
10667; O0-NEXT:    lock cmpxchg16b (%rsi)
10668; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10669; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10670; O0-NEXT:  .Lpcsection438:
10671; O0-NEXT:    jne .LBB204_1
10672; O0-NEXT:    jmp .LBB204_2
10673; O0-NEXT:  .LBB204_2: # %atomicrmw.end
10674; O0-NEXT:    movq $1, foo
10675; O0-NEXT:    popq %rbx
10676; O0-NEXT:    .cfi_def_cfa_offset 8
10677; O0-NEXT:    retq
10678;
10679; O1-LABEL: atomic128_store_monotonic:
10680; O1:       # %bb.0: # %entry
10681; O1-NEXT:    pushq %rbx
10682; O1-NEXT:    .cfi_def_cfa_offset 16
10683; O1-NEXT:    .cfi_offset %rbx, -16
10684; O1-NEXT:    movq foo(%rip), %rax
10685; O1-NEXT:  .Lpcsection400:
10686; O1-NEXT:    movq (%rdi), %rax
10687; O1-NEXT:  .Lpcsection401:
10688; O1-NEXT:    movq 8(%rdi), %rdx
10689; O1-NEXT:  .Lpcsection402:
10690; O1-NEXT:    movl $42, %ebx
10691; O1-NEXT:    .p2align 4
10692; O1-NEXT:  .LBB204_1: # %atomicrmw.start
10693; O1-NEXT:    # =>This Inner Loop Header: Depth=1
10694; O1-NEXT:  .Lpcsection403:
10695; O1-NEXT:    xorl %ecx, %ecx
10696; O1-NEXT:  .Lpcsection404:
10697; O1-NEXT:    lock cmpxchg16b (%rdi)
10698; O1-NEXT:  .Lpcsection405:
10699; O1-NEXT:    jne .LBB204_1
10700; O1-NEXT:  # %bb.2: # %atomicrmw.end
10701; O1-NEXT:    movq $1, foo(%rip)
10702; O1-NEXT:    popq %rbx
10703; O1-NEXT:    .cfi_def_cfa_offset 8
10704; O1-NEXT:    retq
10705;
10706; O2-LABEL: atomic128_store_monotonic:
10707; O2:       # %bb.0: # %entry
10708; O2-NEXT:    pushq %rbx
10709; O2-NEXT:    .cfi_def_cfa_offset 16
10710; O2-NEXT:    .cfi_offset %rbx, -16
10711; O2-NEXT:    movq foo(%rip), %rax
10712; O2-NEXT:  .Lpcsection400:
10713; O2-NEXT:    movq (%rdi), %rax
10714; O2-NEXT:  .Lpcsection401:
10715; O2-NEXT:    movq 8(%rdi), %rdx
10716; O2-NEXT:  .Lpcsection402:
10717; O2-NEXT:    movl $42, %ebx
10718; O2-NEXT:    .p2align 4
10719; O2-NEXT:  .LBB204_1: # %atomicrmw.start
10720; O2-NEXT:    # =>This Inner Loop Header: Depth=1
10721; O2-NEXT:  .Lpcsection403:
10722; O2-NEXT:    xorl %ecx, %ecx
10723; O2-NEXT:  .Lpcsection404:
10724; O2-NEXT:    lock cmpxchg16b (%rdi)
10725; O2-NEXT:  .Lpcsection405:
10726; O2-NEXT:    jne .LBB204_1
10727; O2-NEXT:  # %bb.2: # %atomicrmw.end
10728; O2-NEXT:    movq $1, foo(%rip)
10729; O2-NEXT:    popq %rbx
10730; O2-NEXT:    .cfi_def_cfa_offset 8
10731; O2-NEXT:    retq
10732;
10733; O3-LABEL: atomic128_store_monotonic:
10734; O3:       # %bb.0: # %entry
10735; O3-NEXT:    pushq %rbx
10736; O3-NEXT:    .cfi_def_cfa_offset 16
10737; O3-NEXT:    .cfi_offset %rbx, -16
10738; O3-NEXT:    movq foo(%rip), %rax
10739; O3-NEXT:  .Lpcsection400:
10740; O3-NEXT:    movq (%rdi), %rax
10741; O3-NEXT:  .Lpcsection401:
10742; O3-NEXT:    movq 8(%rdi), %rdx
10743; O3-NEXT:  .Lpcsection402:
10744; O3-NEXT:    movl $42, %ebx
10745; O3-NEXT:    .p2align 4
10746; O3-NEXT:  .LBB204_1: # %atomicrmw.start
10747; O3-NEXT:    # =>This Inner Loop Header: Depth=1
10748; O3-NEXT:  .Lpcsection403:
10749; O3-NEXT:    xorl %ecx, %ecx
10750; O3-NEXT:  .Lpcsection404:
10751; O3-NEXT:    lock cmpxchg16b (%rdi)
10752; O3-NEXT:  .Lpcsection405:
10753; O3-NEXT:    jne .LBB204_1
10754; O3-NEXT:  # %bb.2: # %atomicrmw.end
10755; O3-NEXT:    movq $1, foo(%rip)
10756; O3-NEXT:    popq %rbx
10757; O3-NEXT:    .cfi_def_cfa_offset 8
10758; O3-NEXT:    retq
10759entry:
10760  load volatile i64, ptr @foo, align 8
10761  store atomic i128 42, ptr %a monotonic, align 16, !pcsections !0
10762  store volatile i64 1, ptr @foo, align 8
10763  ret void
10764}
10765
10766define void @atomic128_store_release(ptr %a) {
10767; O0-LABEL: atomic128_store_release:
10768; O0:       # %bb.0: # %entry
10769; O0-NEXT:    pushq %rbx
10770; O0-NEXT:    .cfi_def_cfa_offset 16
10771; O0-NEXT:    .cfi_offset %rbx, -16
10772; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10773; O0-NEXT:    movq foo(%rip), %rax
10774; O0-NEXT:  .Lpcsection439:
10775; O0-NEXT:    movq (%rdi), %rax
10776; O0-NEXT:  .Lpcsection440:
10777; O0-NEXT:    movq 8(%rdi), %rdx
10778; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10779; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10780; O0-NEXT:  .Lpcsection441:
10781; O0-NEXT:    jmp .LBB205_1
10782; O0-NEXT:  .LBB205_1: # %atomicrmw.start
10783; O0-NEXT:    # =>This Inner Loop Header: Depth=1
10784; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
10785; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
10786; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
10787; O0-NEXT:  .Lpcsection442:
10788; O0-NEXT:    xorl %ecx, %ecx
10789; O0-NEXT:  .Lpcsection443:
10790; O0-NEXT:    # kill: def $rcx killed $ecx
10791; O0-NEXT:  .Lpcsection444:
10792; O0-NEXT:    movl $42, %ebx
10793; O0-NEXT:  .Lpcsection445:
10794; O0-NEXT:    lock cmpxchg16b (%rsi)
10795; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10796; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10797; O0-NEXT:  .Lpcsection446:
10798; O0-NEXT:    jne .LBB205_1
10799; O0-NEXT:    jmp .LBB205_2
10800; O0-NEXT:  .LBB205_2: # %atomicrmw.end
10801; O0-NEXT:    movq $1, foo
10802; O0-NEXT:    popq %rbx
10803; O0-NEXT:    .cfi_def_cfa_offset 8
10804; O0-NEXT:    retq
10805;
10806; O1-LABEL: atomic128_store_release:
10807; O1:       # %bb.0: # %entry
10808; O1-NEXT:    pushq %rbx
10809; O1-NEXT:    .cfi_def_cfa_offset 16
10810; O1-NEXT:    .cfi_offset %rbx, -16
10811; O1-NEXT:    movq foo(%rip), %rax
10812; O1-NEXT:  .Lpcsection406:
10813; O1-NEXT:    movq (%rdi), %rax
10814; O1-NEXT:  .Lpcsection407:
10815; O1-NEXT:    movq 8(%rdi), %rdx
10816; O1-NEXT:  .Lpcsection408:
10817; O1-NEXT:    movl $42, %ebx
10818; O1-NEXT:    .p2align 4
10819; O1-NEXT:  .LBB205_1: # %atomicrmw.start
10820; O1-NEXT:    # =>This Inner Loop Header: Depth=1
10821; O1-NEXT:  .Lpcsection409:
10822; O1-NEXT:    xorl %ecx, %ecx
10823; O1-NEXT:  .Lpcsection410:
10824; O1-NEXT:    lock cmpxchg16b (%rdi)
10825; O1-NEXT:  .Lpcsection411:
10826; O1-NEXT:    jne .LBB205_1
10827; O1-NEXT:  # %bb.2: # %atomicrmw.end
10828; O1-NEXT:    movq $1, foo(%rip)
10829; O1-NEXT:    popq %rbx
10830; O1-NEXT:    .cfi_def_cfa_offset 8
10831; O1-NEXT:    retq
10832;
10833; O2-LABEL: atomic128_store_release:
10834; O2:       # %bb.0: # %entry
10835; O2-NEXT:    pushq %rbx
10836; O2-NEXT:    .cfi_def_cfa_offset 16
10837; O2-NEXT:    .cfi_offset %rbx, -16
10838; O2-NEXT:    movq foo(%rip), %rax
10839; O2-NEXT:  .Lpcsection406:
10840; O2-NEXT:    movq (%rdi), %rax
10841; O2-NEXT:  .Lpcsection407:
10842; O2-NEXT:    movq 8(%rdi), %rdx
10843; O2-NEXT:  .Lpcsection408:
10844; O2-NEXT:    movl $42, %ebx
10845; O2-NEXT:    .p2align 4
10846; O2-NEXT:  .LBB205_1: # %atomicrmw.start
10847; O2-NEXT:    # =>This Inner Loop Header: Depth=1
10848; O2-NEXT:  .Lpcsection409:
10849; O2-NEXT:    xorl %ecx, %ecx
10850; O2-NEXT:  .Lpcsection410:
10851; O2-NEXT:    lock cmpxchg16b (%rdi)
10852; O2-NEXT:  .Lpcsection411:
10853; O2-NEXT:    jne .LBB205_1
10854; O2-NEXT:  # %bb.2: # %atomicrmw.end
10855; O2-NEXT:    movq $1, foo(%rip)
10856; O2-NEXT:    popq %rbx
10857; O2-NEXT:    .cfi_def_cfa_offset 8
10858; O2-NEXT:    retq
10859;
10860; O3-LABEL: atomic128_store_release:
10861; O3:       # %bb.0: # %entry
10862; O3-NEXT:    pushq %rbx
10863; O3-NEXT:    .cfi_def_cfa_offset 16
10864; O3-NEXT:    .cfi_offset %rbx, -16
10865; O3-NEXT:    movq foo(%rip), %rax
10866; O3-NEXT:  .Lpcsection406:
10867; O3-NEXT:    movq (%rdi), %rax
10868; O3-NEXT:  .Lpcsection407:
10869; O3-NEXT:    movq 8(%rdi), %rdx
10870; O3-NEXT:  .Lpcsection408:
10871; O3-NEXT:    movl $42, %ebx
10872; O3-NEXT:    .p2align 4
10873; O3-NEXT:  .LBB205_1: # %atomicrmw.start
10874; O3-NEXT:    # =>This Inner Loop Header: Depth=1
10875; O3-NEXT:  .Lpcsection409:
10876; O3-NEXT:    xorl %ecx, %ecx
10877; O3-NEXT:  .Lpcsection410:
10878; O3-NEXT:    lock cmpxchg16b (%rdi)
10879; O3-NEXT:  .Lpcsection411:
10880; O3-NEXT:    jne .LBB205_1
10881; O3-NEXT:  # %bb.2: # %atomicrmw.end
10882; O3-NEXT:    movq $1, foo(%rip)
10883; O3-NEXT:    popq %rbx
10884; O3-NEXT:    .cfi_def_cfa_offset 8
10885; O3-NEXT:    retq
10886entry:
10887  load volatile i64, ptr @foo, align 8
10888  store atomic i128 42, ptr %a release, align 16, !pcsections !0
10889  store volatile i64 1, ptr @foo, align 8
10890  ret void
10891}
10892
10893define void @atomic128_store_seq_cst(ptr %a) {
10894; O0-LABEL: atomic128_store_seq_cst:
10895; O0:       # %bb.0: # %entry
10896; O0-NEXT:    pushq %rbx
10897; O0-NEXT:    .cfi_def_cfa_offset 16
10898; O0-NEXT:    .cfi_offset %rbx, -16
10899; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10900; O0-NEXT:    movq foo(%rip), %rax
10901; O0-NEXT:  .Lpcsection447:
10902; O0-NEXT:    movq (%rdi), %rax
10903; O0-NEXT:  .Lpcsection448:
10904; O0-NEXT:    movq 8(%rdi), %rdx
10905; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10906; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10907; O0-NEXT:  .Lpcsection449:
10908; O0-NEXT:    jmp .LBB206_1
10909; O0-NEXT:  .LBB206_1: # %atomicrmw.start
10910; O0-NEXT:    # =>This Inner Loop Header: Depth=1
10911; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
10912; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
10913; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
10914; O0-NEXT:  .Lpcsection450:
10915; O0-NEXT:    xorl %ecx, %ecx
10916; O0-NEXT:  .Lpcsection451:
10917; O0-NEXT:    # kill: def $rcx killed $ecx
10918; O0-NEXT:  .Lpcsection452:
10919; O0-NEXT:    movl $42, %ebx
10920; O0-NEXT:  .Lpcsection453:
10921; O0-NEXT:    lock cmpxchg16b (%rsi)
10922; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10923; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
10924; O0-NEXT:  .Lpcsection454:
10925; O0-NEXT:    jne .LBB206_1
10926; O0-NEXT:    jmp .LBB206_2
10927; O0-NEXT:  .LBB206_2: # %atomicrmw.end
10928; O0-NEXT:    movq $1, foo
10929; O0-NEXT:    popq %rbx
10930; O0-NEXT:    .cfi_def_cfa_offset 8
10931; O0-NEXT:    retq
10932;
10933; O1-LABEL: atomic128_store_seq_cst:
10934; O1:       # %bb.0: # %entry
10935; O1-NEXT:    pushq %rbx
10936; O1-NEXT:    .cfi_def_cfa_offset 16
10937; O1-NEXT:    .cfi_offset %rbx, -16
10938; O1-NEXT:    movq foo(%rip), %rax
10939; O1-NEXT:  .Lpcsection412:
10940; O1-NEXT:    movq (%rdi), %rax
10941; O1-NEXT:  .Lpcsection413:
10942; O1-NEXT:    movq 8(%rdi), %rdx
10943; O1-NEXT:  .Lpcsection414:
10944; O1-NEXT:    movl $42, %ebx
10945; O1-NEXT:    .p2align 4
10946; O1-NEXT:  .LBB206_1: # %atomicrmw.start
10947; O1-NEXT:    # =>This Inner Loop Header: Depth=1
10948; O1-NEXT:  .Lpcsection415:
10949; O1-NEXT:    xorl %ecx, %ecx
10950; O1-NEXT:  .Lpcsection416:
10951; O1-NEXT:    lock cmpxchg16b (%rdi)
10952; O1-NEXT:  .Lpcsection417:
10953; O1-NEXT:    jne .LBB206_1
10954; O1-NEXT:  # %bb.2: # %atomicrmw.end
10955; O1-NEXT:    movq $1, foo(%rip)
10956; O1-NEXT:    popq %rbx
10957; O1-NEXT:    .cfi_def_cfa_offset 8
10958; O1-NEXT:    retq
10959;
10960; O2-LABEL: atomic128_store_seq_cst:
10961; O2:       # %bb.0: # %entry
10962; O2-NEXT:    pushq %rbx
10963; O2-NEXT:    .cfi_def_cfa_offset 16
10964; O2-NEXT:    .cfi_offset %rbx, -16
10965; O2-NEXT:    movq foo(%rip), %rax
10966; O2-NEXT:  .Lpcsection412:
10967; O2-NEXT:    movq (%rdi), %rax
10968; O2-NEXT:  .Lpcsection413:
10969; O2-NEXT:    movq 8(%rdi), %rdx
10970; O2-NEXT:  .Lpcsection414:
10971; O2-NEXT:    movl $42, %ebx
10972; O2-NEXT:    .p2align 4
10973; O2-NEXT:  .LBB206_1: # %atomicrmw.start
10974; O2-NEXT:    # =>This Inner Loop Header: Depth=1
10975; O2-NEXT:  .Lpcsection415:
10976; O2-NEXT:    xorl %ecx, %ecx
10977; O2-NEXT:  .Lpcsection416:
10978; O2-NEXT:    lock cmpxchg16b (%rdi)
10979; O2-NEXT:  .Lpcsection417:
10980; O2-NEXT:    jne .LBB206_1
10981; O2-NEXT:  # %bb.2: # %atomicrmw.end
10982; O2-NEXT:    movq $1, foo(%rip)
10983; O2-NEXT:    popq %rbx
10984; O2-NEXT:    .cfi_def_cfa_offset 8
10985; O2-NEXT:    retq
10986;
10987; O3-LABEL: atomic128_store_seq_cst:
10988; O3:       # %bb.0: # %entry
10989; O3-NEXT:    pushq %rbx
10990; O3-NEXT:    .cfi_def_cfa_offset 16
10991; O3-NEXT:    .cfi_offset %rbx, -16
10992; O3-NEXT:    movq foo(%rip), %rax
10993; O3-NEXT:  .Lpcsection412:
10994; O3-NEXT:    movq (%rdi), %rax
10995; O3-NEXT:  .Lpcsection413:
10996; O3-NEXT:    movq 8(%rdi), %rdx
10997; O3-NEXT:  .Lpcsection414:
10998; O3-NEXT:    movl $42, %ebx
10999; O3-NEXT:    .p2align 4
11000; O3-NEXT:  .LBB206_1: # %atomicrmw.start
11001; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11002; O3-NEXT:  .Lpcsection415:
11003; O3-NEXT:    xorl %ecx, %ecx
11004; O3-NEXT:  .Lpcsection416:
11005; O3-NEXT:    lock cmpxchg16b (%rdi)
11006; O3-NEXT:  .Lpcsection417:
11007; O3-NEXT:    jne .LBB206_1
11008; O3-NEXT:  # %bb.2: # %atomicrmw.end
11009; O3-NEXT:    movq $1, foo(%rip)
11010; O3-NEXT:    popq %rbx
11011; O3-NEXT:    .cfi_def_cfa_offset 8
11012; O3-NEXT:    retq
11013entry:
11014  load volatile i64, ptr @foo, align 8
11015  store atomic i128 42, ptr %a seq_cst, align 16, !pcsections !0
11016  store volatile i64 1, ptr @foo, align 8
11017  ret void
11018}
11019
11020define void @atomic128_store_seq_cst_ptr_ty(ptr %a, ptr %v) {
11021; O0-LABEL: atomic128_store_seq_cst_ptr_ty:
11022; O0:       # %bb.0: # %entry
11023; O0-NEXT:    movq foo(%rip), %rax
11024; O0-NEXT:  .Lpcsection455:
11025; O0-NEXT:    xchgq %rsi, (%rdi)
11026; O0-NEXT:    movq $1, foo
11027; O0-NEXT:    retq
11028;
11029; O1-LABEL: atomic128_store_seq_cst_ptr_ty:
11030; O1:       # %bb.0: # %entry
11031; O1-NEXT:    movq foo(%rip), %rax
11032; O1-NEXT:  .Lpcsection418:
11033; O1-NEXT:    xchgq %rsi, (%rdi)
11034; O1-NEXT:    movq $1, foo(%rip)
11035; O1-NEXT:    retq
11036;
11037; O2-LABEL: atomic128_store_seq_cst_ptr_ty:
11038; O2:       # %bb.0: # %entry
11039; O2-NEXT:    movq foo(%rip), %rax
11040; O2-NEXT:  .Lpcsection418:
11041; O2-NEXT:    xchgq %rsi, (%rdi)
11042; O2-NEXT:    movq $1, foo(%rip)
11043; O2-NEXT:    retq
11044;
11045; O3-LABEL: atomic128_store_seq_cst_ptr_ty:
11046; O3:       # %bb.0: # %entry
11047; O3-NEXT:    movq foo(%rip), %rax
11048; O3-NEXT:  .Lpcsection418:
11049; O3-NEXT:    xchgq %rsi, (%rdi)
11050; O3-NEXT:    movq $1, foo(%rip)
11051; O3-NEXT:    retq
11052entry:
11053  load volatile i64, ptr @foo, align 8
11054  store atomic ptr %v, ptr %a seq_cst, align 16, !pcsections !0
11055  store volatile i64 1, ptr @foo, align 8
11056  ret void
11057}
11058
11059define void @atomic128_xchg_monotonic(ptr %a) {
11060; O0-LABEL: atomic128_xchg_monotonic:
11061; O0:       # %bb.0: # %entry
11062; O0-NEXT:    pushq %rbx
11063; O0-NEXT:    .cfi_def_cfa_offset 16
11064; O0-NEXT:    .cfi_offset %rbx, -16
11065; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11066; O0-NEXT:    movq foo(%rip), %rax
11067; O0-NEXT:  .Lpcsection456:
11068; O0-NEXT:    movq (%rdi), %rax
11069; O0-NEXT:  .Lpcsection457:
11070; O0-NEXT:    movq 8(%rdi), %rdx
11071; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11072; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11073; O0-NEXT:  .Lpcsection458:
11074; O0-NEXT:    jmp .LBB208_1
11075; O0-NEXT:  .LBB208_1: # %atomicrmw.start
11076; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11077; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11078; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11079; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11080; O0-NEXT:  .Lpcsection459:
11081; O0-NEXT:    xorl %ecx, %ecx
11082; O0-NEXT:  .Lpcsection460:
11083; O0-NEXT:    # kill: def $rcx killed $ecx
11084; O0-NEXT:  .Lpcsection461:
11085; O0-NEXT:    movl $42, %ebx
11086; O0-NEXT:  .Lpcsection462:
11087; O0-NEXT:    lock cmpxchg16b (%rsi)
11088; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11089; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11090; O0-NEXT:  .Lpcsection463:
11091; O0-NEXT:    jne .LBB208_1
11092; O0-NEXT:    jmp .LBB208_2
11093; O0-NEXT:  .LBB208_2: # %atomicrmw.end
11094; O0-NEXT:    movq $1, foo
11095; O0-NEXT:    popq %rbx
11096; O0-NEXT:    .cfi_def_cfa_offset 8
11097; O0-NEXT:    retq
11098;
11099; O1-LABEL: atomic128_xchg_monotonic:
11100; O1:       # %bb.0: # %entry
11101; O1-NEXT:    pushq %rbx
11102; O1-NEXT:    .cfi_def_cfa_offset 16
11103; O1-NEXT:    .cfi_offset %rbx, -16
11104; O1-NEXT:    movq foo(%rip), %rax
11105; O1-NEXT:  .Lpcsection419:
11106; O1-NEXT:    movq (%rdi), %rax
11107; O1-NEXT:  .Lpcsection420:
11108; O1-NEXT:    movq 8(%rdi), %rdx
11109; O1-NEXT:  .Lpcsection421:
11110; O1-NEXT:    movl $42, %ebx
11111; O1-NEXT:    .p2align 4
11112; O1-NEXT:  .LBB208_1: # %atomicrmw.start
11113; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11114; O1-NEXT:  .Lpcsection422:
11115; O1-NEXT:    xorl %ecx, %ecx
11116; O1-NEXT:  .Lpcsection423:
11117; O1-NEXT:    lock cmpxchg16b (%rdi)
11118; O1-NEXT:  .Lpcsection424:
11119; O1-NEXT:    jne .LBB208_1
11120; O1-NEXT:  # %bb.2: # %atomicrmw.end
11121; O1-NEXT:    movq $1, foo(%rip)
11122; O1-NEXT:    popq %rbx
11123; O1-NEXT:    .cfi_def_cfa_offset 8
11124; O1-NEXT:    retq
11125;
11126; O2-LABEL: atomic128_xchg_monotonic:
11127; O2:       # %bb.0: # %entry
11128; O2-NEXT:    pushq %rbx
11129; O2-NEXT:    .cfi_def_cfa_offset 16
11130; O2-NEXT:    .cfi_offset %rbx, -16
11131; O2-NEXT:    movq foo(%rip), %rax
11132; O2-NEXT:  .Lpcsection419:
11133; O2-NEXT:    movq (%rdi), %rax
11134; O2-NEXT:  .Lpcsection420:
11135; O2-NEXT:    movq 8(%rdi), %rdx
11136; O2-NEXT:  .Lpcsection421:
11137; O2-NEXT:    movl $42, %ebx
11138; O2-NEXT:    .p2align 4
11139; O2-NEXT:  .LBB208_1: # %atomicrmw.start
11140; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11141; O2-NEXT:  .Lpcsection422:
11142; O2-NEXT:    xorl %ecx, %ecx
11143; O2-NEXT:  .Lpcsection423:
11144; O2-NEXT:    lock cmpxchg16b (%rdi)
11145; O2-NEXT:  .Lpcsection424:
11146; O2-NEXT:    jne .LBB208_1
11147; O2-NEXT:  # %bb.2: # %atomicrmw.end
11148; O2-NEXT:    movq $1, foo(%rip)
11149; O2-NEXT:    popq %rbx
11150; O2-NEXT:    .cfi_def_cfa_offset 8
11151; O2-NEXT:    retq
11152;
11153; O3-LABEL: atomic128_xchg_monotonic:
11154; O3:       # %bb.0: # %entry
11155; O3-NEXT:    pushq %rbx
11156; O3-NEXT:    .cfi_def_cfa_offset 16
11157; O3-NEXT:    .cfi_offset %rbx, -16
11158; O3-NEXT:    movq foo(%rip), %rax
11159; O3-NEXT:  .Lpcsection419:
11160; O3-NEXT:    movq (%rdi), %rax
11161; O3-NEXT:  .Lpcsection420:
11162; O3-NEXT:    movq 8(%rdi), %rdx
11163; O3-NEXT:  .Lpcsection421:
11164; O3-NEXT:    movl $42, %ebx
11165; O3-NEXT:    .p2align 4
11166; O3-NEXT:  .LBB208_1: # %atomicrmw.start
11167; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11168; O3-NEXT:  .Lpcsection422:
11169; O3-NEXT:    xorl %ecx, %ecx
11170; O3-NEXT:  .Lpcsection423:
11171; O3-NEXT:    lock cmpxchg16b (%rdi)
11172; O3-NEXT:  .Lpcsection424:
11173; O3-NEXT:    jne .LBB208_1
11174; O3-NEXT:  # %bb.2: # %atomicrmw.end
11175; O3-NEXT:    movq $1, foo(%rip)
11176; O3-NEXT:    popq %rbx
11177; O3-NEXT:    .cfi_def_cfa_offset 8
11178; O3-NEXT:    retq
11179entry:
11180  load volatile i64, ptr @foo, align 8
11181  %x = atomicrmw xchg ptr %a, i128 42 monotonic, align 16, !pcsections !0
11182  store volatile i64 1, ptr @foo, align 8
11183  ret void
11184}
11185
11186define void @atomic128_add_monotonic(ptr %a) {
11187; O0-LABEL: atomic128_add_monotonic:
11188; O0:       # %bb.0: # %entry
11189; O0-NEXT:    pushq %rbx
11190; O0-NEXT:    .cfi_def_cfa_offset 16
11191; O0-NEXT:    .cfi_offset %rbx, -16
11192; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11193; O0-NEXT:    movq foo(%rip), %rax
11194; O0-NEXT:  .Lpcsection464:
11195; O0-NEXT:    movq (%rdi), %rax
11196; O0-NEXT:  .Lpcsection465:
11197; O0-NEXT:    movq 8(%rdi), %rdx
11198; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11199; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11200; O0-NEXT:  .Lpcsection466:
11201; O0-NEXT:    jmp .LBB209_1
11202; O0-NEXT:  .LBB209_1: # %atomicrmw.start
11203; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11204; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11205; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11206; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11207; O0-NEXT:    movq %rax, %rbx
11208; O0-NEXT:  .Lpcsection467:
11209; O0-NEXT:    addq $42, %rbx
11210; O0-NEXT:    movq %rdx, %rcx
11211; O0-NEXT:  .Lpcsection468:
11212; O0-NEXT:    adcq $0, %rcx
11213; O0-NEXT:  .Lpcsection469:
11214; O0-NEXT:    lock cmpxchg16b (%rsi)
11215; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11216; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11217; O0-NEXT:  .Lpcsection470:
11218; O0-NEXT:    jne .LBB209_1
11219; O0-NEXT:    jmp .LBB209_2
11220; O0-NEXT:  .LBB209_2: # %atomicrmw.end
11221; O0-NEXT:    movq $1, foo
11222; O0-NEXT:    popq %rbx
11223; O0-NEXT:    .cfi_def_cfa_offset 8
11224; O0-NEXT:    retq
11225;
11226; O1-LABEL: atomic128_add_monotonic:
11227; O1:       # %bb.0: # %entry
11228; O1-NEXT:    pushq %rbx
11229; O1-NEXT:    .cfi_def_cfa_offset 16
11230; O1-NEXT:    .cfi_offset %rbx, -16
11231; O1-NEXT:    movq foo(%rip), %rax
11232; O1-NEXT:  .Lpcsection425:
11233; O1-NEXT:    movq (%rdi), %rax
11234; O1-NEXT:  .Lpcsection426:
11235; O1-NEXT:    movq 8(%rdi), %rdx
11236; O1-NEXT:    .p2align 4
11237; O1-NEXT:  .LBB209_1: # %atomicrmw.start
11238; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11239; O1-NEXT:    movq %rax, %rbx
11240; O1-NEXT:  .Lpcsection427:
11241; O1-NEXT:    addq $42, %rbx
11242; O1-NEXT:    movq %rdx, %rcx
11243; O1-NEXT:  .Lpcsection428:
11244; O1-NEXT:    adcq $0, %rcx
11245; O1-NEXT:  .Lpcsection429:
11246; O1-NEXT:    lock cmpxchg16b (%rdi)
11247; O1-NEXT:  .Lpcsection430:
11248; O1-NEXT:    jne .LBB209_1
11249; O1-NEXT:  # %bb.2: # %atomicrmw.end
11250; O1-NEXT:    movq $1, foo(%rip)
11251; O1-NEXT:    popq %rbx
11252; O1-NEXT:    .cfi_def_cfa_offset 8
11253; O1-NEXT:    retq
11254;
11255; O2-LABEL: atomic128_add_monotonic:
11256; O2:       # %bb.0: # %entry
11257; O2-NEXT:    pushq %rbx
11258; O2-NEXT:    .cfi_def_cfa_offset 16
11259; O2-NEXT:    .cfi_offset %rbx, -16
11260; O2-NEXT:    movq foo(%rip), %rax
11261; O2-NEXT:  .Lpcsection425:
11262; O2-NEXT:    movq (%rdi), %rax
11263; O2-NEXT:  .Lpcsection426:
11264; O2-NEXT:    movq 8(%rdi), %rdx
11265; O2-NEXT:    .p2align 4
11266; O2-NEXT:  .LBB209_1: # %atomicrmw.start
11267; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11268; O2-NEXT:    movq %rax, %rbx
11269; O2-NEXT:  .Lpcsection427:
11270; O2-NEXT:    addq $42, %rbx
11271; O2-NEXT:    movq %rdx, %rcx
11272; O2-NEXT:  .Lpcsection428:
11273; O2-NEXT:    adcq $0, %rcx
11274; O2-NEXT:  .Lpcsection429:
11275; O2-NEXT:    lock cmpxchg16b (%rdi)
11276; O2-NEXT:  .Lpcsection430:
11277; O2-NEXT:    jne .LBB209_1
11278; O2-NEXT:  # %bb.2: # %atomicrmw.end
11279; O2-NEXT:    movq $1, foo(%rip)
11280; O2-NEXT:    popq %rbx
11281; O2-NEXT:    .cfi_def_cfa_offset 8
11282; O2-NEXT:    retq
11283;
11284; O3-LABEL: atomic128_add_monotonic:
11285; O3:       # %bb.0: # %entry
11286; O3-NEXT:    pushq %rbx
11287; O3-NEXT:    .cfi_def_cfa_offset 16
11288; O3-NEXT:    .cfi_offset %rbx, -16
11289; O3-NEXT:    movq foo(%rip), %rax
11290; O3-NEXT:  .Lpcsection425:
11291; O3-NEXT:    movq (%rdi), %rax
11292; O3-NEXT:  .Lpcsection426:
11293; O3-NEXT:    movq 8(%rdi), %rdx
11294; O3-NEXT:    .p2align 4
11295; O3-NEXT:  .LBB209_1: # %atomicrmw.start
11296; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11297; O3-NEXT:    movq %rax, %rbx
11298; O3-NEXT:  .Lpcsection427:
11299; O3-NEXT:    addq $42, %rbx
11300; O3-NEXT:    movq %rdx, %rcx
11301; O3-NEXT:  .Lpcsection428:
11302; O3-NEXT:    adcq $0, %rcx
11303; O3-NEXT:  .Lpcsection429:
11304; O3-NEXT:    lock cmpxchg16b (%rdi)
11305; O3-NEXT:  .Lpcsection430:
11306; O3-NEXT:    jne .LBB209_1
11307; O3-NEXT:  # %bb.2: # %atomicrmw.end
11308; O3-NEXT:    movq $1, foo(%rip)
11309; O3-NEXT:    popq %rbx
11310; O3-NEXT:    .cfi_def_cfa_offset 8
11311; O3-NEXT:    retq
11312entry:
11313  load volatile i64, ptr @foo, align 8
11314  %x = atomicrmw add ptr %a, i128 42 monotonic, align 16, !pcsections !0
11315  store volatile i64 1, ptr @foo, align 8
11316  ret void
11317}
11318
11319define void @atomic128_sub_monotonic(ptr %a) {
11320; O0-LABEL: atomic128_sub_monotonic:
11321; O0:       # %bb.0: # %entry
11322; O0-NEXT:    pushq %rbx
11323; O0-NEXT:    .cfi_def_cfa_offset 16
11324; O0-NEXT:    .cfi_offset %rbx, -16
11325; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11326; O0-NEXT:    movq foo(%rip), %rax
11327; O0-NEXT:  .Lpcsection471:
11328; O0-NEXT:    movq (%rdi), %rax
11329; O0-NEXT:  .Lpcsection472:
11330; O0-NEXT:    movq 8(%rdi), %rdx
11331; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11332; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11333; O0-NEXT:  .Lpcsection473:
11334; O0-NEXT:    jmp .LBB210_1
11335; O0-NEXT:  .LBB210_1: # %atomicrmw.start
11336; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11337; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11338; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11339; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11340; O0-NEXT:    movq %rax, %rbx
11341; O0-NEXT:  .Lpcsection474:
11342; O0-NEXT:    addq $-42, %rbx
11343; O0-NEXT:    movq %rdx, %rcx
11344; O0-NEXT:  .Lpcsection475:
11345; O0-NEXT:    adcq $-1, %rcx
11346; O0-NEXT:  .Lpcsection476:
11347; O0-NEXT:    lock cmpxchg16b (%rsi)
11348; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11349; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11350; O0-NEXT:  .Lpcsection477:
11351; O0-NEXT:    jne .LBB210_1
11352; O0-NEXT:    jmp .LBB210_2
11353; O0-NEXT:  .LBB210_2: # %atomicrmw.end
11354; O0-NEXT:    movq $1, foo
11355; O0-NEXT:    popq %rbx
11356; O0-NEXT:    .cfi_def_cfa_offset 8
11357; O0-NEXT:    retq
11358;
11359; O1-LABEL: atomic128_sub_monotonic:
11360; O1:       # %bb.0: # %entry
11361; O1-NEXT:    pushq %rbx
11362; O1-NEXT:    .cfi_def_cfa_offset 16
11363; O1-NEXT:    .cfi_offset %rbx, -16
11364; O1-NEXT:    movq foo(%rip), %rax
11365; O1-NEXT:  .Lpcsection431:
11366; O1-NEXT:    movq (%rdi), %rax
11367; O1-NEXT:  .Lpcsection432:
11368; O1-NEXT:    movq 8(%rdi), %rdx
11369; O1-NEXT:    .p2align 4
11370; O1-NEXT:  .LBB210_1: # %atomicrmw.start
11371; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11372; O1-NEXT:    movq %rax, %rbx
11373; O1-NEXT:  .Lpcsection433:
11374; O1-NEXT:    addq $-42, %rbx
11375; O1-NEXT:    movq %rdx, %rcx
11376; O1-NEXT:  .Lpcsection434:
11377; O1-NEXT:    adcq $-1, %rcx
11378; O1-NEXT:  .Lpcsection435:
11379; O1-NEXT:    lock cmpxchg16b (%rdi)
11380; O1-NEXT:  .Lpcsection436:
11381; O1-NEXT:    jne .LBB210_1
11382; O1-NEXT:  # %bb.2: # %atomicrmw.end
11383; O1-NEXT:    movq $1, foo(%rip)
11384; O1-NEXT:    popq %rbx
11385; O1-NEXT:    .cfi_def_cfa_offset 8
11386; O1-NEXT:    retq
11387;
11388; O2-LABEL: atomic128_sub_monotonic:
11389; O2:       # %bb.0: # %entry
11390; O2-NEXT:    pushq %rbx
11391; O2-NEXT:    .cfi_def_cfa_offset 16
11392; O2-NEXT:    .cfi_offset %rbx, -16
11393; O2-NEXT:    movq foo(%rip), %rax
11394; O2-NEXT:  .Lpcsection431:
11395; O2-NEXT:    movq (%rdi), %rax
11396; O2-NEXT:  .Lpcsection432:
11397; O2-NEXT:    movq 8(%rdi), %rdx
11398; O2-NEXT:    .p2align 4
11399; O2-NEXT:  .LBB210_1: # %atomicrmw.start
11400; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11401; O2-NEXT:    movq %rax, %rbx
11402; O2-NEXT:  .Lpcsection433:
11403; O2-NEXT:    addq $-42, %rbx
11404; O2-NEXT:    movq %rdx, %rcx
11405; O2-NEXT:  .Lpcsection434:
11406; O2-NEXT:    adcq $-1, %rcx
11407; O2-NEXT:  .Lpcsection435:
11408; O2-NEXT:    lock cmpxchg16b (%rdi)
11409; O2-NEXT:  .Lpcsection436:
11410; O2-NEXT:    jne .LBB210_1
11411; O2-NEXT:  # %bb.2: # %atomicrmw.end
11412; O2-NEXT:    movq $1, foo(%rip)
11413; O2-NEXT:    popq %rbx
11414; O2-NEXT:    .cfi_def_cfa_offset 8
11415; O2-NEXT:    retq
11416;
11417; O3-LABEL: atomic128_sub_monotonic:
11418; O3:       # %bb.0: # %entry
11419; O3-NEXT:    pushq %rbx
11420; O3-NEXT:    .cfi_def_cfa_offset 16
11421; O3-NEXT:    .cfi_offset %rbx, -16
11422; O3-NEXT:    movq foo(%rip), %rax
11423; O3-NEXT:  .Lpcsection431:
11424; O3-NEXT:    movq (%rdi), %rax
11425; O3-NEXT:  .Lpcsection432:
11426; O3-NEXT:    movq 8(%rdi), %rdx
11427; O3-NEXT:    .p2align 4
11428; O3-NEXT:  .LBB210_1: # %atomicrmw.start
11429; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11430; O3-NEXT:    movq %rax, %rbx
11431; O3-NEXT:  .Lpcsection433:
11432; O3-NEXT:    addq $-42, %rbx
11433; O3-NEXT:    movq %rdx, %rcx
11434; O3-NEXT:  .Lpcsection434:
11435; O3-NEXT:    adcq $-1, %rcx
11436; O3-NEXT:  .Lpcsection435:
11437; O3-NEXT:    lock cmpxchg16b (%rdi)
11438; O3-NEXT:  .Lpcsection436:
11439; O3-NEXT:    jne .LBB210_1
11440; O3-NEXT:  # %bb.2: # %atomicrmw.end
11441; O3-NEXT:    movq $1, foo(%rip)
11442; O3-NEXT:    popq %rbx
11443; O3-NEXT:    .cfi_def_cfa_offset 8
11444; O3-NEXT:    retq
11445entry:
11446  load volatile i64, ptr @foo, align 8
11447  %x = atomicrmw sub ptr %a, i128 42 monotonic, align 16, !pcsections !0
11448  store volatile i64 1, ptr @foo, align 8
11449  ret void
11450}
11451
11452define void @atomic128_and_monotonic(ptr %a) {
11453; O0-LABEL: atomic128_and_monotonic:
11454; O0:       # %bb.0: # %entry
11455; O0-NEXT:    pushq %rbx
11456; O0-NEXT:    .cfi_def_cfa_offset 16
11457; O0-NEXT:    .cfi_offset %rbx, -16
11458; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11459; O0-NEXT:    movq foo(%rip), %rax
11460; O0-NEXT:  .Lpcsection478:
11461; O0-NEXT:    movq (%rdi), %rax
11462; O0-NEXT:  .Lpcsection479:
11463; O0-NEXT:    movq 8(%rdi), %rdx
11464; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11465; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11466; O0-NEXT:  .Lpcsection480:
11467; O0-NEXT:    jmp .LBB211_1
11468; O0-NEXT:  .LBB211_1: # %atomicrmw.start
11469; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11470; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11471; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11472; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11473; O0-NEXT:    movl %eax, %ecx
11474; O0-NEXT:  .Lpcsection481:
11475; O0-NEXT:    andl $42, %ecx
11476; O0-NEXT:    movl %ecx, %ebx
11477; O0-NEXT:  .Lpcsection482:
11478; O0-NEXT:    xorl %ecx, %ecx
11479; O0-NEXT:  .Lpcsection483:
11480; O0-NEXT:    # kill: def $rcx killed $ecx
11481; O0-NEXT:  .Lpcsection484:
11482; O0-NEXT:    lock cmpxchg16b (%rsi)
11483; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11484; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11485; O0-NEXT:  .Lpcsection485:
11486; O0-NEXT:    jne .LBB211_1
11487; O0-NEXT:    jmp .LBB211_2
11488; O0-NEXT:  .LBB211_2: # %atomicrmw.end
11489; O0-NEXT:    movq $1, foo
11490; O0-NEXT:    popq %rbx
11491; O0-NEXT:    .cfi_def_cfa_offset 8
11492; O0-NEXT:    retq
11493;
11494; O1-LABEL: atomic128_and_monotonic:
11495; O1:       # %bb.0: # %entry
11496; O1-NEXT:    pushq %rbx
11497; O1-NEXT:    .cfi_def_cfa_offset 16
11498; O1-NEXT:    .cfi_offset %rbx, -16
11499; O1-NEXT:    movq foo(%rip), %rax
11500; O1-NEXT:  .Lpcsection437:
11501; O1-NEXT:    movq (%rdi), %rax
11502; O1-NEXT:  .Lpcsection438:
11503; O1-NEXT:    movq 8(%rdi), %rdx
11504; O1-NEXT:    .p2align 4
11505; O1-NEXT:  .LBB211_1: # %atomicrmw.start
11506; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11507; O1-NEXT:    movl %eax, %ebx
11508; O1-NEXT:  .Lpcsection439:
11509; O1-NEXT:    andl $42, %ebx
11510; O1-NEXT:  .Lpcsection440:
11511; O1-NEXT:    xorl %ecx, %ecx
11512; O1-NEXT:  .Lpcsection441:
11513; O1-NEXT:    lock cmpxchg16b (%rdi)
11514; O1-NEXT:  .Lpcsection442:
11515; O1-NEXT:    jne .LBB211_1
11516; O1-NEXT:  # %bb.2: # %atomicrmw.end
11517; O1-NEXT:    movq $1, foo(%rip)
11518; O1-NEXT:    popq %rbx
11519; O1-NEXT:    .cfi_def_cfa_offset 8
11520; O1-NEXT:    retq
11521;
11522; O2-LABEL: atomic128_and_monotonic:
11523; O2:       # %bb.0: # %entry
11524; O2-NEXT:    pushq %rbx
11525; O2-NEXT:    .cfi_def_cfa_offset 16
11526; O2-NEXT:    .cfi_offset %rbx, -16
11527; O2-NEXT:    movq foo(%rip), %rax
11528; O2-NEXT:  .Lpcsection437:
11529; O2-NEXT:    movq (%rdi), %rax
11530; O2-NEXT:  .Lpcsection438:
11531; O2-NEXT:    movq 8(%rdi), %rdx
11532; O2-NEXT:    .p2align 4
11533; O2-NEXT:  .LBB211_1: # %atomicrmw.start
11534; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11535; O2-NEXT:    movl %eax, %ebx
11536; O2-NEXT:  .Lpcsection439:
11537; O2-NEXT:    andl $42, %ebx
11538; O2-NEXT:  .Lpcsection440:
11539; O2-NEXT:    xorl %ecx, %ecx
11540; O2-NEXT:  .Lpcsection441:
11541; O2-NEXT:    lock cmpxchg16b (%rdi)
11542; O2-NEXT:  .Lpcsection442:
11543; O2-NEXT:    jne .LBB211_1
11544; O2-NEXT:  # %bb.2: # %atomicrmw.end
11545; O2-NEXT:    movq $1, foo(%rip)
11546; O2-NEXT:    popq %rbx
11547; O2-NEXT:    .cfi_def_cfa_offset 8
11548; O2-NEXT:    retq
11549;
11550; O3-LABEL: atomic128_and_monotonic:
11551; O3:       # %bb.0: # %entry
11552; O3-NEXT:    pushq %rbx
11553; O3-NEXT:    .cfi_def_cfa_offset 16
11554; O3-NEXT:    .cfi_offset %rbx, -16
11555; O3-NEXT:    movq foo(%rip), %rax
11556; O3-NEXT:  .Lpcsection437:
11557; O3-NEXT:    movq (%rdi), %rax
11558; O3-NEXT:  .Lpcsection438:
11559; O3-NEXT:    movq 8(%rdi), %rdx
11560; O3-NEXT:    .p2align 4
11561; O3-NEXT:  .LBB211_1: # %atomicrmw.start
11562; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11563; O3-NEXT:    movl %eax, %ebx
11564; O3-NEXT:  .Lpcsection439:
11565; O3-NEXT:    andl $42, %ebx
11566; O3-NEXT:  .Lpcsection440:
11567; O3-NEXT:    xorl %ecx, %ecx
11568; O3-NEXT:  .Lpcsection441:
11569; O3-NEXT:    lock cmpxchg16b (%rdi)
11570; O3-NEXT:  .Lpcsection442:
11571; O3-NEXT:    jne .LBB211_1
11572; O3-NEXT:  # %bb.2: # %atomicrmw.end
11573; O3-NEXT:    movq $1, foo(%rip)
11574; O3-NEXT:    popq %rbx
11575; O3-NEXT:    .cfi_def_cfa_offset 8
11576; O3-NEXT:    retq
11577entry:
11578  load volatile i64, ptr @foo, align 8
11579  %x = atomicrmw and ptr %a, i128 42 monotonic, align 16, !pcsections !0
11580  store volatile i64 1, ptr @foo, align 8
11581  ret void
11582}
11583
11584define void @atomic128_or_monotonic(ptr %a) {
11585; O0-LABEL: atomic128_or_monotonic:
11586; O0:       # %bb.0: # %entry
11587; O0-NEXT:    pushq %rbx
11588; O0-NEXT:    .cfi_def_cfa_offset 16
11589; O0-NEXT:    .cfi_offset %rbx, -16
11590; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11591; O0-NEXT:    movq foo(%rip), %rax
11592; O0-NEXT:  .Lpcsection486:
11593; O0-NEXT:    movq (%rdi), %rax
11594; O0-NEXT:  .Lpcsection487:
11595; O0-NEXT:    movq 8(%rdi), %rdx
11596; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11597; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11598; O0-NEXT:  .Lpcsection488:
11599; O0-NEXT:    jmp .LBB212_1
11600; O0-NEXT:  .LBB212_1: # %atomicrmw.start
11601; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11602; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
11603; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11604; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11605; O0-NEXT:    movq %rax, %rbx
11606; O0-NEXT:  .Lpcsection489:
11607; O0-NEXT:    orq $42, %rbx
11608; O0-NEXT:    movq %rcx, %rdx
11609; O0-NEXT:  .Lpcsection490:
11610; O0-NEXT:    lock cmpxchg16b (%rsi)
11611; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11612; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11613; O0-NEXT:  .Lpcsection491:
11614; O0-NEXT:    jne .LBB212_1
11615; O0-NEXT:    jmp .LBB212_2
11616; O0-NEXT:  .LBB212_2: # %atomicrmw.end
11617; O0-NEXT:    movq $1, foo
11618; O0-NEXT:    popq %rbx
11619; O0-NEXT:    .cfi_def_cfa_offset 8
11620; O0-NEXT:    retq
11621;
11622; O1-LABEL: atomic128_or_monotonic:
11623; O1:       # %bb.0: # %entry
11624; O1-NEXT:    pushq %rbx
11625; O1-NEXT:    .cfi_def_cfa_offset 16
11626; O1-NEXT:    .cfi_offset %rbx, -16
11627; O1-NEXT:    movq foo(%rip), %rax
11628; O1-NEXT:  .Lpcsection443:
11629; O1-NEXT:    movq (%rdi), %rax
11630; O1-NEXT:  .Lpcsection444:
11631; O1-NEXT:    movq 8(%rdi), %rdx
11632; O1-NEXT:    .p2align 4
11633; O1-NEXT:  .LBB212_1: # %atomicrmw.start
11634; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11635; O1-NEXT:    movq %rax, %rbx
11636; O1-NEXT:  .Lpcsection445:
11637; O1-NEXT:    orq $42, %rbx
11638; O1-NEXT:    movq %rdx, %rcx
11639; O1-NEXT:  .Lpcsection446:
11640; O1-NEXT:    lock cmpxchg16b (%rdi)
11641; O1-NEXT:  .Lpcsection447:
11642; O1-NEXT:    jne .LBB212_1
11643; O1-NEXT:  # %bb.2: # %atomicrmw.end
11644; O1-NEXT:    movq $1, foo(%rip)
11645; O1-NEXT:    popq %rbx
11646; O1-NEXT:    .cfi_def_cfa_offset 8
11647; O1-NEXT:    retq
11648;
11649; O2-LABEL: atomic128_or_monotonic:
11650; O2:       # %bb.0: # %entry
11651; O2-NEXT:    pushq %rbx
11652; O2-NEXT:    .cfi_def_cfa_offset 16
11653; O2-NEXT:    .cfi_offset %rbx, -16
11654; O2-NEXT:    movq foo(%rip), %rax
11655; O2-NEXT:  .Lpcsection443:
11656; O2-NEXT:    movq (%rdi), %rax
11657; O2-NEXT:  .Lpcsection444:
11658; O2-NEXT:    movq 8(%rdi), %rdx
11659; O2-NEXT:    .p2align 4
11660; O2-NEXT:  .LBB212_1: # %atomicrmw.start
11661; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11662; O2-NEXT:    movq %rax, %rbx
11663; O2-NEXT:  .Lpcsection445:
11664; O2-NEXT:    orq $42, %rbx
11665; O2-NEXT:    movq %rdx, %rcx
11666; O2-NEXT:  .Lpcsection446:
11667; O2-NEXT:    lock cmpxchg16b (%rdi)
11668; O2-NEXT:  .Lpcsection447:
11669; O2-NEXT:    jne .LBB212_1
11670; O2-NEXT:  # %bb.2: # %atomicrmw.end
11671; O2-NEXT:    movq $1, foo(%rip)
11672; O2-NEXT:    popq %rbx
11673; O2-NEXT:    .cfi_def_cfa_offset 8
11674; O2-NEXT:    retq
11675;
11676; O3-LABEL: atomic128_or_monotonic:
11677; O3:       # %bb.0: # %entry
11678; O3-NEXT:    pushq %rbx
11679; O3-NEXT:    .cfi_def_cfa_offset 16
11680; O3-NEXT:    .cfi_offset %rbx, -16
11681; O3-NEXT:    movq foo(%rip), %rax
11682; O3-NEXT:  .Lpcsection443:
11683; O3-NEXT:    movq (%rdi), %rax
11684; O3-NEXT:  .Lpcsection444:
11685; O3-NEXT:    movq 8(%rdi), %rdx
11686; O3-NEXT:    .p2align 4
11687; O3-NEXT:  .LBB212_1: # %atomicrmw.start
11688; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11689; O3-NEXT:    movq %rax, %rbx
11690; O3-NEXT:  .Lpcsection445:
11691; O3-NEXT:    orq $42, %rbx
11692; O3-NEXT:    movq %rdx, %rcx
11693; O3-NEXT:  .Lpcsection446:
11694; O3-NEXT:    lock cmpxchg16b (%rdi)
11695; O3-NEXT:  .Lpcsection447:
11696; O3-NEXT:    jne .LBB212_1
11697; O3-NEXT:  # %bb.2: # %atomicrmw.end
11698; O3-NEXT:    movq $1, foo(%rip)
11699; O3-NEXT:    popq %rbx
11700; O3-NEXT:    .cfi_def_cfa_offset 8
11701; O3-NEXT:    retq
11702entry:
11703  load volatile i64, ptr @foo, align 8
11704  %x = atomicrmw or ptr %a, i128 42 monotonic, align 16, !pcsections !0
11705  store volatile i64 1, ptr @foo, align 8
11706  ret void
11707}
11708
11709define void @atomic128_xor_monotonic(ptr %a) {
11710; O0-LABEL: atomic128_xor_monotonic:
11711; O0:       # %bb.0: # %entry
11712; O0-NEXT:    pushq %rbx
11713; O0-NEXT:    .cfi_def_cfa_offset 16
11714; O0-NEXT:    .cfi_offset %rbx, -16
11715; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11716; O0-NEXT:    movq foo(%rip), %rax
11717; O0-NEXT:  .Lpcsection492:
11718; O0-NEXT:    movq (%rdi), %rax
11719; O0-NEXT:  .Lpcsection493:
11720; O0-NEXT:    movq 8(%rdi), %rdx
11721; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11722; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11723; O0-NEXT:  .Lpcsection494:
11724; O0-NEXT:    jmp .LBB213_1
11725; O0-NEXT:  .LBB213_1: # %atomicrmw.start
11726; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11727; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
11728; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11729; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11730; O0-NEXT:    movq %rax, %rbx
11731; O0-NEXT:  .Lpcsection495:
11732; O0-NEXT:    xorq $42, %rbx
11733; O0-NEXT:    movq %rcx, %rdx
11734; O0-NEXT:  .Lpcsection496:
11735; O0-NEXT:    lock cmpxchg16b (%rsi)
11736; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11737; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11738; O0-NEXT:  .Lpcsection497:
11739; O0-NEXT:    jne .LBB213_1
11740; O0-NEXT:    jmp .LBB213_2
11741; O0-NEXT:  .LBB213_2: # %atomicrmw.end
11742; O0-NEXT:    movq $1, foo
11743; O0-NEXT:    popq %rbx
11744; O0-NEXT:    .cfi_def_cfa_offset 8
11745; O0-NEXT:    retq
11746;
11747; O1-LABEL: atomic128_xor_monotonic:
11748; O1:       # %bb.0: # %entry
11749; O1-NEXT:    pushq %rbx
11750; O1-NEXT:    .cfi_def_cfa_offset 16
11751; O1-NEXT:    .cfi_offset %rbx, -16
11752; O1-NEXT:    movq foo(%rip), %rax
11753; O1-NEXT:  .Lpcsection448:
11754; O1-NEXT:    movq (%rdi), %rax
11755; O1-NEXT:  .Lpcsection449:
11756; O1-NEXT:    movq 8(%rdi), %rdx
11757; O1-NEXT:    .p2align 4
11758; O1-NEXT:  .LBB213_1: # %atomicrmw.start
11759; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11760; O1-NEXT:    movq %rax, %rbx
11761; O1-NEXT:  .Lpcsection450:
11762; O1-NEXT:    xorq $42, %rbx
11763; O1-NEXT:    movq %rdx, %rcx
11764; O1-NEXT:  .Lpcsection451:
11765; O1-NEXT:    lock cmpxchg16b (%rdi)
11766; O1-NEXT:  .Lpcsection452:
11767; O1-NEXT:    jne .LBB213_1
11768; O1-NEXT:  # %bb.2: # %atomicrmw.end
11769; O1-NEXT:    movq $1, foo(%rip)
11770; O1-NEXT:    popq %rbx
11771; O1-NEXT:    .cfi_def_cfa_offset 8
11772; O1-NEXT:    retq
11773;
11774; O2-LABEL: atomic128_xor_monotonic:
11775; O2:       # %bb.0: # %entry
11776; O2-NEXT:    pushq %rbx
11777; O2-NEXT:    .cfi_def_cfa_offset 16
11778; O2-NEXT:    .cfi_offset %rbx, -16
11779; O2-NEXT:    movq foo(%rip), %rax
11780; O2-NEXT:  .Lpcsection448:
11781; O2-NEXT:    movq (%rdi), %rax
11782; O2-NEXT:  .Lpcsection449:
11783; O2-NEXT:    movq 8(%rdi), %rdx
11784; O2-NEXT:    .p2align 4
11785; O2-NEXT:  .LBB213_1: # %atomicrmw.start
11786; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11787; O2-NEXT:    movq %rax, %rbx
11788; O2-NEXT:  .Lpcsection450:
11789; O2-NEXT:    xorq $42, %rbx
11790; O2-NEXT:    movq %rdx, %rcx
11791; O2-NEXT:  .Lpcsection451:
11792; O2-NEXT:    lock cmpxchg16b (%rdi)
11793; O2-NEXT:  .Lpcsection452:
11794; O2-NEXT:    jne .LBB213_1
11795; O2-NEXT:  # %bb.2: # %atomicrmw.end
11796; O2-NEXT:    movq $1, foo(%rip)
11797; O2-NEXT:    popq %rbx
11798; O2-NEXT:    .cfi_def_cfa_offset 8
11799; O2-NEXT:    retq
11800;
11801; O3-LABEL: atomic128_xor_monotonic:
11802; O3:       # %bb.0: # %entry
11803; O3-NEXT:    pushq %rbx
11804; O3-NEXT:    .cfi_def_cfa_offset 16
11805; O3-NEXT:    .cfi_offset %rbx, -16
11806; O3-NEXT:    movq foo(%rip), %rax
11807; O3-NEXT:  .Lpcsection448:
11808; O3-NEXT:    movq (%rdi), %rax
11809; O3-NEXT:  .Lpcsection449:
11810; O3-NEXT:    movq 8(%rdi), %rdx
11811; O3-NEXT:    .p2align 4
11812; O3-NEXT:  .LBB213_1: # %atomicrmw.start
11813; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11814; O3-NEXT:    movq %rax, %rbx
11815; O3-NEXT:  .Lpcsection450:
11816; O3-NEXT:    xorq $42, %rbx
11817; O3-NEXT:    movq %rdx, %rcx
11818; O3-NEXT:  .Lpcsection451:
11819; O3-NEXT:    lock cmpxchg16b (%rdi)
11820; O3-NEXT:  .Lpcsection452:
11821; O3-NEXT:    jne .LBB213_1
11822; O3-NEXT:  # %bb.2: # %atomicrmw.end
11823; O3-NEXT:    movq $1, foo(%rip)
11824; O3-NEXT:    popq %rbx
11825; O3-NEXT:    .cfi_def_cfa_offset 8
11826; O3-NEXT:    retq
11827entry:
11828  load volatile i64, ptr @foo, align 8
11829  %x = atomicrmw xor ptr %a, i128 42 monotonic, align 16, !pcsections !0
11830  store volatile i64 1, ptr @foo, align 8
11831  ret void
11832}
11833
11834define void @atomic128_nand_monotonic(ptr %a) {
11835; O0-LABEL: atomic128_nand_monotonic:
11836; O0:       # %bb.0: # %entry
11837; O0-NEXT:    pushq %rbx
11838; O0-NEXT:    .cfi_def_cfa_offset 16
11839; O0-NEXT:    .cfi_offset %rbx, -16
11840; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11841; O0-NEXT:    movq foo(%rip), %rax
11842; O0-NEXT:  .Lpcsection498:
11843; O0-NEXT:    movq (%rdi), %rax
11844; O0-NEXT:  .Lpcsection499:
11845; O0-NEXT:    movq 8(%rdi), %rdx
11846; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11847; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11848; O0-NEXT:  .Lpcsection500:
11849; O0-NEXT:    jmp .LBB214_1
11850; O0-NEXT:  .LBB214_1: # %atomicrmw.start
11851; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11852; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11853; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11854; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11855; O0-NEXT:    movl %eax, %ecx
11856; O0-NEXT:  .Lpcsection501:
11857; O0-NEXT:    notl %ecx
11858; O0-NEXT:  .Lpcsection502:
11859; O0-NEXT:    # implicit-def: $rbx
11860; O0-NEXT:    movl %ecx, %ebx
11861; O0-NEXT:  .Lpcsection503:
11862; O0-NEXT:    orq $-43, %rbx
11863; O0-NEXT:  .Lpcsection504:
11864; O0-NEXT:    movq $-1, %rcx
11865; O0-NEXT:  .Lpcsection505:
11866; O0-NEXT:    lock cmpxchg16b (%rsi)
11867; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11868; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11869; O0-NEXT:  .Lpcsection506:
11870; O0-NEXT:    jne .LBB214_1
11871; O0-NEXT:    jmp .LBB214_2
11872; O0-NEXT:  .LBB214_2: # %atomicrmw.end
11873; O0-NEXT:    movq $1, foo
11874; O0-NEXT:    popq %rbx
11875; O0-NEXT:    .cfi_def_cfa_offset 8
11876; O0-NEXT:    retq
11877;
11878; O1-LABEL: atomic128_nand_monotonic:
11879; O1:       # %bb.0: # %entry
11880; O1-NEXT:    pushq %rbx
11881; O1-NEXT:    .cfi_def_cfa_offset 16
11882; O1-NEXT:    .cfi_offset %rbx, -16
11883; O1-NEXT:    movq foo(%rip), %rax
11884; O1-NEXT:  .Lpcsection453:
11885; O1-NEXT:    movq (%rdi), %rax
11886; O1-NEXT:  .Lpcsection454:
11887; O1-NEXT:    movq 8(%rdi), %rdx
11888; O1-NEXT:  .Lpcsection455:
11889; O1-NEXT:    movq $-1, %rcx
11890; O1-NEXT:    .p2align 4
11891; O1-NEXT:  .LBB214_1: # %atomicrmw.start
11892; O1-NEXT:    # =>This Inner Loop Header: Depth=1
11893; O1-NEXT:    movl %eax, %ebx
11894; O1-NEXT:  .Lpcsection456:
11895; O1-NEXT:    notl %ebx
11896; O1-NEXT:  .Lpcsection457:
11897; O1-NEXT:    orq $-43, %rbx
11898; O1-NEXT:  .Lpcsection458:
11899; O1-NEXT:    lock cmpxchg16b (%rdi)
11900; O1-NEXT:  .Lpcsection459:
11901; O1-NEXT:    jne .LBB214_1
11902; O1-NEXT:  # %bb.2: # %atomicrmw.end
11903; O1-NEXT:    movq $1, foo(%rip)
11904; O1-NEXT:    popq %rbx
11905; O1-NEXT:    .cfi_def_cfa_offset 8
11906; O1-NEXT:    retq
11907;
11908; O2-LABEL: atomic128_nand_monotonic:
11909; O2:       # %bb.0: # %entry
11910; O2-NEXT:    pushq %rbx
11911; O2-NEXT:    .cfi_def_cfa_offset 16
11912; O2-NEXT:    .cfi_offset %rbx, -16
11913; O2-NEXT:    movq foo(%rip), %rax
11914; O2-NEXT:  .Lpcsection453:
11915; O2-NEXT:    movq (%rdi), %rax
11916; O2-NEXT:  .Lpcsection454:
11917; O2-NEXT:    movq 8(%rdi), %rdx
11918; O2-NEXT:  .Lpcsection455:
11919; O2-NEXT:    movq $-1, %rcx
11920; O2-NEXT:    .p2align 4
11921; O2-NEXT:  .LBB214_1: # %atomicrmw.start
11922; O2-NEXT:    # =>This Inner Loop Header: Depth=1
11923; O2-NEXT:    movl %eax, %ebx
11924; O2-NEXT:  .Lpcsection456:
11925; O2-NEXT:    notl %ebx
11926; O2-NEXT:  .Lpcsection457:
11927; O2-NEXT:    orq $-43, %rbx
11928; O2-NEXT:  .Lpcsection458:
11929; O2-NEXT:    lock cmpxchg16b (%rdi)
11930; O2-NEXT:  .Lpcsection459:
11931; O2-NEXT:    jne .LBB214_1
11932; O2-NEXT:  # %bb.2: # %atomicrmw.end
11933; O2-NEXT:    movq $1, foo(%rip)
11934; O2-NEXT:    popq %rbx
11935; O2-NEXT:    .cfi_def_cfa_offset 8
11936; O2-NEXT:    retq
11937;
11938; O3-LABEL: atomic128_nand_monotonic:
11939; O3:       # %bb.0: # %entry
11940; O3-NEXT:    pushq %rbx
11941; O3-NEXT:    .cfi_def_cfa_offset 16
11942; O3-NEXT:    .cfi_offset %rbx, -16
11943; O3-NEXT:    movq foo(%rip), %rax
11944; O3-NEXT:  .Lpcsection453:
11945; O3-NEXT:    movq (%rdi), %rax
11946; O3-NEXT:  .Lpcsection454:
11947; O3-NEXT:    movq 8(%rdi), %rdx
11948; O3-NEXT:  .Lpcsection455:
11949; O3-NEXT:    movq $-1, %rcx
11950; O3-NEXT:    .p2align 4
11951; O3-NEXT:  .LBB214_1: # %atomicrmw.start
11952; O3-NEXT:    # =>This Inner Loop Header: Depth=1
11953; O3-NEXT:    movl %eax, %ebx
11954; O3-NEXT:  .Lpcsection456:
11955; O3-NEXT:    notl %ebx
11956; O3-NEXT:  .Lpcsection457:
11957; O3-NEXT:    orq $-43, %rbx
11958; O3-NEXT:  .Lpcsection458:
11959; O3-NEXT:    lock cmpxchg16b (%rdi)
11960; O3-NEXT:  .Lpcsection459:
11961; O3-NEXT:    jne .LBB214_1
11962; O3-NEXT:  # %bb.2: # %atomicrmw.end
11963; O3-NEXT:    movq $1, foo(%rip)
11964; O3-NEXT:    popq %rbx
11965; O3-NEXT:    .cfi_def_cfa_offset 8
11966; O3-NEXT:    retq
11967entry:
11968  load volatile i64, ptr @foo, align 8
11969  %x = atomicrmw nand ptr %a, i128 42 monotonic, align 16, !pcsections !0
11970  store volatile i64 1, ptr @foo, align 8
11971  ret void
11972}
11973
11974define void @atomic128_xchg_acquire(ptr %a) {
11975; O0-LABEL: atomic128_xchg_acquire:
11976; O0:       # %bb.0: # %entry
11977; O0-NEXT:    pushq %rbx
11978; O0-NEXT:    .cfi_def_cfa_offset 16
11979; O0-NEXT:    .cfi_offset %rbx, -16
11980; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11981; O0-NEXT:    movq foo(%rip), %rax
11982; O0-NEXT:  .Lpcsection507:
11983; O0-NEXT:    movq (%rdi), %rax
11984; O0-NEXT:  .Lpcsection508:
11985; O0-NEXT:    movq 8(%rdi), %rdx
11986; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11987; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
11988; O0-NEXT:  .Lpcsection509:
11989; O0-NEXT:    jmp .LBB215_1
11990; O0-NEXT:  .LBB215_1: # %atomicrmw.start
11991; O0-NEXT:    # =>This Inner Loop Header: Depth=1
11992; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
11993; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
11994; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
11995; O0-NEXT:  .Lpcsection510:
11996; O0-NEXT:    xorl %ecx, %ecx
11997; O0-NEXT:  .Lpcsection511:
11998; O0-NEXT:    # kill: def $rcx killed $ecx
11999; O0-NEXT:  .Lpcsection512:
12000; O0-NEXT:    movl $42, %ebx
12001; O0-NEXT:  .Lpcsection513:
12002; O0-NEXT:    lock cmpxchg16b (%rsi)
12003; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12004; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12005; O0-NEXT:  .Lpcsection514:
12006; O0-NEXT:    jne .LBB215_1
12007; O0-NEXT:    jmp .LBB215_2
12008; O0-NEXT:  .LBB215_2: # %atomicrmw.end
12009; O0-NEXT:    movq $1, foo
12010; O0-NEXT:    popq %rbx
12011; O0-NEXT:    .cfi_def_cfa_offset 8
12012; O0-NEXT:    retq
12013;
12014; O1-LABEL: atomic128_xchg_acquire:
12015; O1:       # %bb.0: # %entry
12016; O1-NEXT:    pushq %rbx
12017; O1-NEXT:    .cfi_def_cfa_offset 16
12018; O1-NEXT:    .cfi_offset %rbx, -16
12019; O1-NEXT:    movq foo(%rip), %rax
12020; O1-NEXT:  .Lpcsection460:
12021; O1-NEXT:    movq (%rdi), %rax
12022; O1-NEXT:  .Lpcsection461:
12023; O1-NEXT:    movq 8(%rdi), %rdx
12024; O1-NEXT:  .Lpcsection462:
12025; O1-NEXT:    movl $42, %ebx
12026; O1-NEXT:    .p2align 4
12027; O1-NEXT:  .LBB215_1: # %atomicrmw.start
12028; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12029; O1-NEXT:  .Lpcsection463:
12030; O1-NEXT:    xorl %ecx, %ecx
12031; O1-NEXT:  .Lpcsection464:
12032; O1-NEXT:    lock cmpxchg16b (%rdi)
12033; O1-NEXT:  .Lpcsection465:
12034; O1-NEXT:    jne .LBB215_1
12035; O1-NEXT:  # %bb.2: # %atomicrmw.end
12036; O1-NEXT:    movq $1, foo(%rip)
12037; O1-NEXT:    popq %rbx
12038; O1-NEXT:    .cfi_def_cfa_offset 8
12039; O1-NEXT:    retq
12040;
12041; O2-LABEL: atomic128_xchg_acquire:
12042; O2:       # %bb.0: # %entry
12043; O2-NEXT:    pushq %rbx
12044; O2-NEXT:    .cfi_def_cfa_offset 16
12045; O2-NEXT:    .cfi_offset %rbx, -16
12046; O2-NEXT:    movq foo(%rip), %rax
12047; O2-NEXT:  .Lpcsection460:
12048; O2-NEXT:    movq (%rdi), %rax
12049; O2-NEXT:  .Lpcsection461:
12050; O2-NEXT:    movq 8(%rdi), %rdx
12051; O2-NEXT:  .Lpcsection462:
12052; O2-NEXT:    movl $42, %ebx
12053; O2-NEXT:    .p2align 4
12054; O2-NEXT:  .LBB215_1: # %atomicrmw.start
12055; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12056; O2-NEXT:  .Lpcsection463:
12057; O2-NEXT:    xorl %ecx, %ecx
12058; O2-NEXT:  .Lpcsection464:
12059; O2-NEXT:    lock cmpxchg16b (%rdi)
12060; O2-NEXT:  .Lpcsection465:
12061; O2-NEXT:    jne .LBB215_1
12062; O2-NEXT:  # %bb.2: # %atomicrmw.end
12063; O2-NEXT:    movq $1, foo(%rip)
12064; O2-NEXT:    popq %rbx
12065; O2-NEXT:    .cfi_def_cfa_offset 8
12066; O2-NEXT:    retq
12067;
12068; O3-LABEL: atomic128_xchg_acquire:
12069; O3:       # %bb.0: # %entry
12070; O3-NEXT:    pushq %rbx
12071; O3-NEXT:    .cfi_def_cfa_offset 16
12072; O3-NEXT:    .cfi_offset %rbx, -16
12073; O3-NEXT:    movq foo(%rip), %rax
12074; O3-NEXT:  .Lpcsection460:
12075; O3-NEXT:    movq (%rdi), %rax
12076; O3-NEXT:  .Lpcsection461:
12077; O3-NEXT:    movq 8(%rdi), %rdx
12078; O3-NEXT:  .Lpcsection462:
12079; O3-NEXT:    movl $42, %ebx
12080; O3-NEXT:    .p2align 4
12081; O3-NEXT:  .LBB215_1: # %atomicrmw.start
12082; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12083; O3-NEXT:  .Lpcsection463:
12084; O3-NEXT:    xorl %ecx, %ecx
12085; O3-NEXT:  .Lpcsection464:
12086; O3-NEXT:    lock cmpxchg16b (%rdi)
12087; O3-NEXT:  .Lpcsection465:
12088; O3-NEXT:    jne .LBB215_1
12089; O3-NEXT:  # %bb.2: # %atomicrmw.end
12090; O3-NEXT:    movq $1, foo(%rip)
12091; O3-NEXT:    popq %rbx
12092; O3-NEXT:    .cfi_def_cfa_offset 8
12093; O3-NEXT:    retq
12094entry:
12095  load volatile i64, ptr @foo, align 8
12096  %x = atomicrmw xchg ptr %a, i128 42 acquire, align 16, !pcsections !0
12097  store volatile i64 1, ptr @foo, align 8
12098  ret void
12099}
12100
12101define void @atomic128_add_acquire(ptr %a) {
12102; O0-LABEL: atomic128_add_acquire:
12103; O0:       # %bb.0: # %entry
12104; O0-NEXT:    pushq %rbx
12105; O0-NEXT:    .cfi_def_cfa_offset 16
12106; O0-NEXT:    .cfi_offset %rbx, -16
12107; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12108; O0-NEXT:    movq foo(%rip), %rax
12109; O0-NEXT:  .Lpcsection515:
12110; O0-NEXT:    movq (%rdi), %rax
12111; O0-NEXT:  .Lpcsection516:
12112; O0-NEXT:    movq 8(%rdi), %rdx
12113; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12114; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12115; O0-NEXT:  .Lpcsection517:
12116; O0-NEXT:    jmp .LBB216_1
12117; O0-NEXT:  .LBB216_1: # %atomicrmw.start
12118; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12119; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
12120; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12121; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12122; O0-NEXT:    movq %rax, %rbx
12123; O0-NEXT:  .Lpcsection518:
12124; O0-NEXT:    addq $42, %rbx
12125; O0-NEXT:    movq %rdx, %rcx
12126; O0-NEXT:  .Lpcsection519:
12127; O0-NEXT:    adcq $0, %rcx
12128; O0-NEXT:  .Lpcsection520:
12129; O0-NEXT:    lock cmpxchg16b (%rsi)
12130; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12131; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12132; O0-NEXT:  .Lpcsection521:
12133; O0-NEXT:    jne .LBB216_1
12134; O0-NEXT:    jmp .LBB216_2
12135; O0-NEXT:  .LBB216_2: # %atomicrmw.end
12136; O0-NEXT:    movq $1, foo
12137; O0-NEXT:    popq %rbx
12138; O0-NEXT:    .cfi_def_cfa_offset 8
12139; O0-NEXT:    retq
12140;
12141; O1-LABEL: atomic128_add_acquire:
12142; O1:       # %bb.0: # %entry
12143; O1-NEXT:    pushq %rbx
12144; O1-NEXT:    .cfi_def_cfa_offset 16
12145; O1-NEXT:    .cfi_offset %rbx, -16
12146; O1-NEXT:    movq foo(%rip), %rax
12147; O1-NEXT:  .Lpcsection466:
12148; O1-NEXT:    movq (%rdi), %rax
12149; O1-NEXT:  .Lpcsection467:
12150; O1-NEXT:    movq 8(%rdi), %rdx
12151; O1-NEXT:    .p2align 4
12152; O1-NEXT:  .LBB216_1: # %atomicrmw.start
12153; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12154; O1-NEXT:    movq %rax, %rbx
12155; O1-NEXT:  .Lpcsection468:
12156; O1-NEXT:    addq $42, %rbx
12157; O1-NEXT:    movq %rdx, %rcx
12158; O1-NEXT:  .Lpcsection469:
12159; O1-NEXT:    adcq $0, %rcx
12160; O1-NEXT:  .Lpcsection470:
12161; O1-NEXT:    lock cmpxchg16b (%rdi)
12162; O1-NEXT:  .Lpcsection471:
12163; O1-NEXT:    jne .LBB216_1
12164; O1-NEXT:  # %bb.2: # %atomicrmw.end
12165; O1-NEXT:    movq $1, foo(%rip)
12166; O1-NEXT:    popq %rbx
12167; O1-NEXT:    .cfi_def_cfa_offset 8
12168; O1-NEXT:    retq
12169;
12170; O2-LABEL: atomic128_add_acquire:
12171; O2:       # %bb.0: # %entry
12172; O2-NEXT:    pushq %rbx
12173; O2-NEXT:    .cfi_def_cfa_offset 16
12174; O2-NEXT:    .cfi_offset %rbx, -16
12175; O2-NEXT:    movq foo(%rip), %rax
12176; O2-NEXT:  .Lpcsection466:
12177; O2-NEXT:    movq (%rdi), %rax
12178; O2-NEXT:  .Lpcsection467:
12179; O2-NEXT:    movq 8(%rdi), %rdx
12180; O2-NEXT:    .p2align 4
12181; O2-NEXT:  .LBB216_1: # %atomicrmw.start
12182; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12183; O2-NEXT:    movq %rax, %rbx
12184; O2-NEXT:  .Lpcsection468:
12185; O2-NEXT:    addq $42, %rbx
12186; O2-NEXT:    movq %rdx, %rcx
12187; O2-NEXT:  .Lpcsection469:
12188; O2-NEXT:    adcq $0, %rcx
12189; O2-NEXT:  .Lpcsection470:
12190; O2-NEXT:    lock cmpxchg16b (%rdi)
12191; O2-NEXT:  .Lpcsection471:
12192; O2-NEXT:    jne .LBB216_1
12193; O2-NEXT:  # %bb.2: # %atomicrmw.end
12194; O2-NEXT:    movq $1, foo(%rip)
12195; O2-NEXT:    popq %rbx
12196; O2-NEXT:    .cfi_def_cfa_offset 8
12197; O2-NEXT:    retq
12198;
12199; O3-LABEL: atomic128_add_acquire:
12200; O3:       # %bb.0: # %entry
12201; O3-NEXT:    pushq %rbx
12202; O3-NEXT:    .cfi_def_cfa_offset 16
12203; O3-NEXT:    .cfi_offset %rbx, -16
12204; O3-NEXT:    movq foo(%rip), %rax
12205; O3-NEXT:  .Lpcsection466:
12206; O3-NEXT:    movq (%rdi), %rax
12207; O3-NEXT:  .Lpcsection467:
12208; O3-NEXT:    movq 8(%rdi), %rdx
12209; O3-NEXT:    .p2align 4
12210; O3-NEXT:  .LBB216_1: # %atomicrmw.start
12211; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12212; O3-NEXT:    movq %rax, %rbx
12213; O3-NEXT:  .Lpcsection468:
12214; O3-NEXT:    addq $42, %rbx
12215; O3-NEXT:    movq %rdx, %rcx
12216; O3-NEXT:  .Lpcsection469:
12217; O3-NEXT:    adcq $0, %rcx
12218; O3-NEXT:  .Lpcsection470:
12219; O3-NEXT:    lock cmpxchg16b (%rdi)
12220; O3-NEXT:  .Lpcsection471:
12221; O3-NEXT:    jne .LBB216_1
12222; O3-NEXT:  # %bb.2: # %atomicrmw.end
12223; O3-NEXT:    movq $1, foo(%rip)
12224; O3-NEXT:    popq %rbx
12225; O3-NEXT:    .cfi_def_cfa_offset 8
12226; O3-NEXT:    retq
12227entry:
12228  load volatile i64, ptr @foo, align 8
12229  %x = atomicrmw add ptr %a, i128 42 acquire, align 16, !pcsections !0
12230  store volatile i64 1, ptr @foo, align 8
12231  ret void
12232}
12233
12234define void @atomic128_sub_acquire(ptr %a) {
12235; O0-LABEL: atomic128_sub_acquire:
12236; O0:       # %bb.0: # %entry
12237; O0-NEXT:    pushq %rbx
12238; O0-NEXT:    .cfi_def_cfa_offset 16
12239; O0-NEXT:    .cfi_offset %rbx, -16
12240; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12241; O0-NEXT:    movq foo(%rip), %rax
12242; O0-NEXT:  .Lpcsection522:
12243; O0-NEXT:    movq (%rdi), %rax
12244; O0-NEXT:  .Lpcsection523:
12245; O0-NEXT:    movq 8(%rdi), %rdx
12246; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12247; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12248; O0-NEXT:  .Lpcsection524:
12249; O0-NEXT:    jmp .LBB217_1
12250; O0-NEXT:  .LBB217_1: # %atomicrmw.start
12251; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12252; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
12253; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12254; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12255; O0-NEXT:    movq %rax, %rbx
12256; O0-NEXT:  .Lpcsection525:
12257; O0-NEXT:    addq $-42, %rbx
12258; O0-NEXT:    movq %rdx, %rcx
12259; O0-NEXT:  .Lpcsection526:
12260; O0-NEXT:    adcq $-1, %rcx
12261; O0-NEXT:  .Lpcsection527:
12262; O0-NEXT:    lock cmpxchg16b (%rsi)
12263; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12264; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12265; O0-NEXT:  .Lpcsection528:
12266; O0-NEXT:    jne .LBB217_1
12267; O0-NEXT:    jmp .LBB217_2
12268; O0-NEXT:  .LBB217_2: # %atomicrmw.end
12269; O0-NEXT:    movq $1, foo
12270; O0-NEXT:    popq %rbx
12271; O0-NEXT:    .cfi_def_cfa_offset 8
12272; O0-NEXT:    retq
12273;
12274; O1-LABEL: atomic128_sub_acquire:
12275; O1:       # %bb.0: # %entry
12276; O1-NEXT:    pushq %rbx
12277; O1-NEXT:    .cfi_def_cfa_offset 16
12278; O1-NEXT:    .cfi_offset %rbx, -16
12279; O1-NEXT:    movq foo(%rip), %rax
12280; O1-NEXT:  .Lpcsection472:
12281; O1-NEXT:    movq (%rdi), %rax
12282; O1-NEXT:  .Lpcsection473:
12283; O1-NEXT:    movq 8(%rdi), %rdx
12284; O1-NEXT:    .p2align 4
12285; O1-NEXT:  .LBB217_1: # %atomicrmw.start
12286; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12287; O1-NEXT:    movq %rax, %rbx
12288; O1-NEXT:  .Lpcsection474:
12289; O1-NEXT:    addq $-42, %rbx
12290; O1-NEXT:    movq %rdx, %rcx
12291; O1-NEXT:  .Lpcsection475:
12292; O1-NEXT:    adcq $-1, %rcx
12293; O1-NEXT:  .Lpcsection476:
12294; O1-NEXT:    lock cmpxchg16b (%rdi)
12295; O1-NEXT:  .Lpcsection477:
12296; O1-NEXT:    jne .LBB217_1
12297; O1-NEXT:  # %bb.2: # %atomicrmw.end
12298; O1-NEXT:    movq $1, foo(%rip)
12299; O1-NEXT:    popq %rbx
12300; O1-NEXT:    .cfi_def_cfa_offset 8
12301; O1-NEXT:    retq
12302;
12303; O2-LABEL: atomic128_sub_acquire:
12304; O2:       # %bb.0: # %entry
12305; O2-NEXT:    pushq %rbx
12306; O2-NEXT:    .cfi_def_cfa_offset 16
12307; O2-NEXT:    .cfi_offset %rbx, -16
12308; O2-NEXT:    movq foo(%rip), %rax
12309; O2-NEXT:  .Lpcsection472:
12310; O2-NEXT:    movq (%rdi), %rax
12311; O2-NEXT:  .Lpcsection473:
12312; O2-NEXT:    movq 8(%rdi), %rdx
12313; O2-NEXT:    .p2align 4
12314; O2-NEXT:  .LBB217_1: # %atomicrmw.start
12315; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12316; O2-NEXT:    movq %rax, %rbx
12317; O2-NEXT:  .Lpcsection474:
12318; O2-NEXT:    addq $-42, %rbx
12319; O2-NEXT:    movq %rdx, %rcx
12320; O2-NEXT:  .Lpcsection475:
12321; O2-NEXT:    adcq $-1, %rcx
12322; O2-NEXT:  .Lpcsection476:
12323; O2-NEXT:    lock cmpxchg16b (%rdi)
12324; O2-NEXT:  .Lpcsection477:
12325; O2-NEXT:    jne .LBB217_1
12326; O2-NEXT:  # %bb.2: # %atomicrmw.end
12327; O2-NEXT:    movq $1, foo(%rip)
12328; O2-NEXT:    popq %rbx
12329; O2-NEXT:    .cfi_def_cfa_offset 8
12330; O2-NEXT:    retq
12331;
12332; O3-LABEL: atomic128_sub_acquire:
12333; O3:       # %bb.0: # %entry
12334; O3-NEXT:    pushq %rbx
12335; O3-NEXT:    .cfi_def_cfa_offset 16
12336; O3-NEXT:    .cfi_offset %rbx, -16
12337; O3-NEXT:    movq foo(%rip), %rax
12338; O3-NEXT:  .Lpcsection472:
12339; O3-NEXT:    movq (%rdi), %rax
12340; O3-NEXT:  .Lpcsection473:
12341; O3-NEXT:    movq 8(%rdi), %rdx
12342; O3-NEXT:    .p2align 4
12343; O3-NEXT:  .LBB217_1: # %atomicrmw.start
12344; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12345; O3-NEXT:    movq %rax, %rbx
12346; O3-NEXT:  .Lpcsection474:
12347; O3-NEXT:    addq $-42, %rbx
12348; O3-NEXT:    movq %rdx, %rcx
12349; O3-NEXT:  .Lpcsection475:
12350; O3-NEXT:    adcq $-1, %rcx
12351; O3-NEXT:  .Lpcsection476:
12352; O3-NEXT:    lock cmpxchg16b (%rdi)
12353; O3-NEXT:  .Lpcsection477:
12354; O3-NEXT:    jne .LBB217_1
12355; O3-NEXT:  # %bb.2: # %atomicrmw.end
12356; O3-NEXT:    movq $1, foo(%rip)
12357; O3-NEXT:    popq %rbx
12358; O3-NEXT:    .cfi_def_cfa_offset 8
12359; O3-NEXT:    retq
12360entry:
12361  load volatile i64, ptr @foo, align 8
12362  %x = atomicrmw sub ptr %a, i128 42 acquire, align 16, !pcsections !0
12363  store volatile i64 1, ptr @foo, align 8
12364  ret void
12365}
12366
12367define void @atomic128_and_acquire(ptr %a) {
12368; O0-LABEL: atomic128_and_acquire:
12369; O0:       # %bb.0: # %entry
12370; O0-NEXT:    pushq %rbx
12371; O0-NEXT:    .cfi_def_cfa_offset 16
12372; O0-NEXT:    .cfi_offset %rbx, -16
12373; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12374; O0-NEXT:    movq foo(%rip), %rax
12375; O0-NEXT:  .Lpcsection529:
12376; O0-NEXT:    movq (%rdi), %rax
12377; O0-NEXT:  .Lpcsection530:
12378; O0-NEXT:    movq 8(%rdi), %rdx
12379; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12380; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12381; O0-NEXT:  .Lpcsection531:
12382; O0-NEXT:    jmp .LBB218_1
12383; O0-NEXT:  .LBB218_1: # %atomicrmw.start
12384; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12385; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
12386; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12387; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12388; O0-NEXT:    movl %eax, %ecx
12389; O0-NEXT:  .Lpcsection532:
12390; O0-NEXT:    andl $42, %ecx
12391; O0-NEXT:    movl %ecx, %ebx
12392; O0-NEXT:  .Lpcsection533:
12393; O0-NEXT:    xorl %ecx, %ecx
12394; O0-NEXT:  .Lpcsection534:
12395; O0-NEXT:    # kill: def $rcx killed $ecx
12396; O0-NEXT:  .Lpcsection535:
12397; O0-NEXT:    lock cmpxchg16b (%rsi)
12398; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12399; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12400; O0-NEXT:  .Lpcsection536:
12401; O0-NEXT:    jne .LBB218_1
12402; O0-NEXT:    jmp .LBB218_2
12403; O0-NEXT:  .LBB218_2: # %atomicrmw.end
12404; O0-NEXT:    movq $1, foo
12405; O0-NEXT:    popq %rbx
12406; O0-NEXT:    .cfi_def_cfa_offset 8
12407; O0-NEXT:    retq
12408;
12409; O1-LABEL: atomic128_and_acquire:
12410; O1:       # %bb.0: # %entry
12411; O1-NEXT:    pushq %rbx
12412; O1-NEXT:    .cfi_def_cfa_offset 16
12413; O1-NEXT:    .cfi_offset %rbx, -16
12414; O1-NEXT:    movq foo(%rip), %rax
12415; O1-NEXT:  .Lpcsection478:
12416; O1-NEXT:    movq (%rdi), %rax
12417; O1-NEXT:  .Lpcsection479:
12418; O1-NEXT:    movq 8(%rdi), %rdx
12419; O1-NEXT:    .p2align 4
12420; O1-NEXT:  .LBB218_1: # %atomicrmw.start
12421; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12422; O1-NEXT:    movl %eax, %ebx
12423; O1-NEXT:  .Lpcsection480:
12424; O1-NEXT:    andl $42, %ebx
12425; O1-NEXT:  .Lpcsection481:
12426; O1-NEXT:    xorl %ecx, %ecx
12427; O1-NEXT:  .Lpcsection482:
12428; O1-NEXT:    lock cmpxchg16b (%rdi)
12429; O1-NEXT:  .Lpcsection483:
12430; O1-NEXT:    jne .LBB218_1
12431; O1-NEXT:  # %bb.2: # %atomicrmw.end
12432; O1-NEXT:    movq $1, foo(%rip)
12433; O1-NEXT:    popq %rbx
12434; O1-NEXT:    .cfi_def_cfa_offset 8
12435; O1-NEXT:    retq
12436;
12437; O2-LABEL: atomic128_and_acquire:
12438; O2:       # %bb.0: # %entry
12439; O2-NEXT:    pushq %rbx
12440; O2-NEXT:    .cfi_def_cfa_offset 16
12441; O2-NEXT:    .cfi_offset %rbx, -16
12442; O2-NEXT:    movq foo(%rip), %rax
12443; O2-NEXT:  .Lpcsection478:
12444; O2-NEXT:    movq (%rdi), %rax
12445; O2-NEXT:  .Lpcsection479:
12446; O2-NEXT:    movq 8(%rdi), %rdx
12447; O2-NEXT:    .p2align 4
12448; O2-NEXT:  .LBB218_1: # %atomicrmw.start
12449; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12450; O2-NEXT:    movl %eax, %ebx
12451; O2-NEXT:  .Lpcsection480:
12452; O2-NEXT:    andl $42, %ebx
12453; O2-NEXT:  .Lpcsection481:
12454; O2-NEXT:    xorl %ecx, %ecx
12455; O2-NEXT:  .Lpcsection482:
12456; O2-NEXT:    lock cmpxchg16b (%rdi)
12457; O2-NEXT:  .Lpcsection483:
12458; O2-NEXT:    jne .LBB218_1
12459; O2-NEXT:  # %bb.2: # %atomicrmw.end
12460; O2-NEXT:    movq $1, foo(%rip)
12461; O2-NEXT:    popq %rbx
12462; O2-NEXT:    .cfi_def_cfa_offset 8
12463; O2-NEXT:    retq
12464;
12465; O3-LABEL: atomic128_and_acquire:
12466; O3:       # %bb.0: # %entry
12467; O3-NEXT:    pushq %rbx
12468; O3-NEXT:    .cfi_def_cfa_offset 16
12469; O3-NEXT:    .cfi_offset %rbx, -16
12470; O3-NEXT:    movq foo(%rip), %rax
12471; O3-NEXT:  .Lpcsection478:
12472; O3-NEXT:    movq (%rdi), %rax
12473; O3-NEXT:  .Lpcsection479:
12474; O3-NEXT:    movq 8(%rdi), %rdx
12475; O3-NEXT:    .p2align 4
12476; O3-NEXT:  .LBB218_1: # %atomicrmw.start
12477; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12478; O3-NEXT:    movl %eax, %ebx
12479; O3-NEXT:  .Lpcsection480:
12480; O3-NEXT:    andl $42, %ebx
12481; O3-NEXT:  .Lpcsection481:
12482; O3-NEXT:    xorl %ecx, %ecx
12483; O3-NEXT:  .Lpcsection482:
12484; O3-NEXT:    lock cmpxchg16b (%rdi)
12485; O3-NEXT:  .Lpcsection483:
12486; O3-NEXT:    jne .LBB218_1
12487; O3-NEXT:  # %bb.2: # %atomicrmw.end
12488; O3-NEXT:    movq $1, foo(%rip)
12489; O3-NEXT:    popq %rbx
12490; O3-NEXT:    .cfi_def_cfa_offset 8
12491; O3-NEXT:    retq
12492entry:
12493  load volatile i64, ptr @foo, align 8
12494  %x = atomicrmw and ptr %a, i128 42 acquire, align 16, !pcsections !0
12495  store volatile i64 1, ptr @foo, align 8
12496  ret void
12497}
12498
12499define void @atomic128_or_acquire(ptr %a) {
12500; O0-LABEL: atomic128_or_acquire:
12501; O0:       # %bb.0: # %entry
12502; O0-NEXT:    pushq %rbx
12503; O0-NEXT:    .cfi_def_cfa_offset 16
12504; O0-NEXT:    .cfi_offset %rbx, -16
12505; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12506; O0-NEXT:    movq foo(%rip), %rax
12507; O0-NEXT:  .Lpcsection537:
12508; O0-NEXT:    movq (%rdi), %rax
12509; O0-NEXT:  .Lpcsection538:
12510; O0-NEXT:    movq 8(%rdi), %rdx
12511; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12512; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12513; O0-NEXT:  .Lpcsection539:
12514; O0-NEXT:    jmp .LBB219_1
12515; O0-NEXT:  .LBB219_1: # %atomicrmw.start
12516; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12517; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
12518; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12519; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12520; O0-NEXT:    movq %rax, %rbx
12521; O0-NEXT:  .Lpcsection540:
12522; O0-NEXT:    orq $42, %rbx
12523; O0-NEXT:    movq %rcx, %rdx
12524; O0-NEXT:  .Lpcsection541:
12525; O0-NEXT:    lock cmpxchg16b (%rsi)
12526; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12527; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12528; O0-NEXT:  .Lpcsection542:
12529; O0-NEXT:    jne .LBB219_1
12530; O0-NEXT:    jmp .LBB219_2
12531; O0-NEXT:  .LBB219_2: # %atomicrmw.end
12532; O0-NEXT:    movq $1, foo
12533; O0-NEXT:    popq %rbx
12534; O0-NEXT:    .cfi_def_cfa_offset 8
12535; O0-NEXT:    retq
12536;
12537; O1-LABEL: atomic128_or_acquire:
12538; O1:       # %bb.0: # %entry
12539; O1-NEXT:    pushq %rbx
12540; O1-NEXT:    .cfi_def_cfa_offset 16
12541; O1-NEXT:    .cfi_offset %rbx, -16
12542; O1-NEXT:    movq foo(%rip), %rax
12543; O1-NEXT:  .Lpcsection484:
12544; O1-NEXT:    movq (%rdi), %rax
12545; O1-NEXT:  .Lpcsection485:
12546; O1-NEXT:    movq 8(%rdi), %rdx
12547; O1-NEXT:    .p2align 4
12548; O1-NEXT:  .LBB219_1: # %atomicrmw.start
12549; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12550; O1-NEXT:    movq %rax, %rbx
12551; O1-NEXT:  .Lpcsection486:
12552; O1-NEXT:    orq $42, %rbx
12553; O1-NEXT:    movq %rdx, %rcx
12554; O1-NEXT:  .Lpcsection487:
12555; O1-NEXT:    lock cmpxchg16b (%rdi)
12556; O1-NEXT:  .Lpcsection488:
12557; O1-NEXT:    jne .LBB219_1
12558; O1-NEXT:  # %bb.2: # %atomicrmw.end
12559; O1-NEXT:    movq $1, foo(%rip)
12560; O1-NEXT:    popq %rbx
12561; O1-NEXT:    .cfi_def_cfa_offset 8
12562; O1-NEXT:    retq
12563;
12564; O2-LABEL: atomic128_or_acquire:
12565; O2:       # %bb.0: # %entry
12566; O2-NEXT:    pushq %rbx
12567; O2-NEXT:    .cfi_def_cfa_offset 16
12568; O2-NEXT:    .cfi_offset %rbx, -16
12569; O2-NEXT:    movq foo(%rip), %rax
12570; O2-NEXT:  .Lpcsection484:
12571; O2-NEXT:    movq (%rdi), %rax
12572; O2-NEXT:  .Lpcsection485:
12573; O2-NEXT:    movq 8(%rdi), %rdx
12574; O2-NEXT:    .p2align 4
12575; O2-NEXT:  .LBB219_1: # %atomicrmw.start
12576; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12577; O2-NEXT:    movq %rax, %rbx
12578; O2-NEXT:  .Lpcsection486:
12579; O2-NEXT:    orq $42, %rbx
12580; O2-NEXT:    movq %rdx, %rcx
12581; O2-NEXT:  .Lpcsection487:
12582; O2-NEXT:    lock cmpxchg16b (%rdi)
12583; O2-NEXT:  .Lpcsection488:
12584; O2-NEXT:    jne .LBB219_1
12585; O2-NEXT:  # %bb.2: # %atomicrmw.end
12586; O2-NEXT:    movq $1, foo(%rip)
12587; O2-NEXT:    popq %rbx
12588; O2-NEXT:    .cfi_def_cfa_offset 8
12589; O2-NEXT:    retq
12590;
12591; O3-LABEL: atomic128_or_acquire:
12592; O3:       # %bb.0: # %entry
12593; O3-NEXT:    pushq %rbx
12594; O3-NEXT:    .cfi_def_cfa_offset 16
12595; O3-NEXT:    .cfi_offset %rbx, -16
12596; O3-NEXT:    movq foo(%rip), %rax
12597; O3-NEXT:  .Lpcsection484:
12598; O3-NEXT:    movq (%rdi), %rax
12599; O3-NEXT:  .Lpcsection485:
12600; O3-NEXT:    movq 8(%rdi), %rdx
12601; O3-NEXT:    .p2align 4
12602; O3-NEXT:  .LBB219_1: # %atomicrmw.start
12603; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12604; O3-NEXT:    movq %rax, %rbx
12605; O3-NEXT:  .Lpcsection486:
12606; O3-NEXT:    orq $42, %rbx
12607; O3-NEXT:    movq %rdx, %rcx
12608; O3-NEXT:  .Lpcsection487:
12609; O3-NEXT:    lock cmpxchg16b (%rdi)
12610; O3-NEXT:  .Lpcsection488:
12611; O3-NEXT:    jne .LBB219_1
12612; O3-NEXT:  # %bb.2: # %atomicrmw.end
12613; O3-NEXT:    movq $1, foo(%rip)
12614; O3-NEXT:    popq %rbx
12615; O3-NEXT:    .cfi_def_cfa_offset 8
12616; O3-NEXT:    retq
12617entry:
12618  load volatile i64, ptr @foo, align 8
12619  %x = atomicrmw or ptr %a, i128 42 acquire, align 16, !pcsections !0
12620  store volatile i64 1, ptr @foo, align 8
12621  ret void
12622}
12623
12624define void @atomic128_xor_acquire(ptr %a) {
12625; O0-LABEL: atomic128_xor_acquire:
12626; O0:       # %bb.0: # %entry
12627; O0-NEXT:    pushq %rbx
12628; O0-NEXT:    .cfi_def_cfa_offset 16
12629; O0-NEXT:    .cfi_offset %rbx, -16
12630; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12631; O0-NEXT:    movq foo(%rip), %rax
12632; O0-NEXT:  .Lpcsection543:
12633; O0-NEXT:    movq (%rdi), %rax
12634; O0-NEXT:  .Lpcsection544:
12635; O0-NEXT:    movq 8(%rdi), %rdx
12636; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12637; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12638; O0-NEXT:  .Lpcsection545:
12639; O0-NEXT:    jmp .LBB220_1
12640; O0-NEXT:  .LBB220_1: # %atomicrmw.start
12641; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12642; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
12643; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12644; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12645; O0-NEXT:    movq %rax, %rbx
12646; O0-NEXT:  .Lpcsection546:
12647; O0-NEXT:    xorq $42, %rbx
12648; O0-NEXT:    movq %rcx, %rdx
12649; O0-NEXT:  .Lpcsection547:
12650; O0-NEXT:    lock cmpxchg16b (%rsi)
12651; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12652; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12653; O0-NEXT:  .Lpcsection548:
12654; O0-NEXT:    jne .LBB220_1
12655; O0-NEXT:    jmp .LBB220_2
12656; O0-NEXT:  .LBB220_2: # %atomicrmw.end
12657; O0-NEXT:    movq $1, foo
12658; O0-NEXT:    popq %rbx
12659; O0-NEXT:    .cfi_def_cfa_offset 8
12660; O0-NEXT:    retq
12661;
12662; O1-LABEL: atomic128_xor_acquire:
12663; O1:       # %bb.0: # %entry
12664; O1-NEXT:    pushq %rbx
12665; O1-NEXT:    .cfi_def_cfa_offset 16
12666; O1-NEXT:    .cfi_offset %rbx, -16
12667; O1-NEXT:    movq foo(%rip), %rax
12668; O1-NEXT:  .Lpcsection489:
12669; O1-NEXT:    movq (%rdi), %rax
12670; O1-NEXT:  .Lpcsection490:
12671; O1-NEXT:    movq 8(%rdi), %rdx
12672; O1-NEXT:    .p2align 4
12673; O1-NEXT:  .LBB220_1: # %atomicrmw.start
12674; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12675; O1-NEXT:    movq %rax, %rbx
12676; O1-NEXT:  .Lpcsection491:
12677; O1-NEXT:    xorq $42, %rbx
12678; O1-NEXT:    movq %rdx, %rcx
12679; O1-NEXT:  .Lpcsection492:
12680; O1-NEXT:    lock cmpxchg16b (%rdi)
12681; O1-NEXT:  .Lpcsection493:
12682; O1-NEXT:    jne .LBB220_1
12683; O1-NEXT:  # %bb.2: # %atomicrmw.end
12684; O1-NEXT:    movq $1, foo(%rip)
12685; O1-NEXT:    popq %rbx
12686; O1-NEXT:    .cfi_def_cfa_offset 8
12687; O1-NEXT:    retq
12688;
12689; O2-LABEL: atomic128_xor_acquire:
12690; O2:       # %bb.0: # %entry
12691; O2-NEXT:    pushq %rbx
12692; O2-NEXT:    .cfi_def_cfa_offset 16
12693; O2-NEXT:    .cfi_offset %rbx, -16
12694; O2-NEXT:    movq foo(%rip), %rax
12695; O2-NEXT:  .Lpcsection489:
12696; O2-NEXT:    movq (%rdi), %rax
12697; O2-NEXT:  .Lpcsection490:
12698; O2-NEXT:    movq 8(%rdi), %rdx
12699; O2-NEXT:    .p2align 4
12700; O2-NEXT:  .LBB220_1: # %atomicrmw.start
12701; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12702; O2-NEXT:    movq %rax, %rbx
12703; O2-NEXT:  .Lpcsection491:
12704; O2-NEXT:    xorq $42, %rbx
12705; O2-NEXT:    movq %rdx, %rcx
12706; O2-NEXT:  .Lpcsection492:
12707; O2-NEXT:    lock cmpxchg16b (%rdi)
12708; O2-NEXT:  .Lpcsection493:
12709; O2-NEXT:    jne .LBB220_1
12710; O2-NEXT:  # %bb.2: # %atomicrmw.end
12711; O2-NEXT:    movq $1, foo(%rip)
12712; O2-NEXT:    popq %rbx
12713; O2-NEXT:    .cfi_def_cfa_offset 8
12714; O2-NEXT:    retq
12715;
12716; O3-LABEL: atomic128_xor_acquire:
12717; O3:       # %bb.0: # %entry
12718; O3-NEXT:    pushq %rbx
12719; O3-NEXT:    .cfi_def_cfa_offset 16
12720; O3-NEXT:    .cfi_offset %rbx, -16
12721; O3-NEXT:    movq foo(%rip), %rax
12722; O3-NEXT:  .Lpcsection489:
12723; O3-NEXT:    movq (%rdi), %rax
12724; O3-NEXT:  .Lpcsection490:
12725; O3-NEXT:    movq 8(%rdi), %rdx
12726; O3-NEXT:    .p2align 4
12727; O3-NEXT:  .LBB220_1: # %atomicrmw.start
12728; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12729; O3-NEXT:    movq %rax, %rbx
12730; O3-NEXT:  .Lpcsection491:
12731; O3-NEXT:    xorq $42, %rbx
12732; O3-NEXT:    movq %rdx, %rcx
12733; O3-NEXT:  .Lpcsection492:
12734; O3-NEXT:    lock cmpxchg16b (%rdi)
12735; O3-NEXT:  .Lpcsection493:
12736; O3-NEXT:    jne .LBB220_1
12737; O3-NEXT:  # %bb.2: # %atomicrmw.end
12738; O3-NEXT:    movq $1, foo(%rip)
12739; O3-NEXT:    popq %rbx
12740; O3-NEXT:    .cfi_def_cfa_offset 8
12741; O3-NEXT:    retq
12742entry:
12743  load volatile i64, ptr @foo, align 8
12744  %x = atomicrmw xor ptr %a, i128 42 acquire, align 16, !pcsections !0
12745  store volatile i64 1, ptr @foo, align 8
12746  ret void
12747}
12748
12749define void @atomic128_nand_acquire(ptr %a) {
12750; O0-LABEL: atomic128_nand_acquire:
12751; O0:       # %bb.0: # %entry
12752; O0-NEXT:    pushq %rbx
12753; O0-NEXT:    .cfi_def_cfa_offset 16
12754; O0-NEXT:    .cfi_offset %rbx, -16
12755; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12756; O0-NEXT:    movq foo(%rip), %rax
12757; O0-NEXT:  .Lpcsection549:
12758; O0-NEXT:    movq (%rdi), %rax
12759; O0-NEXT:  .Lpcsection550:
12760; O0-NEXT:    movq 8(%rdi), %rdx
12761; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12762; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12763; O0-NEXT:  .Lpcsection551:
12764; O0-NEXT:    jmp .LBB221_1
12765; O0-NEXT:  .LBB221_1: # %atomicrmw.start
12766; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12767; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
12768; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12769; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12770; O0-NEXT:    movl %eax, %ecx
12771; O0-NEXT:  .Lpcsection552:
12772; O0-NEXT:    notl %ecx
12773; O0-NEXT:  .Lpcsection553:
12774; O0-NEXT:    # implicit-def: $rbx
12775; O0-NEXT:    movl %ecx, %ebx
12776; O0-NEXT:  .Lpcsection554:
12777; O0-NEXT:    orq $-43, %rbx
12778; O0-NEXT:  .Lpcsection555:
12779; O0-NEXT:    movq $-1, %rcx
12780; O0-NEXT:  .Lpcsection556:
12781; O0-NEXT:    lock cmpxchg16b (%rsi)
12782; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12783; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12784; O0-NEXT:  .Lpcsection557:
12785; O0-NEXT:    jne .LBB221_1
12786; O0-NEXT:    jmp .LBB221_2
12787; O0-NEXT:  .LBB221_2: # %atomicrmw.end
12788; O0-NEXT:    movq $1, foo
12789; O0-NEXT:    popq %rbx
12790; O0-NEXT:    .cfi_def_cfa_offset 8
12791; O0-NEXT:    retq
12792;
12793; O1-LABEL: atomic128_nand_acquire:
12794; O1:       # %bb.0: # %entry
12795; O1-NEXT:    pushq %rbx
12796; O1-NEXT:    .cfi_def_cfa_offset 16
12797; O1-NEXT:    .cfi_offset %rbx, -16
12798; O1-NEXT:    movq foo(%rip), %rax
12799; O1-NEXT:  .Lpcsection494:
12800; O1-NEXT:    movq (%rdi), %rax
12801; O1-NEXT:  .Lpcsection495:
12802; O1-NEXT:    movq 8(%rdi), %rdx
12803; O1-NEXT:  .Lpcsection496:
12804; O1-NEXT:    movq $-1, %rcx
12805; O1-NEXT:    .p2align 4
12806; O1-NEXT:  .LBB221_1: # %atomicrmw.start
12807; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12808; O1-NEXT:    movl %eax, %ebx
12809; O1-NEXT:  .Lpcsection497:
12810; O1-NEXT:    notl %ebx
12811; O1-NEXT:  .Lpcsection498:
12812; O1-NEXT:    orq $-43, %rbx
12813; O1-NEXT:  .Lpcsection499:
12814; O1-NEXT:    lock cmpxchg16b (%rdi)
12815; O1-NEXT:  .Lpcsection500:
12816; O1-NEXT:    jne .LBB221_1
12817; O1-NEXT:  # %bb.2: # %atomicrmw.end
12818; O1-NEXT:    movq $1, foo(%rip)
12819; O1-NEXT:    popq %rbx
12820; O1-NEXT:    .cfi_def_cfa_offset 8
12821; O1-NEXT:    retq
12822;
12823; O2-LABEL: atomic128_nand_acquire:
12824; O2:       # %bb.0: # %entry
12825; O2-NEXT:    pushq %rbx
12826; O2-NEXT:    .cfi_def_cfa_offset 16
12827; O2-NEXT:    .cfi_offset %rbx, -16
12828; O2-NEXT:    movq foo(%rip), %rax
12829; O2-NEXT:  .Lpcsection494:
12830; O2-NEXT:    movq (%rdi), %rax
12831; O2-NEXT:  .Lpcsection495:
12832; O2-NEXT:    movq 8(%rdi), %rdx
12833; O2-NEXT:  .Lpcsection496:
12834; O2-NEXT:    movq $-1, %rcx
12835; O2-NEXT:    .p2align 4
12836; O2-NEXT:  .LBB221_1: # %atomicrmw.start
12837; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12838; O2-NEXT:    movl %eax, %ebx
12839; O2-NEXT:  .Lpcsection497:
12840; O2-NEXT:    notl %ebx
12841; O2-NEXT:  .Lpcsection498:
12842; O2-NEXT:    orq $-43, %rbx
12843; O2-NEXT:  .Lpcsection499:
12844; O2-NEXT:    lock cmpxchg16b (%rdi)
12845; O2-NEXT:  .Lpcsection500:
12846; O2-NEXT:    jne .LBB221_1
12847; O2-NEXT:  # %bb.2: # %atomicrmw.end
12848; O2-NEXT:    movq $1, foo(%rip)
12849; O2-NEXT:    popq %rbx
12850; O2-NEXT:    .cfi_def_cfa_offset 8
12851; O2-NEXT:    retq
12852;
12853; O3-LABEL: atomic128_nand_acquire:
12854; O3:       # %bb.0: # %entry
12855; O3-NEXT:    pushq %rbx
12856; O3-NEXT:    .cfi_def_cfa_offset 16
12857; O3-NEXT:    .cfi_offset %rbx, -16
12858; O3-NEXT:    movq foo(%rip), %rax
12859; O3-NEXT:  .Lpcsection494:
12860; O3-NEXT:    movq (%rdi), %rax
12861; O3-NEXT:  .Lpcsection495:
12862; O3-NEXT:    movq 8(%rdi), %rdx
12863; O3-NEXT:  .Lpcsection496:
12864; O3-NEXT:    movq $-1, %rcx
12865; O3-NEXT:    .p2align 4
12866; O3-NEXT:  .LBB221_1: # %atomicrmw.start
12867; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12868; O3-NEXT:    movl %eax, %ebx
12869; O3-NEXT:  .Lpcsection497:
12870; O3-NEXT:    notl %ebx
12871; O3-NEXT:  .Lpcsection498:
12872; O3-NEXT:    orq $-43, %rbx
12873; O3-NEXT:  .Lpcsection499:
12874; O3-NEXT:    lock cmpxchg16b (%rdi)
12875; O3-NEXT:  .Lpcsection500:
12876; O3-NEXT:    jne .LBB221_1
12877; O3-NEXT:  # %bb.2: # %atomicrmw.end
12878; O3-NEXT:    movq $1, foo(%rip)
12879; O3-NEXT:    popq %rbx
12880; O3-NEXT:    .cfi_def_cfa_offset 8
12881; O3-NEXT:    retq
12882entry:
12883  load volatile i64, ptr @foo, align 8
12884  %x = atomicrmw nand ptr %a, i128 42 acquire, align 16, !pcsections !0
12885  store volatile i64 1, ptr @foo, align 8
12886  ret void
12887}
12888
12889define void @atomic128_xchg_release(ptr %a) {
12890; O0-LABEL: atomic128_xchg_release:
12891; O0:       # %bb.0:
12892; O0-NEXT:    pushq %rbx
12893; O0-NEXT:    .cfi_def_cfa_offset 16
12894; O0-NEXT:    .cfi_offset %rbx, -16
12895; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12896; O0-NEXT:    movq foo(%rip), %rax
12897; O0-NEXT:  .Lpcsection558:
12898; O0-NEXT:    movq (%rdi), %rax
12899; O0-NEXT:  .Lpcsection559:
12900; O0-NEXT:    movq 8(%rdi), %rdx
12901; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12902; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12903; O0-NEXT:  .Lpcsection560:
12904; O0-NEXT:    jmp .LBB222_1
12905; O0-NEXT:  .LBB222_1: # %atomicrmw.start
12906; O0-NEXT:    # =>This Inner Loop Header: Depth=1
12907; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
12908; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
12909; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
12910; O0-NEXT:  .Lpcsection561:
12911; O0-NEXT:    xorl %ecx, %ecx
12912; O0-NEXT:  .Lpcsection562:
12913; O0-NEXT:    # kill: def $rcx killed $ecx
12914; O0-NEXT:  .Lpcsection563:
12915; O0-NEXT:    movl $42, %ebx
12916; O0-NEXT:  .Lpcsection564:
12917; O0-NEXT:    lock cmpxchg16b (%rsi)
12918; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12919; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
12920; O0-NEXT:  .Lpcsection565:
12921; O0-NEXT:    jne .LBB222_1
12922; O0-NEXT:    jmp .LBB222_2
12923; O0-NEXT:  .LBB222_2: # %atomicrmw.end
12924; O0-NEXT:    movq $1, foo
12925; O0-NEXT:    popq %rbx
12926; O0-NEXT:    .cfi_def_cfa_offset 8
12927; O0-NEXT:    retq
12928;
12929; O1-LABEL: atomic128_xchg_release:
12930; O1:       # %bb.0:
12931; O1-NEXT:    pushq %rbx
12932; O1-NEXT:    .cfi_def_cfa_offset 16
12933; O1-NEXT:    .cfi_offset %rbx, -16
12934; O1-NEXT:    movq foo(%rip), %rax
12935; O1-NEXT:  .Lpcsection501:
12936; O1-NEXT:    movq (%rdi), %rax
12937; O1-NEXT:  .Lpcsection502:
12938; O1-NEXT:    movq 8(%rdi), %rdx
12939; O1-NEXT:  .Lpcsection503:
12940; O1-NEXT:    movl $42, %ebx
12941; O1-NEXT:    .p2align 4
12942; O1-NEXT:  .LBB222_1: # %atomicrmw.start
12943; O1-NEXT:    # =>This Inner Loop Header: Depth=1
12944; O1-NEXT:  .Lpcsection504:
12945; O1-NEXT:    xorl %ecx, %ecx
12946; O1-NEXT:  .Lpcsection505:
12947; O1-NEXT:    lock cmpxchg16b (%rdi)
12948; O1-NEXT:  .Lpcsection506:
12949; O1-NEXT:    jne .LBB222_1
12950; O1-NEXT:  # %bb.2: # %atomicrmw.end
12951; O1-NEXT:    movq $1, foo(%rip)
12952; O1-NEXT:    popq %rbx
12953; O1-NEXT:    .cfi_def_cfa_offset 8
12954; O1-NEXT:    retq
12955;
12956; O2-LABEL: atomic128_xchg_release:
12957; O2:       # %bb.0:
12958; O2-NEXT:    pushq %rbx
12959; O2-NEXT:    .cfi_def_cfa_offset 16
12960; O2-NEXT:    .cfi_offset %rbx, -16
12961; O2-NEXT:    movq foo(%rip), %rax
12962; O2-NEXT:  .Lpcsection501:
12963; O2-NEXT:    movq (%rdi), %rax
12964; O2-NEXT:  .Lpcsection502:
12965; O2-NEXT:    movq 8(%rdi), %rdx
12966; O2-NEXT:  .Lpcsection503:
12967; O2-NEXT:    movl $42, %ebx
12968; O2-NEXT:    .p2align 4
12969; O2-NEXT:  .LBB222_1: # %atomicrmw.start
12970; O2-NEXT:    # =>This Inner Loop Header: Depth=1
12971; O2-NEXT:  .Lpcsection504:
12972; O2-NEXT:    xorl %ecx, %ecx
12973; O2-NEXT:  .Lpcsection505:
12974; O2-NEXT:    lock cmpxchg16b (%rdi)
12975; O2-NEXT:  .Lpcsection506:
12976; O2-NEXT:    jne .LBB222_1
12977; O2-NEXT:  # %bb.2: # %atomicrmw.end
12978; O2-NEXT:    movq $1, foo(%rip)
12979; O2-NEXT:    popq %rbx
12980; O2-NEXT:    .cfi_def_cfa_offset 8
12981; O2-NEXT:    retq
12982;
12983; O3-LABEL: atomic128_xchg_release:
12984; O3:       # %bb.0:
12985; O3-NEXT:    pushq %rbx
12986; O3-NEXT:    .cfi_def_cfa_offset 16
12987; O3-NEXT:    .cfi_offset %rbx, -16
12988; O3-NEXT:    movq foo(%rip), %rax
12989; O3-NEXT:  .Lpcsection501:
12990; O3-NEXT:    movq (%rdi), %rax
12991; O3-NEXT:  .Lpcsection502:
12992; O3-NEXT:    movq 8(%rdi), %rdx
12993; O3-NEXT:  .Lpcsection503:
12994; O3-NEXT:    movl $42, %ebx
12995; O3-NEXT:    .p2align 4
12996; O3-NEXT:  .LBB222_1: # %atomicrmw.start
12997; O3-NEXT:    # =>This Inner Loop Header: Depth=1
12998; O3-NEXT:  .Lpcsection504:
12999; O3-NEXT:    xorl %ecx, %ecx
13000; O3-NEXT:  .Lpcsection505:
13001; O3-NEXT:    lock cmpxchg16b (%rdi)
13002; O3-NEXT:  .Lpcsection506:
13003; O3-NEXT:    jne .LBB222_1
13004; O3-NEXT:  # %bb.2: # %atomicrmw.end
13005; O3-NEXT:    movq $1, foo(%rip)
13006; O3-NEXT:    popq %rbx
13007; O3-NEXT:    .cfi_def_cfa_offset 8
13008; O3-NEXT:    retq
13009  load volatile i64, ptr @foo, align 8
13010  %x = atomicrmw xchg ptr %a, i128 42 release, align 16, !pcsections !0
13011  store volatile i64 1, ptr @foo, align 8
13012  ret void
13013}
13014
13015define void @atomic128_add_release(ptr %a) {
13016; O0-LABEL: atomic128_add_release:
13017; O0:       # %bb.0: # %entry
13018; O0-NEXT:    pushq %rbx
13019; O0-NEXT:    .cfi_def_cfa_offset 16
13020; O0-NEXT:    .cfi_offset %rbx, -16
13021; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13022; O0-NEXT:    movq foo(%rip), %rax
13023; O0-NEXT:  .Lpcsection566:
13024; O0-NEXT:    movq (%rdi), %rax
13025; O0-NEXT:  .Lpcsection567:
13026; O0-NEXT:    movq 8(%rdi), %rdx
13027; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13028; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13029; O0-NEXT:  .Lpcsection568:
13030; O0-NEXT:    jmp .LBB223_1
13031; O0-NEXT:  .LBB223_1: # %atomicrmw.start
13032; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13033; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13034; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13035; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13036; O0-NEXT:    movq %rax, %rbx
13037; O0-NEXT:  .Lpcsection569:
13038; O0-NEXT:    addq $42, %rbx
13039; O0-NEXT:    movq %rdx, %rcx
13040; O0-NEXT:  .Lpcsection570:
13041; O0-NEXT:    adcq $0, %rcx
13042; O0-NEXT:  .Lpcsection571:
13043; O0-NEXT:    lock cmpxchg16b (%rsi)
13044; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13045; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13046; O0-NEXT:  .Lpcsection572:
13047; O0-NEXT:    jne .LBB223_1
13048; O0-NEXT:    jmp .LBB223_2
13049; O0-NEXT:  .LBB223_2: # %atomicrmw.end
13050; O0-NEXT:    movq $1, foo
13051; O0-NEXT:    popq %rbx
13052; O0-NEXT:    .cfi_def_cfa_offset 8
13053; O0-NEXT:    retq
13054;
13055; O1-LABEL: atomic128_add_release:
13056; O1:       # %bb.0: # %entry
13057; O1-NEXT:    pushq %rbx
13058; O1-NEXT:    .cfi_def_cfa_offset 16
13059; O1-NEXT:    .cfi_offset %rbx, -16
13060; O1-NEXT:    movq foo(%rip), %rax
13061; O1-NEXT:  .Lpcsection507:
13062; O1-NEXT:    movq (%rdi), %rax
13063; O1-NEXT:  .Lpcsection508:
13064; O1-NEXT:    movq 8(%rdi), %rdx
13065; O1-NEXT:    .p2align 4
13066; O1-NEXT:  .LBB223_1: # %atomicrmw.start
13067; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13068; O1-NEXT:    movq %rax, %rbx
13069; O1-NEXT:  .Lpcsection509:
13070; O1-NEXT:    addq $42, %rbx
13071; O1-NEXT:    movq %rdx, %rcx
13072; O1-NEXT:  .Lpcsection510:
13073; O1-NEXT:    adcq $0, %rcx
13074; O1-NEXT:  .Lpcsection511:
13075; O1-NEXT:    lock cmpxchg16b (%rdi)
13076; O1-NEXT:  .Lpcsection512:
13077; O1-NEXT:    jne .LBB223_1
13078; O1-NEXT:  # %bb.2: # %atomicrmw.end
13079; O1-NEXT:    movq $1, foo(%rip)
13080; O1-NEXT:    popq %rbx
13081; O1-NEXT:    .cfi_def_cfa_offset 8
13082; O1-NEXT:    retq
13083;
13084; O2-LABEL: atomic128_add_release:
13085; O2:       # %bb.0: # %entry
13086; O2-NEXT:    pushq %rbx
13087; O2-NEXT:    .cfi_def_cfa_offset 16
13088; O2-NEXT:    .cfi_offset %rbx, -16
13089; O2-NEXT:    movq foo(%rip), %rax
13090; O2-NEXT:  .Lpcsection507:
13091; O2-NEXT:    movq (%rdi), %rax
13092; O2-NEXT:  .Lpcsection508:
13093; O2-NEXT:    movq 8(%rdi), %rdx
13094; O2-NEXT:    .p2align 4
13095; O2-NEXT:  .LBB223_1: # %atomicrmw.start
13096; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13097; O2-NEXT:    movq %rax, %rbx
13098; O2-NEXT:  .Lpcsection509:
13099; O2-NEXT:    addq $42, %rbx
13100; O2-NEXT:    movq %rdx, %rcx
13101; O2-NEXT:  .Lpcsection510:
13102; O2-NEXT:    adcq $0, %rcx
13103; O2-NEXT:  .Lpcsection511:
13104; O2-NEXT:    lock cmpxchg16b (%rdi)
13105; O2-NEXT:  .Lpcsection512:
13106; O2-NEXT:    jne .LBB223_1
13107; O2-NEXT:  # %bb.2: # %atomicrmw.end
13108; O2-NEXT:    movq $1, foo(%rip)
13109; O2-NEXT:    popq %rbx
13110; O2-NEXT:    .cfi_def_cfa_offset 8
13111; O2-NEXT:    retq
13112;
13113; O3-LABEL: atomic128_add_release:
13114; O3:       # %bb.0: # %entry
13115; O3-NEXT:    pushq %rbx
13116; O3-NEXT:    .cfi_def_cfa_offset 16
13117; O3-NEXT:    .cfi_offset %rbx, -16
13118; O3-NEXT:    movq foo(%rip), %rax
13119; O3-NEXT:  .Lpcsection507:
13120; O3-NEXT:    movq (%rdi), %rax
13121; O3-NEXT:  .Lpcsection508:
13122; O3-NEXT:    movq 8(%rdi), %rdx
13123; O3-NEXT:    .p2align 4
13124; O3-NEXT:  .LBB223_1: # %atomicrmw.start
13125; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13126; O3-NEXT:    movq %rax, %rbx
13127; O3-NEXT:  .Lpcsection509:
13128; O3-NEXT:    addq $42, %rbx
13129; O3-NEXT:    movq %rdx, %rcx
13130; O3-NEXT:  .Lpcsection510:
13131; O3-NEXT:    adcq $0, %rcx
13132; O3-NEXT:  .Lpcsection511:
13133; O3-NEXT:    lock cmpxchg16b (%rdi)
13134; O3-NEXT:  .Lpcsection512:
13135; O3-NEXT:    jne .LBB223_1
13136; O3-NEXT:  # %bb.2: # %atomicrmw.end
13137; O3-NEXT:    movq $1, foo(%rip)
13138; O3-NEXT:    popq %rbx
13139; O3-NEXT:    .cfi_def_cfa_offset 8
13140; O3-NEXT:    retq
13141entry:
13142  load volatile i64, ptr @foo, align 8
13143  %x = atomicrmw add ptr %a, i128 42 release, align 16, !pcsections !0
13144  store volatile i64 1, ptr @foo, align 8
13145  ret void
13146}
13147
13148define void @atomic128_sub_release(ptr %a) {
13149; O0-LABEL: atomic128_sub_release:
13150; O0:       # %bb.0: # %entry
13151; O0-NEXT:    pushq %rbx
13152; O0-NEXT:    .cfi_def_cfa_offset 16
13153; O0-NEXT:    .cfi_offset %rbx, -16
13154; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13155; O0-NEXT:    movq foo(%rip), %rax
13156; O0-NEXT:  .Lpcsection573:
13157; O0-NEXT:    movq (%rdi), %rax
13158; O0-NEXT:  .Lpcsection574:
13159; O0-NEXT:    movq 8(%rdi), %rdx
13160; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13161; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13162; O0-NEXT:  .Lpcsection575:
13163; O0-NEXT:    jmp .LBB224_1
13164; O0-NEXT:  .LBB224_1: # %atomicrmw.start
13165; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13166; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13167; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13168; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13169; O0-NEXT:    movq %rax, %rbx
13170; O0-NEXT:  .Lpcsection576:
13171; O0-NEXT:    addq $-42, %rbx
13172; O0-NEXT:    movq %rdx, %rcx
13173; O0-NEXT:  .Lpcsection577:
13174; O0-NEXT:    adcq $-1, %rcx
13175; O0-NEXT:  .Lpcsection578:
13176; O0-NEXT:    lock cmpxchg16b (%rsi)
13177; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13178; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13179; O0-NEXT:  .Lpcsection579:
13180; O0-NEXT:    jne .LBB224_1
13181; O0-NEXT:    jmp .LBB224_2
13182; O0-NEXT:  .LBB224_2: # %atomicrmw.end
13183; O0-NEXT:    movq $1, foo
13184; O0-NEXT:    popq %rbx
13185; O0-NEXT:    .cfi_def_cfa_offset 8
13186; O0-NEXT:    retq
13187;
13188; O1-LABEL: atomic128_sub_release:
13189; O1:       # %bb.0: # %entry
13190; O1-NEXT:    pushq %rbx
13191; O1-NEXT:    .cfi_def_cfa_offset 16
13192; O1-NEXT:    .cfi_offset %rbx, -16
13193; O1-NEXT:    movq foo(%rip), %rax
13194; O1-NEXT:  .Lpcsection513:
13195; O1-NEXT:    movq (%rdi), %rax
13196; O1-NEXT:  .Lpcsection514:
13197; O1-NEXT:    movq 8(%rdi), %rdx
13198; O1-NEXT:    .p2align 4
13199; O1-NEXT:  .LBB224_1: # %atomicrmw.start
13200; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13201; O1-NEXT:    movq %rax, %rbx
13202; O1-NEXT:  .Lpcsection515:
13203; O1-NEXT:    addq $-42, %rbx
13204; O1-NEXT:    movq %rdx, %rcx
13205; O1-NEXT:  .Lpcsection516:
13206; O1-NEXT:    adcq $-1, %rcx
13207; O1-NEXT:  .Lpcsection517:
13208; O1-NEXT:    lock cmpxchg16b (%rdi)
13209; O1-NEXT:  .Lpcsection518:
13210; O1-NEXT:    jne .LBB224_1
13211; O1-NEXT:  # %bb.2: # %atomicrmw.end
13212; O1-NEXT:    movq $1, foo(%rip)
13213; O1-NEXT:    popq %rbx
13214; O1-NEXT:    .cfi_def_cfa_offset 8
13215; O1-NEXT:    retq
13216;
13217; O2-LABEL: atomic128_sub_release:
13218; O2:       # %bb.0: # %entry
13219; O2-NEXT:    pushq %rbx
13220; O2-NEXT:    .cfi_def_cfa_offset 16
13221; O2-NEXT:    .cfi_offset %rbx, -16
13222; O2-NEXT:    movq foo(%rip), %rax
13223; O2-NEXT:  .Lpcsection513:
13224; O2-NEXT:    movq (%rdi), %rax
13225; O2-NEXT:  .Lpcsection514:
13226; O2-NEXT:    movq 8(%rdi), %rdx
13227; O2-NEXT:    .p2align 4
13228; O2-NEXT:  .LBB224_1: # %atomicrmw.start
13229; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13230; O2-NEXT:    movq %rax, %rbx
13231; O2-NEXT:  .Lpcsection515:
13232; O2-NEXT:    addq $-42, %rbx
13233; O2-NEXT:    movq %rdx, %rcx
13234; O2-NEXT:  .Lpcsection516:
13235; O2-NEXT:    adcq $-1, %rcx
13236; O2-NEXT:  .Lpcsection517:
13237; O2-NEXT:    lock cmpxchg16b (%rdi)
13238; O2-NEXT:  .Lpcsection518:
13239; O2-NEXT:    jne .LBB224_1
13240; O2-NEXT:  # %bb.2: # %atomicrmw.end
13241; O2-NEXT:    movq $1, foo(%rip)
13242; O2-NEXT:    popq %rbx
13243; O2-NEXT:    .cfi_def_cfa_offset 8
13244; O2-NEXT:    retq
13245;
13246; O3-LABEL: atomic128_sub_release:
13247; O3:       # %bb.0: # %entry
13248; O3-NEXT:    pushq %rbx
13249; O3-NEXT:    .cfi_def_cfa_offset 16
13250; O3-NEXT:    .cfi_offset %rbx, -16
13251; O3-NEXT:    movq foo(%rip), %rax
13252; O3-NEXT:  .Lpcsection513:
13253; O3-NEXT:    movq (%rdi), %rax
13254; O3-NEXT:  .Lpcsection514:
13255; O3-NEXT:    movq 8(%rdi), %rdx
13256; O3-NEXT:    .p2align 4
13257; O3-NEXT:  .LBB224_1: # %atomicrmw.start
13258; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13259; O3-NEXT:    movq %rax, %rbx
13260; O3-NEXT:  .Lpcsection515:
13261; O3-NEXT:    addq $-42, %rbx
13262; O3-NEXT:    movq %rdx, %rcx
13263; O3-NEXT:  .Lpcsection516:
13264; O3-NEXT:    adcq $-1, %rcx
13265; O3-NEXT:  .Lpcsection517:
13266; O3-NEXT:    lock cmpxchg16b (%rdi)
13267; O3-NEXT:  .Lpcsection518:
13268; O3-NEXT:    jne .LBB224_1
13269; O3-NEXT:  # %bb.2: # %atomicrmw.end
13270; O3-NEXT:    movq $1, foo(%rip)
13271; O3-NEXT:    popq %rbx
13272; O3-NEXT:    .cfi_def_cfa_offset 8
13273; O3-NEXT:    retq
13274entry:
13275  load volatile i64, ptr @foo, align 8
13276  %x = atomicrmw sub ptr %a, i128 42 release, align 16, !pcsections !0
13277  store volatile i64 1, ptr @foo, align 8
13278  ret void
13279}
13280
13281define void @atomic128_and_release(ptr %a) {
13282; O0-LABEL: atomic128_and_release:
13283; O0:       # %bb.0: # %entry
13284; O0-NEXT:    pushq %rbx
13285; O0-NEXT:    .cfi_def_cfa_offset 16
13286; O0-NEXT:    .cfi_offset %rbx, -16
13287; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13288; O0-NEXT:    movq foo(%rip), %rax
13289; O0-NEXT:  .Lpcsection580:
13290; O0-NEXT:    movq (%rdi), %rax
13291; O0-NEXT:  .Lpcsection581:
13292; O0-NEXT:    movq 8(%rdi), %rdx
13293; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13294; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13295; O0-NEXT:  .Lpcsection582:
13296; O0-NEXT:    jmp .LBB225_1
13297; O0-NEXT:  .LBB225_1: # %atomicrmw.start
13298; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13299; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13300; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13301; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13302; O0-NEXT:    movl %eax, %ecx
13303; O0-NEXT:  .Lpcsection583:
13304; O0-NEXT:    andl $42, %ecx
13305; O0-NEXT:    movl %ecx, %ebx
13306; O0-NEXT:  .Lpcsection584:
13307; O0-NEXT:    xorl %ecx, %ecx
13308; O0-NEXT:  .Lpcsection585:
13309; O0-NEXT:    # kill: def $rcx killed $ecx
13310; O0-NEXT:  .Lpcsection586:
13311; O0-NEXT:    lock cmpxchg16b (%rsi)
13312; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13313; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13314; O0-NEXT:  .Lpcsection587:
13315; O0-NEXT:    jne .LBB225_1
13316; O0-NEXT:    jmp .LBB225_2
13317; O0-NEXT:  .LBB225_2: # %atomicrmw.end
13318; O0-NEXT:    movq $1, foo
13319; O0-NEXT:    popq %rbx
13320; O0-NEXT:    .cfi_def_cfa_offset 8
13321; O0-NEXT:    retq
13322;
13323; O1-LABEL: atomic128_and_release:
13324; O1:       # %bb.0: # %entry
13325; O1-NEXT:    pushq %rbx
13326; O1-NEXT:    .cfi_def_cfa_offset 16
13327; O1-NEXT:    .cfi_offset %rbx, -16
13328; O1-NEXT:    movq foo(%rip), %rax
13329; O1-NEXT:  .Lpcsection519:
13330; O1-NEXT:    movq (%rdi), %rax
13331; O1-NEXT:  .Lpcsection520:
13332; O1-NEXT:    movq 8(%rdi), %rdx
13333; O1-NEXT:    .p2align 4
13334; O1-NEXT:  .LBB225_1: # %atomicrmw.start
13335; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13336; O1-NEXT:    movl %eax, %ebx
13337; O1-NEXT:  .Lpcsection521:
13338; O1-NEXT:    andl $42, %ebx
13339; O1-NEXT:  .Lpcsection522:
13340; O1-NEXT:    xorl %ecx, %ecx
13341; O1-NEXT:  .Lpcsection523:
13342; O1-NEXT:    lock cmpxchg16b (%rdi)
13343; O1-NEXT:  .Lpcsection524:
13344; O1-NEXT:    jne .LBB225_1
13345; O1-NEXT:  # %bb.2: # %atomicrmw.end
13346; O1-NEXT:    movq $1, foo(%rip)
13347; O1-NEXT:    popq %rbx
13348; O1-NEXT:    .cfi_def_cfa_offset 8
13349; O1-NEXT:    retq
13350;
13351; O2-LABEL: atomic128_and_release:
13352; O2:       # %bb.0: # %entry
13353; O2-NEXT:    pushq %rbx
13354; O2-NEXT:    .cfi_def_cfa_offset 16
13355; O2-NEXT:    .cfi_offset %rbx, -16
13356; O2-NEXT:    movq foo(%rip), %rax
13357; O2-NEXT:  .Lpcsection519:
13358; O2-NEXT:    movq (%rdi), %rax
13359; O2-NEXT:  .Lpcsection520:
13360; O2-NEXT:    movq 8(%rdi), %rdx
13361; O2-NEXT:    .p2align 4
13362; O2-NEXT:  .LBB225_1: # %atomicrmw.start
13363; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13364; O2-NEXT:    movl %eax, %ebx
13365; O2-NEXT:  .Lpcsection521:
13366; O2-NEXT:    andl $42, %ebx
13367; O2-NEXT:  .Lpcsection522:
13368; O2-NEXT:    xorl %ecx, %ecx
13369; O2-NEXT:  .Lpcsection523:
13370; O2-NEXT:    lock cmpxchg16b (%rdi)
13371; O2-NEXT:  .Lpcsection524:
13372; O2-NEXT:    jne .LBB225_1
13373; O2-NEXT:  # %bb.2: # %atomicrmw.end
13374; O2-NEXT:    movq $1, foo(%rip)
13375; O2-NEXT:    popq %rbx
13376; O2-NEXT:    .cfi_def_cfa_offset 8
13377; O2-NEXT:    retq
13378;
13379; O3-LABEL: atomic128_and_release:
13380; O3:       # %bb.0: # %entry
13381; O3-NEXT:    pushq %rbx
13382; O3-NEXT:    .cfi_def_cfa_offset 16
13383; O3-NEXT:    .cfi_offset %rbx, -16
13384; O3-NEXT:    movq foo(%rip), %rax
13385; O3-NEXT:  .Lpcsection519:
13386; O3-NEXT:    movq (%rdi), %rax
13387; O3-NEXT:  .Lpcsection520:
13388; O3-NEXT:    movq 8(%rdi), %rdx
13389; O3-NEXT:    .p2align 4
13390; O3-NEXT:  .LBB225_1: # %atomicrmw.start
13391; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13392; O3-NEXT:    movl %eax, %ebx
13393; O3-NEXT:  .Lpcsection521:
13394; O3-NEXT:    andl $42, %ebx
13395; O3-NEXT:  .Lpcsection522:
13396; O3-NEXT:    xorl %ecx, %ecx
13397; O3-NEXT:  .Lpcsection523:
13398; O3-NEXT:    lock cmpxchg16b (%rdi)
13399; O3-NEXT:  .Lpcsection524:
13400; O3-NEXT:    jne .LBB225_1
13401; O3-NEXT:  # %bb.2: # %atomicrmw.end
13402; O3-NEXT:    movq $1, foo(%rip)
13403; O3-NEXT:    popq %rbx
13404; O3-NEXT:    .cfi_def_cfa_offset 8
13405; O3-NEXT:    retq
13406entry:
13407  load volatile i64, ptr @foo, align 8
13408  %x = atomicrmw and ptr %a, i128 42 release, align 16, !pcsections !0
13409  store volatile i64 1, ptr @foo, align 8
13410  ret void
13411}
13412
13413define void @atomic128_or_release(ptr %a) {
13414; O0-LABEL: atomic128_or_release:
13415; O0:       # %bb.0: # %entry
13416; O0-NEXT:    pushq %rbx
13417; O0-NEXT:    .cfi_def_cfa_offset 16
13418; O0-NEXT:    .cfi_offset %rbx, -16
13419; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13420; O0-NEXT:    movq foo(%rip), %rax
13421; O0-NEXT:  .Lpcsection588:
13422; O0-NEXT:    movq (%rdi), %rax
13423; O0-NEXT:  .Lpcsection589:
13424; O0-NEXT:    movq 8(%rdi), %rdx
13425; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13426; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13427; O0-NEXT:  .Lpcsection590:
13428; O0-NEXT:    jmp .LBB226_1
13429; O0-NEXT:  .LBB226_1: # %atomicrmw.start
13430; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13431; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
13432; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13433; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13434; O0-NEXT:    movq %rax, %rbx
13435; O0-NEXT:  .Lpcsection591:
13436; O0-NEXT:    orq $42, %rbx
13437; O0-NEXT:    movq %rcx, %rdx
13438; O0-NEXT:  .Lpcsection592:
13439; O0-NEXT:    lock cmpxchg16b (%rsi)
13440; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13441; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13442; O0-NEXT:  .Lpcsection593:
13443; O0-NEXT:    jne .LBB226_1
13444; O0-NEXT:    jmp .LBB226_2
13445; O0-NEXT:  .LBB226_2: # %atomicrmw.end
13446; O0-NEXT:    movq $1, foo
13447; O0-NEXT:    popq %rbx
13448; O0-NEXT:    .cfi_def_cfa_offset 8
13449; O0-NEXT:    retq
13450;
13451; O1-LABEL: atomic128_or_release:
13452; O1:       # %bb.0: # %entry
13453; O1-NEXT:    pushq %rbx
13454; O1-NEXT:    .cfi_def_cfa_offset 16
13455; O1-NEXT:    .cfi_offset %rbx, -16
13456; O1-NEXT:    movq foo(%rip), %rax
13457; O1-NEXT:  .Lpcsection525:
13458; O1-NEXT:    movq (%rdi), %rax
13459; O1-NEXT:  .Lpcsection526:
13460; O1-NEXT:    movq 8(%rdi), %rdx
13461; O1-NEXT:    .p2align 4
13462; O1-NEXT:  .LBB226_1: # %atomicrmw.start
13463; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13464; O1-NEXT:    movq %rax, %rbx
13465; O1-NEXT:  .Lpcsection527:
13466; O1-NEXT:    orq $42, %rbx
13467; O1-NEXT:    movq %rdx, %rcx
13468; O1-NEXT:  .Lpcsection528:
13469; O1-NEXT:    lock cmpxchg16b (%rdi)
13470; O1-NEXT:  .Lpcsection529:
13471; O1-NEXT:    jne .LBB226_1
13472; O1-NEXT:  # %bb.2: # %atomicrmw.end
13473; O1-NEXT:    movq $1, foo(%rip)
13474; O1-NEXT:    popq %rbx
13475; O1-NEXT:    .cfi_def_cfa_offset 8
13476; O1-NEXT:    retq
13477;
13478; O2-LABEL: atomic128_or_release:
13479; O2:       # %bb.0: # %entry
13480; O2-NEXT:    pushq %rbx
13481; O2-NEXT:    .cfi_def_cfa_offset 16
13482; O2-NEXT:    .cfi_offset %rbx, -16
13483; O2-NEXT:    movq foo(%rip), %rax
13484; O2-NEXT:  .Lpcsection525:
13485; O2-NEXT:    movq (%rdi), %rax
13486; O2-NEXT:  .Lpcsection526:
13487; O2-NEXT:    movq 8(%rdi), %rdx
13488; O2-NEXT:    .p2align 4
13489; O2-NEXT:  .LBB226_1: # %atomicrmw.start
13490; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13491; O2-NEXT:    movq %rax, %rbx
13492; O2-NEXT:  .Lpcsection527:
13493; O2-NEXT:    orq $42, %rbx
13494; O2-NEXT:    movq %rdx, %rcx
13495; O2-NEXT:  .Lpcsection528:
13496; O2-NEXT:    lock cmpxchg16b (%rdi)
13497; O2-NEXT:  .Lpcsection529:
13498; O2-NEXT:    jne .LBB226_1
13499; O2-NEXT:  # %bb.2: # %atomicrmw.end
13500; O2-NEXT:    movq $1, foo(%rip)
13501; O2-NEXT:    popq %rbx
13502; O2-NEXT:    .cfi_def_cfa_offset 8
13503; O2-NEXT:    retq
13504;
13505; O3-LABEL: atomic128_or_release:
13506; O3:       # %bb.0: # %entry
13507; O3-NEXT:    pushq %rbx
13508; O3-NEXT:    .cfi_def_cfa_offset 16
13509; O3-NEXT:    .cfi_offset %rbx, -16
13510; O3-NEXT:    movq foo(%rip), %rax
13511; O3-NEXT:  .Lpcsection525:
13512; O3-NEXT:    movq (%rdi), %rax
13513; O3-NEXT:  .Lpcsection526:
13514; O3-NEXT:    movq 8(%rdi), %rdx
13515; O3-NEXT:    .p2align 4
13516; O3-NEXT:  .LBB226_1: # %atomicrmw.start
13517; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13518; O3-NEXT:    movq %rax, %rbx
13519; O3-NEXT:  .Lpcsection527:
13520; O3-NEXT:    orq $42, %rbx
13521; O3-NEXT:    movq %rdx, %rcx
13522; O3-NEXT:  .Lpcsection528:
13523; O3-NEXT:    lock cmpxchg16b (%rdi)
13524; O3-NEXT:  .Lpcsection529:
13525; O3-NEXT:    jne .LBB226_1
13526; O3-NEXT:  # %bb.2: # %atomicrmw.end
13527; O3-NEXT:    movq $1, foo(%rip)
13528; O3-NEXT:    popq %rbx
13529; O3-NEXT:    .cfi_def_cfa_offset 8
13530; O3-NEXT:    retq
13531entry:
13532  load volatile i64, ptr @foo, align 8
13533  %x = atomicrmw or ptr %a, i128 42 release, align 16, !pcsections !0
13534  store volatile i64 1, ptr @foo, align 8
13535  ret void
13536}
13537
13538define void @atomic128_xor_release(ptr %a) {
13539; O0-LABEL: atomic128_xor_release:
13540; O0:       # %bb.0: # %entry
13541; O0-NEXT:    pushq %rbx
13542; O0-NEXT:    .cfi_def_cfa_offset 16
13543; O0-NEXT:    .cfi_offset %rbx, -16
13544; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13545; O0-NEXT:    movq foo(%rip), %rax
13546; O0-NEXT:  .Lpcsection594:
13547; O0-NEXT:    movq (%rdi), %rax
13548; O0-NEXT:  .Lpcsection595:
13549; O0-NEXT:    movq 8(%rdi), %rdx
13550; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13551; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13552; O0-NEXT:  .Lpcsection596:
13553; O0-NEXT:    jmp .LBB227_1
13554; O0-NEXT:  .LBB227_1: # %atomicrmw.start
13555; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13556; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
13557; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13558; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13559; O0-NEXT:    movq %rax, %rbx
13560; O0-NEXT:  .Lpcsection597:
13561; O0-NEXT:    xorq $42, %rbx
13562; O0-NEXT:    movq %rcx, %rdx
13563; O0-NEXT:  .Lpcsection598:
13564; O0-NEXT:    lock cmpxchg16b (%rsi)
13565; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13566; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13567; O0-NEXT:  .Lpcsection599:
13568; O0-NEXT:    jne .LBB227_1
13569; O0-NEXT:    jmp .LBB227_2
13570; O0-NEXT:  .LBB227_2: # %atomicrmw.end
13571; O0-NEXT:    movq $1, foo
13572; O0-NEXT:    popq %rbx
13573; O0-NEXT:    .cfi_def_cfa_offset 8
13574; O0-NEXT:    retq
13575;
13576; O1-LABEL: atomic128_xor_release:
13577; O1:       # %bb.0: # %entry
13578; O1-NEXT:    pushq %rbx
13579; O1-NEXT:    .cfi_def_cfa_offset 16
13580; O1-NEXT:    .cfi_offset %rbx, -16
13581; O1-NEXT:    movq foo(%rip), %rax
13582; O1-NEXT:  .Lpcsection530:
13583; O1-NEXT:    movq (%rdi), %rax
13584; O1-NEXT:  .Lpcsection531:
13585; O1-NEXT:    movq 8(%rdi), %rdx
13586; O1-NEXT:    .p2align 4
13587; O1-NEXT:  .LBB227_1: # %atomicrmw.start
13588; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13589; O1-NEXT:    movq %rax, %rbx
13590; O1-NEXT:  .Lpcsection532:
13591; O1-NEXT:    xorq $42, %rbx
13592; O1-NEXT:    movq %rdx, %rcx
13593; O1-NEXT:  .Lpcsection533:
13594; O1-NEXT:    lock cmpxchg16b (%rdi)
13595; O1-NEXT:  .Lpcsection534:
13596; O1-NEXT:    jne .LBB227_1
13597; O1-NEXT:  # %bb.2: # %atomicrmw.end
13598; O1-NEXT:    movq $1, foo(%rip)
13599; O1-NEXT:    popq %rbx
13600; O1-NEXT:    .cfi_def_cfa_offset 8
13601; O1-NEXT:    retq
13602;
13603; O2-LABEL: atomic128_xor_release:
13604; O2:       # %bb.0: # %entry
13605; O2-NEXT:    pushq %rbx
13606; O2-NEXT:    .cfi_def_cfa_offset 16
13607; O2-NEXT:    .cfi_offset %rbx, -16
13608; O2-NEXT:    movq foo(%rip), %rax
13609; O2-NEXT:  .Lpcsection530:
13610; O2-NEXT:    movq (%rdi), %rax
13611; O2-NEXT:  .Lpcsection531:
13612; O2-NEXT:    movq 8(%rdi), %rdx
13613; O2-NEXT:    .p2align 4
13614; O2-NEXT:  .LBB227_1: # %atomicrmw.start
13615; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13616; O2-NEXT:    movq %rax, %rbx
13617; O2-NEXT:  .Lpcsection532:
13618; O2-NEXT:    xorq $42, %rbx
13619; O2-NEXT:    movq %rdx, %rcx
13620; O2-NEXT:  .Lpcsection533:
13621; O2-NEXT:    lock cmpxchg16b (%rdi)
13622; O2-NEXT:  .Lpcsection534:
13623; O2-NEXT:    jne .LBB227_1
13624; O2-NEXT:  # %bb.2: # %atomicrmw.end
13625; O2-NEXT:    movq $1, foo(%rip)
13626; O2-NEXT:    popq %rbx
13627; O2-NEXT:    .cfi_def_cfa_offset 8
13628; O2-NEXT:    retq
13629;
13630; O3-LABEL: atomic128_xor_release:
13631; O3:       # %bb.0: # %entry
13632; O3-NEXT:    pushq %rbx
13633; O3-NEXT:    .cfi_def_cfa_offset 16
13634; O3-NEXT:    .cfi_offset %rbx, -16
13635; O3-NEXT:    movq foo(%rip), %rax
13636; O3-NEXT:  .Lpcsection530:
13637; O3-NEXT:    movq (%rdi), %rax
13638; O3-NEXT:  .Lpcsection531:
13639; O3-NEXT:    movq 8(%rdi), %rdx
13640; O3-NEXT:    .p2align 4
13641; O3-NEXT:  .LBB227_1: # %atomicrmw.start
13642; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13643; O3-NEXT:    movq %rax, %rbx
13644; O3-NEXT:  .Lpcsection532:
13645; O3-NEXT:    xorq $42, %rbx
13646; O3-NEXT:    movq %rdx, %rcx
13647; O3-NEXT:  .Lpcsection533:
13648; O3-NEXT:    lock cmpxchg16b (%rdi)
13649; O3-NEXT:  .Lpcsection534:
13650; O3-NEXT:    jne .LBB227_1
13651; O3-NEXT:  # %bb.2: # %atomicrmw.end
13652; O3-NEXT:    movq $1, foo(%rip)
13653; O3-NEXT:    popq %rbx
13654; O3-NEXT:    .cfi_def_cfa_offset 8
13655; O3-NEXT:    retq
13656entry:
13657  load volatile i64, ptr @foo, align 8
13658  %x = atomicrmw xor ptr %a, i128 42 release, align 16, !pcsections !0
13659  store volatile i64 1, ptr @foo, align 8
13660  ret void
13661}
13662
13663define void @atomic128_nand_release(ptr %a) {
13664; O0-LABEL: atomic128_nand_release:
13665; O0:       # %bb.0: # %entry
13666; O0-NEXT:    pushq %rbx
13667; O0-NEXT:    .cfi_def_cfa_offset 16
13668; O0-NEXT:    .cfi_offset %rbx, -16
13669; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13670; O0-NEXT:    movq foo(%rip), %rax
13671; O0-NEXT:  .Lpcsection600:
13672; O0-NEXT:    movq (%rdi), %rax
13673; O0-NEXT:  .Lpcsection601:
13674; O0-NEXT:    movq 8(%rdi), %rdx
13675; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13676; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13677; O0-NEXT:  .Lpcsection602:
13678; O0-NEXT:    jmp .LBB228_1
13679; O0-NEXT:  .LBB228_1: # %atomicrmw.start
13680; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13681; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13682; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13683; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13684; O0-NEXT:    movl %eax, %ecx
13685; O0-NEXT:  .Lpcsection603:
13686; O0-NEXT:    notl %ecx
13687; O0-NEXT:  .Lpcsection604:
13688; O0-NEXT:    # implicit-def: $rbx
13689; O0-NEXT:    movl %ecx, %ebx
13690; O0-NEXT:  .Lpcsection605:
13691; O0-NEXT:    orq $-43, %rbx
13692; O0-NEXT:  .Lpcsection606:
13693; O0-NEXT:    movq $-1, %rcx
13694; O0-NEXT:  .Lpcsection607:
13695; O0-NEXT:    lock cmpxchg16b (%rsi)
13696; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13697; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13698; O0-NEXT:  .Lpcsection608:
13699; O0-NEXT:    jne .LBB228_1
13700; O0-NEXT:    jmp .LBB228_2
13701; O0-NEXT:  .LBB228_2: # %atomicrmw.end
13702; O0-NEXT:    movq $1, foo
13703; O0-NEXT:    popq %rbx
13704; O0-NEXT:    .cfi_def_cfa_offset 8
13705; O0-NEXT:    retq
13706;
13707; O1-LABEL: atomic128_nand_release:
13708; O1:       # %bb.0: # %entry
13709; O1-NEXT:    pushq %rbx
13710; O1-NEXT:    .cfi_def_cfa_offset 16
13711; O1-NEXT:    .cfi_offset %rbx, -16
13712; O1-NEXT:    movq foo(%rip), %rax
13713; O1-NEXT:  .Lpcsection535:
13714; O1-NEXT:    movq (%rdi), %rax
13715; O1-NEXT:  .Lpcsection536:
13716; O1-NEXT:    movq 8(%rdi), %rdx
13717; O1-NEXT:  .Lpcsection537:
13718; O1-NEXT:    movq $-1, %rcx
13719; O1-NEXT:    .p2align 4
13720; O1-NEXT:  .LBB228_1: # %atomicrmw.start
13721; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13722; O1-NEXT:    movl %eax, %ebx
13723; O1-NEXT:  .Lpcsection538:
13724; O1-NEXT:    notl %ebx
13725; O1-NEXT:  .Lpcsection539:
13726; O1-NEXT:    orq $-43, %rbx
13727; O1-NEXT:  .Lpcsection540:
13728; O1-NEXT:    lock cmpxchg16b (%rdi)
13729; O1-NEXT:  .Lpcsection541:
13730; O1-NEXT:    jne .LBB228_1
13731; O1-NEXT:  # %bb.2: # %atomicrmw.end
13732; O1-NEXT:    movq $1, foo(%rip)
13733; O1-NEXT:    popq %rbx
13734; O1-NEXT:    .cfi_def_cfa_offset 8
13735; O1-NEXT:    retq
13736;
13737; O2-LABEL: atomic128_nand_release:
13738; O2:       # %bb.0: # %entry
13739; O2-NEXT:    pushq %rbx
13740; O2-NEXT:    .cfi_def_cfa_offset 16
13741; O2-NEXT:    .cfi_offset %rbx, -16
13742; O2-NEXT:    movq foo(%rip), %rax
13743; O2-NEXT:  .Lpcsection535:
13744; O2-NEXT:    movq (%rdi), %rax
13745; O2-NEXT:  .Lpcsection536:
13746; O2-NEXT:    movq 8(%rdi), %rdx
13747; O2-NEXT:  .Lpcsection537:
13748; O2-NEXT:    movq $-1, %rcx
13749; O2-NEXT:    .p2align 4
13750; O2-NEXT:  .LBB228_1: # %atomicrmw.start
13751; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13752; O2-NEXT:    movl %eax, %ebx
13753; O2-NEXT:  .Lpcsection538:
13754; O2-NEXT:    notl %ebx
13755; O2-NEXT:  .Lpcsection539:
13756; O2-NEXT:    orq $-43, %rbx
13757; O2-NEXT:  .Lpcsection540:
13758; O2-NEXT:    lock cmpxchg16b (%rdi)
13759; O2-NEXT:  .Lpcsection541:
13760; O2-NEXT:    jne .LBB228_1
13761; O2-NEXT:  # %bb.2: # %atomicrmw.end
13762; O2-NEXT:    movq $1, foo(%rip)
13763; O2-NEXT:    popq %rbx
13764; O2-NEXT:    .cfi_def_cfa_offset 8
13765; O2-NEXT:    retq
13766;
13767; O3-LABEL: atomic128_nand_release:
13768; O3:       # %bb.0: # %entry
13769; O3-NEXT:    pushq %rbx
13770; O3-NEXT:    .cfi_def_cfa_offset 16
13771; O3-NEXT:    .cfi_offset %rbx, -16
13772; O3-NEXT:    movq foo(%rip), %rax
13773; O3-NEXT:  .Lpcsection535:
13774; O3-NEXT:    movq (%rdi), %rax
13775; O3-NEXT:  .Lpcsection536:
13776; O3-NEXT:    movq 8(%rdi), %rdx
13777; O3-NEXT:  .Lpcsection537:
13778; O3-NEXT:    movq $-1, %rcx
13779; O3-NEXT:    .p2align 4
13780; O3-NEXT:  .LBB228_1: # %atomicrmw.start
13781; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13782; O3-NEXT:    movl %eax, %ebx
13783; O3-NEXT:  .Lpcsection538:
13784; O3-NEXT:    notl %ebx
13785; O3-NEXT:  .Lpcsection539:
13786; O3-NEXT:    orq $-43, %rbx
13787; O3-NEXT:  .Lpcsection540:
13788; O3-NEXT:    lock cmpxchg16b (%rdi)
13789; O3-NEXT:  .Lpcsection541:
13790; O3-NEXT:    jne .LBB228_1
13791; O3-NEXT:  # %bb.2: # %atomicrmw.end
13792; O3-NEXT:    movq $1, foo(%rip)
13793; O3-NEXT:    popq %rbx
13794; O3-NEXT:    .cfi_def_cfa_offset 8
13795; O3-NEXT:    retq
13796entry:
13797  load volatile i64, ptr @foo, align 8
13798  %x = atomicrmw nand ptr %a, i128 42 release, align 16, !pcsections !0
13799  store volatile i64 1, ptr @foo, align 8
13800  ret void
13801}
13802
13803define void @atomic128_xchg_acq_rel(ptr %a) {
13804; O0-LABEL: atomic128_xchg_acq_rel:
13805; O0:       # %bb.0: # %entry
13806; O0-NEXT:    pushq %rbx
13807; O0-NEXT:    .cfi_def_cfa_offset 16
13808; O0-NEXT:    .cfi_offset %rbx, -16
13809; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13810; O0-NEXT:    movq foo(%rip), %rax
13811; O0-NEXT:  .Lpcsection609:
13812; O0-NEXT:    movq (%rdi), %rax
13813; O0-NEXT:  .Lpcsection610:
13814; O0-NEXT:    movq 8(%rdi), %rdx
13815; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13816; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13817; O0-NEXT:  .Lpcsection611:
13818; O0-NEXT:    jmp .LBB229_1
13819; O0-NEXT:  .LBB229_1: # %atomicrmw.start
13820; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13821; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13822; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13823; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13824; O0-NEXT:  .Lpcsection612:
13825; O0-NEXT:    xorl %ecx, %ecx
13826; O0-NEXT:  .Lpcsection613:
13827; O0-NEXT:    # kill: def $rcx killed $ecx
13828; O0-NEXT:  .Lpcsection614:
13829; O0-NEXT:    movl $42, %ebx
13830; O0-NEXT:  .Lpcsection615:
13831; O0-NEXT:    lock cmpxchg16b (%rsi)
13832; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13833; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13834; O0-NEXT:  .Lpcsection616:
13835; O0-NEXT:    jne .LBB229_1
13836; O0-NEXT:    jmp .LBB229_2
13837; O0-NEXT:  .LBB229_2: # %atomicrmw.end
13838; O0-NEXT:    movq $1, foo
13839; O0-NEXT:    popq %rbx
13840; O0-NEXT:    .cfi_def_cfa_offset 8
13841; O0-NEXT:    retq
13842;
13843; O1-LABEL: atomic128_xchg_acq_rel:
13844; O1:       # %bb.0: # %entry
13845; O1-NEXT:    pushq %rbx
13846; O1-NEXT:    .cfi_def_cfa_offset 16
13847; O1-NEXT:    .cfi_offset %rbx, -16
13848; O1-NEXT:    movq foo(%rip), %rax
13849; O1-NEXT:  .Lpcsection542:
13850; O1-NEXT:    movq (%rdi), %rax
13851; O1-NEXT:  .Lpcsection543:
13852; O1-NEXT:    movq 8(%rdi), %rdx
13853; O1-NEXT:  .Lpcsection544:
13854; O1-NEXT:    movl $42, %ebx
13855; O1-NEXT:    .p2align 4
13856; O1-NEXT:  .LBB229_1: # %atomicrmw.start
13857; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13858; O1-NEXT:  .Lpcsection545:
13859; O1-NEXT:    xorl %ecx, %ecx
13860; O1-NEXT:  .Lpcsection546:
13861; O1-NEXT:    lock cmpxchg16b (%rdi)
13862; O1-NEXT:  .Lpcsection547:
13863; O1-NEXT:    jne .LBB229_1
13864; O1-NEXT:  # %bb.2: # %atomicrmw.end
13865; O1-NEXT:    movq $1, foo(%rip)
13866; O1-NEXT:    popq %rbx
13867; O1-NEXT:    .cfi_def_cfa_offset 8
13868; O1-NEXT:    retq
13869;
13870; O2-LABEL: atomic128_xchg_acq_rel:
13871; O2:       # %bb.0: # %entry
13872; O2-NEXT:    pushq %rbx
13873; O2-NEXT:    .cfi_def_cfa_offset 16
13874; O2-NEXT:    .cfi_offset %rbx, -16
13875; O2-NEXT:    movq foo(%rip), %rax
13876; O2-NEXT:  .Lpcsection542:
13877; O2-NEXT:    movq (%rdi), %rax
13878; O2-NEXT:  .Lpcsection543:
13879; O2-NEXT:    movq 8(%rdi), %rdx
13880; O2-NEXT:  .Lpcsection544:
13881; O2-NEXT:    movl $42, %ebx
13882; O2-NEXT:    .p2align 4
13883; O2-NEXT:  .LBB229_1: # %atomicrmw.start
13884; O2-NEXT:    # =>This Inner Loop Header: Depth=1
13885; O2-NEXT:  .Lpcsection545:
13886; O2-NEXT:    xorl %ecx, %ecx
13887; O2-NEXT:  .Lpcsection546:
13888; O2-NEXT:    lock cmpxchg16b (%rdi)
13889; O2-NEXT:  .Lpcsection547:
13890; O2-NEXT:    jne .LBB229_1
13891; O2-NEXT:  # %bb.2: # %atomicrmw.end
13892; O2-NEXT:    movq $1, foo(%rip)
13893; O2-NEXT:    popq %rbx
13894; O2-NEXT:    .cfi_def_cfa_offset 8
13895; O2-NEXT:    retq
13896;
13897; O3-LABEL: atomic128_xchg_acq_rel:
13898; O3:       # %bb.0: # %entry
13899; O3-NEXT:    pushq %rbx
13900; O3-NEXT:    .cfi_def_cfa_offset 16
13901; O3-NEXT:    .cfi_offset %rbx, -16
13902; O3-NEXT:    movq foo(%rip), %rax
13903; O3-NEXT:  .Lpcsection542:
13904; O3-NEXT:    movq (%rdi), %rax
13905; O3-NEXT:  .Lpcsection543:
13906; O3-NEXT:    movq 8(%rdi), %rdx
13907; O3-NEXT:  .Lpcsection544:
13908; O3-NEXT:    movl $42, %ebx
13909; O3-NEXT:    .p2align 4
13910; O3-NEXT:  .LBB229_1: # %atomicrmw.start
13911; O3-NEXT:    # =>This Inner Loop Header: Depth=1
13912; O3-NEXT:  .Lpcsection545:
13913; O3-NEXT:    xorl %ecx, %ecx
13914; O3-NEXT:  .Lpcsection546:
13915; O3-NEXT:    lock cmpxchg16b (%rdi)
13916; O3-NEXT:  .Lpcsection547:
13917; O3-NEXT:    jne .LBB229_1
13918; O3-NEXT:  # %bb.2: # %atomicrmw.end
13919; O3-NEXT:    movq $1, foo(%rip)
13920; O3-NEXT:    popq %rbx
13921; O3-NEXT:    .cfi_def_cfa_offset 8
13922; O3-NEXT:    retq
13923entry:
13924  load volatile i64, ptr @foo, align 8
13925  %x = atomicrmw xchg ptr %a, i128 42 acq_rel, align 16, !pcsections !0
13926  store volatile i64 1, ptr @foo, align 8
13927  ret void
13928}
13929
13930define void @atomic128_add_acq_rel(ptr %a) {
13931; O0-LABEL: atomic128_add_acq_rel:
13932; O0:       # %bb.0: # %entry
13933; O0-NEXT:    pushq %rbx
13934; O0-NEXT:    .cfi_def_cfa_offset 16
13935; O0-NEXT:    .cfi_offset %rbx, -16
13936; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13937; O0-NEXT:    movq foo(%rip), %rax
13938; O0-NEXT:  .Lpcsection617:
13939; O0-NEXT:    movq (%rdi), %rax
13940; O0-NEXT:  .Lpcsection618:
13941; O0-NEXT:    movq 8(%rdi), %rdx
13942; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13943; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13944; O0-NEXT:  .Lpcsection619:
13945; O0-NEXT:    jmp .LBB230_1
13946; O0-NEXT:  .LBB230_1: # %atomicrmw.start
13947; O0-NEXT:    # =>This Inner Loop Header: Depth=1
13948; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
13949; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
13950; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
13951; O0-NEXT:    movq %rax, %rbx
13952; O0-NEXT:  .Lpcsection620:
13953; O0-NEXT:    addq $42, %rbx
13954; O0-NEXT:    movq %rdx, %rcx
13955; O0-NEXT:  .Lpcsection621:
13956; O0-NEXT:    adcq $0, %rcx
13957; O0-NEXT:  .Lpcsection622:
13958; O0-NEXT:    lock cmpxchg16b (%rsi)
13959; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13960; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
13961; O0-NEXT:  .Lpcsection623:
13962; O0-NEXT:    jne .LBB230_1
13963; O0-NEXT:    jmp .LBB230_2
13964; O0-NEXT:  .LBB230_2: # %atomicrmw.end
13965; O0-NEXT:    movq $1, foo
13966; O0-NEXT:    popq %rbx
13967; O0-NEXT:    .cfi_def_cfa_offset 8
13968; O0-NEXT:    retq
13969;
13970; O1-LABEL: atomic128_add_acq_rel:
13971; O1:       # %bb.0: # %entry
13972; O1-NEXT:    pushq %rbx
13973; O1-NEXT:    .cfi_def_cfa_offset 16
13974; O1-NEXT:    .cfi_offset %rbx, -16
13975; O1-NEXT:    movq foo(%rip), %rax
13976; O1-NEXT:  .Lpcsection548:
13977; O1-NEXT:    movq (%rdi), %rax
13978; O1-NEXT:  .Lpcsection549:
13979; O1-NEXT:    movq 8(%rdi), %rdx
13980; O1-NEXT:    .p2align 4
13981; O1-NEXT:  .LBB230_1: # %atomicrmw.start
13982; O1-NEXT:    # =>This Inner Loop Header: Depth=1
13983; O1-NEXT:    movq %rax, %rbx
13984; O1-NEXT:  .Lpcsection550:
13985; O1-NEXT:    addq $42, %rbx
13986; O1-NEXT:    movq %rdx, %rcx
13987; O1-NEXT:  .Lpcsection551:
13988; O1-NEXT:    adcq $0, %rcx
13989; O1-NEXT:  .Lpcsection552:
13990; O1-NEXT:    lock cmpxchg16b (%rdi)
13991; O1-NEXT:  .Lpcsection553:
13992; O1-NEXT:    jne .LBB230_1
13993; O1-NEXT:  # %bb.2: # %atomicrmw.end
13994; O1-NEXT:    movq $1, foo(%rip)
13995; O1-NEXT:    popq %rbx
13996; O1-NEXT:    .cfi_def_cfa_offset 8
13997; O1-NEXT:    retq
13998;
13999; O2-LABEL: atomic128_add_acq_rel:
14000; O2:       # %bb.0: # %entry
14001; O2-NEXT:    pushq %rbx
14002; O2-NEXT:    .cfi_def_cfa_offset 16
14003; O2-NEXT:    .cfi_offset %rbx, -16
14004; O2-NEXT:    movq foo(%rip), %rax
14005; O2-NEXT:  .Lpcsection548:
14006; O2-NEXT:    movq (%rdi), %rax
14007; O2-NEXT:  .Lpcsection549:
14008; O2-NEXT:    movq 8(%rdi), %rdx
14009; O2-NEXT:    .p2align 4
14010; O2-NEXT:  .LBB230_1: # %atomicrmw.start
14011; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14012; O2-NEXT:    movq %rax, %rbx
14013; O2-NEXT:  .Lpcsection550:
14014; O2-NEXT:    addq $42, %rbx
14015; O2-NEXT:    movq %rdx, %rcx
14016; O2-NEXT:  .Lpcsection551:
14017; O2-NEXT:    adcq $0, %rcx
14018; O2-NEXT:  .Lpcsection552:
14019; O2-NEXT:    lock cmpxchg16b (%rdi)
14020; O2-NEXT:  .Lpcsection553:
14021; O2-NEXT:    jne .LBB230_1
14022; O2-NEXT:  # %bb.2: # %atomicrmw.end
14023; O2-NEXT:    movq $1, foo(%rip)
14024; O2-NEXT:    popq %rbx
14025; O2-NEXT:    .cfi_def_cfa_offset 8
14026; O2-NEXT:    retq
14027;
14028; O3-LABEL: atomic128_add_acq_rel:
14029; O3:       # %bb.0: # %entry
14030; O3-NEXT:    pushq %rbx
14031; O3-NEXT:    .cfi_def_cfa_offset 16
14032; O3-NEXT:    .cfi_offset %rbx, -16
14033; O3-NEXT:    movq foo(%rip), %rax
14034; O3-NEXT:  .Lpcsection548:
14035; O3-NEXT:    movq (%rdi), %rax
14036; O3-NEXT:  .Lpcsection549:
14037; O3-NEXT:    movq 8(%rdi), %rdx
14038; O3-NEXT:    .p2align 4
14039; O3-NEXT:  .LBB230_1: # %atomicrmw.start
14040; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14041; O3-NEXT:    movq %rax, %rbx
14042; O3-NEXT:  .Lpcsection550:
14043; O3-NEXT:    addq $42, %rbx
14044; O3-NEXT:    movq %rdx, %rcx
14045; O3-NEXT:  .Lpcsection551:
14046; O3-NEXT:    adcq $0, %rcx
14047; O3-NEXT:  .Lpcsection552:
14048; O3-NEXT:    lock cmpxchg16b (%rdi)
14049; O3-NEXT:  .Lpcsection553:
14050; O3-NEXT:    jne .LBB230_1
14051; O3-NEXT:  # %bb.2: # %atomicrmw.end
14052; O3-NEXT:    movq $1, foo(%rip)
14053; O3-NEXT:    popq %rbx
14054; O3-NEXT:    .cfi_def_cfa_offset 8
14055; O3-NEXT:    retq
14056entry:
14057  load volatile i64, ptr @foo, align 8
14058  %x = atomicrmw add ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14059  store volatile i64 1, ptr @foo, align 8
14060  ret void
14061}
14062
14063define void @atomic128_sub_acq_rel(ptr %a) {
14064; O0-LABEL: atomic128_sub_acq_rel:
14065; O0:       # %bb.0: # %entry
14066; O0-NEXT:    pushq %rbx
14067; O0-NEXT:    .cfi_def_cfa_offset 16
14068; O0-NEXT:    .cfi_offset %rbx, -16
14069; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14070; O0-NEXT:    movq foo(%rip), %rax
14071; O0-NEXT:  .Lpcsection624:
14072; O0-NEXT:    movq (%rdi), %rax
14073; O0-NEXT:  .Lpcsection625:
14074; O0-NEXT:    movq 8(%rdi), %rdx
14075; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14076; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14077; O0-NEXT:  .Lpcsection626:
14078; O0-NEXT:    jmp .LBB231_1
14079; O0-NEXT:  .LBB231_1: # %atomicrmw.start
14080; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14081; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14082; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14083; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14084; O0-NEXT:    movq %rax, %rbx
14085; O0-NEXT:  .Lpcsection627:
14086; O0-NEXT:    addq $-42, %rbx
14087; O0-NEXT:    movq %rdx, %rcx
14088; O0-NEXT:  .Lpcsection628:
14089; O0-NEXT:    adcq $-1, %rcx
14090; O0-NEXT:  .Lpcsection629:
14091; O0-NEXT:    lock cmpxchg16b (%rsi)
14092; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14093; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14094; O0-NEXT:  .Lpcsection630:
14095; O0-NEXT:    jne .LBB231_1
14096; O0-NEXT:    jmp .LBB231_2
14097; O0-NEXT:  .LBB231_2: # %atomicrmw.end
14098; O0-NEXT:    movq $1, foo
14099; O0-NEXT:    popq %rbx
14100; O0-NEXT:    .cfi_def_cfa_offset 8
14101; O0-NEXT:    retq
14102;
14103; O1-LABEL: atomic128_sub_acq_rel:
14104; O1:       # %bb.0: # %entry
14105; O1-NEXT:    pushq %rbx
14106; O1-NEXT:    .cfi_def_cfa_offset 16
14107; O1-NEXT:    .cfi_offset %rbx, -16
14108; O1-NEXT:    movq foo(%rip), %rax
14109; O1-NEXT:  .Lpcsection554:
14110; O1-NEXT:    movq (%rdi), %rax
14111; O1-NEXT:  .Lpcsection555:
14112; O1-NEXT:    movq 8(%rdi), %rdx
14113; O1-NEXT:    .p2align 4
14114; O1-NEXT:  .LBB231_1: # %atomicrmw.start
14115; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14116; O1-NEXT:    movq %rax, %rbx
14117; O1-NEXT:  .Lpcsection556:
14118; O1-NEXT:    addq $-42, %rbx
14119; O1-NEXT:    movq %rdx, %rcx
14120; O1-NEXT:  .Lpcsection557:
14121; O1-NEXT:    adcq $-1, %rcx
14122; O1-NEXT:  .Lpcsection558:
14123; O1-NEXT:    lock cmpxchg16b (%rdi)
14124; O1-NEXT:  .Lpcsection559:
14125; O1-NEXT:    jne .LBB231_1
14126; O1-NEXT:  # %bb.2: # %atomicrmw.end
14127; O1-NEXT:    movq $1, foo(%rip)
14128; O1-NEXT:    popq %rbx
14129; O1-NEXT:    .cfi_def_cfa_offset 8
14130; O1-NEXT:    retq
14131;
14132; O2-LABEL: atomic128_sub_acq_rel:
14133; O2:       # %bb.0: # %entry
14134; O2-NEXT:    pushq %rbx
14135; O2-NEXT:    .cfi_def_cfa_offset 16
14136; O2-NEXT:    .cfi_offset %rbx, -16
14137; O2-NEXT:    movq foo(%rip), %rax
14138; O2-NEXT:  .Lpcsection554:
14139; O2-NEXT:    movq (%rdi), %rax
14140; O2-NEXT:  .Lpcsection555:
14141; O2-NEXT:    movq 8(%rdi), %rdx
14142; O2-NEXT:    .p2align 4
14143; O2-NEXT:  .LBB231_1: # %atomicrmw.start
14144; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14145; O2-NEXT:    movq %rax, %rbx
14146; O2-NEXT:  .Lpcsection556:
14147; O2-NEXT:    addq $-42, %rbx
14148; O2-NEXT:    movq %rdx, %rcx
14149; O2-NEXT:  .Lpcsection557:
14150; O2-NEXT:    adcq $-1, %rcx
14151; O2-NEXT:  .Lpcsection558:
14152; O2-NEXT:    lock cmpxchg16b (%rdi)
14153; O2-NEXT:  .Lpcsection559:
14154; O2-NEXT:    jne .LBB231_1
14155; O2-NEXT:  # %bb.2: # %atomicrmw.end
14156; O2-NEXT:    movq $1, foo(%rip)
14157; O2-NEXT:    popq %rbx
14158; O2-NEXT:    .cfi_def_cfa_offset 8
14159; O2-NEXT:    retq
14160;
14161; O3-LABEL: atomic128_sub_acq_rel:
14162; O3:       # %bb.0: # %entry
14163; O3-NEXT:    pushq %rbx
14164; O3-NEXT:    .cfi_def_cfa_offset 16
14165; O3-NEXT:    .cfi_offset %rbx, -16
14166; O3-NEXT:    movq foo(%rip), %rax
14167; O3-NEXT:  .Lpcsection554:
14168; O3-NEXT:    movq (%rdi), %rax
14169; O3-NEXT:  .Lpcsection555:
14170; O3-NEXT:    movq 8(%rdi), %rdx
14171; O3-NEXT:    .p2align 4
14172; O3-NEXT:  .LBB231_1: # %atomicrmw.start
14173; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14174; O3-NEXT:    movq %rax, %rbx
14175; O3-NEXT:  .Lpcsection556:
14176; O3-NEXT:    addq $-42, %rbx
14177; O3-NEXT:    movq %rdx, %rcx
14178; O3-NEXT:  .Lpcsection557:
14179; O3-NEXT:    adcq $-1, %rcx
14180; O3-NEXT:  .Lpcsection558:
14181; O3-NEXT:    lock cmpxchg16b (%rdi)
14182; O3-NEXT:  .Lpcsection559:
14183; O3-NEXT:    jne .LBB231_1
14184; O3-NEXT:  # %bb.2: # %atomicrmw.end
14185; O3-NEXT:    movq $1, foo(%rip)
14186; O3-NEXT:    popq %rbx
14187; O3-NEXT:    .cfi_def_cfa_offset 8
14188; O3-NEXT:    retq
14189entry:
14190  load volatile i64, ptr @foo, align 8
14191  %x = atomicrmw sub ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14192  store volatile i64 1, ptr @foo, align 8
14193  ret void
14194}
14195
14196define void @atomic128_and_acq_rel(ptr %a) {
14197; O0-LABEL: atomic128_and_acq_rel:
14198; O0:       # %bb.0: # %entry
14199; O0-NEXT:    pushq %rbx
14200; O0-NEXT:    .cfi_def_cfa_offset 16
14201; O0-NEXT:    .cfi_offset %rbx, -16
14202; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14203; O0-NEXT:    movq foo(%rip), %rax
14204; O0-NEXT:  .Lpcsection631:
14205; O0-NEXT:    movq (%rdi), %rax
14206; O0-NEXT:  .Lpcsection632:
14207; O0-NEXT:    movq 8(%rdi), %rdx
14208; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14209; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14210; O0-NEXT:  .Lpcsection633:
14211; O0-NEXT:    jmp .LBB232_1
14212; O0-NEXT:  .LBB232_1: # %atomicrmw.start
14213; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14214; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14215; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14216; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14217; O0-NEXT:    movl %eax, %ecx
14218; O0-NEXT:  .Lpcsection634:
14219; O0-NEXT:    andl $42, %ecx
14220; O0-NEXT:    movl %ecx, %ebx
14221; O0-NEXT:  .Lpcsection635:
14222; O0-NEXT:    xorl %ecx, %ecx
14223; O0-NEXT:  .Lpcsection636:
14224; O0-NEXT:    # kill: def $rcx killed $ecx
14225; O0-NEXT:  .Lpcsection637:
14226; O0-NEXT:    lock cmpxchg16b (%rsi)
14227; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14228; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14229; O0-NEXT:  .Lpcsection638:
14230; O0-NEXT:    jne .LBB232_1
14231; O0-NEXT:    jmp .LBB232_2
14232; O0-NEXT:  .LBB232_2: # %atomicrmw.end
14233; O0-NEXT:    movq $1, foo
14234; O0-NEXT:    popq %rbx
14235; O0-NEXT:    .cfi_def_cfa_offset 8
14236; O0-NEXT:    retq
14237;
14238; O1-LABEL: atomic128_and_acq_rel:
14239; O1:       # %bb.0: # %entry
14240; O1-NEXT:    pushq %rbx
14241; O1-NEXT:    .cfi_def_cfa_offset 16
14242; O1-NEXT:    .cfi_offset %rbx, -16
14243; O1-NEXT:    movq foo(%rip), %rax
14244; O1-NEXT:  .Lpcsection560:
14245; O1-NEXT:    movq (%rdi), %rax
14246; O1-NEXT:  .Lpcsection561:
14247; O1-NEXT:    movq 8(%rdi), %rdx
14248; O1-NEXT:    .p2align 4
14249; O1-NEXT:  .LBB232_1: # %atomicrmw.start
14250; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14251; O1-NEXT:    movl %eax, %ebx
14252; O1-NEXT:  .Lpcsection562:
14253; O1-NEXT:    andl $42, %ebx
14254; O1-NEXT:  .Lpcsection563:
14255; O1-NEXT:    xorl %ecx, %ecx
14256; O1-NEXT:  .Lpcsection564:
14257; O1-NEXT:    lock cmpxchg16b (%rdi)
14258; O1-NEXT:  .Lpcsection565:
14259; O1-NEXT:    jne .LBB232_1
14260; O1-NEXT:  # %bb.2: # %atomicrmw.end
14261; O1-NEXT:    movq $1, foo(%rip)
14262; O1-NEXT:    popq %rbx
14263; O1-NEXT:    .cfi_def_cfa_offset 8
14264; O1-NEXT:    retq
14265;
14266; O2-LABEL: atomic128_and_acq_rel:
14267; O2:       # %bb.0: # %entry
14268; O2-NEXT:    pushq %rbx
14269; O2-NEXT:    .cfi_def_cfa_offset 16
14270; O2-NEXT:    .cfi_offset %rbx, -16
14271; O2-NEXT:    movq foo(%rip), %rax
14272; O2-NEXT:  .Lpcsection560:
14273; O2-NEXT:    movq (%rdi), %rax
14274; O2-NEXT:  .Lpcsection561:
14275; O2-NEXT:    movq 8(%rdi), %rdx
14276; O2-NEXT:    .p2align 4
14277; O2-NEXT:  .LBB232_1: # %atomicrmw.start
14278; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14279; O2-NEXT:    movl %eax, %ebx
14280; O2-NEXT:  .Lpcsection562:
14281; O2-NEXT:    andl $42, %ebx
14282; O2-NEXT:  .Lpcsection563:
14283; O2-NEXT:    xorl %ecx, %ecx
14284; O2-NEXT:  .Lpcsection564:
14285; O2-NEXT:    lock cmpxchg16b (%rdi)
14286; O2-NEXT:  .Lpcsection565:
14287; O2-NEXT:    jne .LBB232_1
14288; O2-NEXT:  # %bb.2: # %atomicrmw.end
14289; O2-NEXT:    movq $1, foo(%rip)
14290; O2-NEXT:    popq %rbx
14291; O2-NEXT:    .cfi_def_cfa_offset 8
14292; O2-NEXT:    retq
14293;
14294; O3-LABEL: atomic128_and_acq_rel:
14295; O3:       # %bb.0: # %entry
14296; O3-NEXT:    pushq %rbx
14297; O3-NEXT:    .cfi_def_cfa_offset 16
14298; O3-NEXT:    .cfi_offset %rbx, -16
14299; O3-NEXT:    movq foo(%rip), %rax
14300; O3-NEXT:  .Lpcsection560:
14301; O3-NEXT:    movq (%rdi), %rax
14302; O3-NEXT:  .Lpcsection561:
14303; O3-NEXT:    movq 8(%rdi), %rdx
14304; O3-NEXT:    .p2align 4
14305; O3-NEXT:  .LBB232_1: # %atomicrmw.start
14306; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14307; O3-NEXT:    movl %eax, %ebx
14308; O3-NEXT:  .Lpcsection562:
14309; O3-NEXT:    andl $42, %ebx
14310; O3-NEXT:  .Lpcsection563:
14311; O3-NEXT:    xorl %ecx, %ecx
14312; O3-NEXT:  .Lpcsection564:
14313; O3-NEXT:    lock cmpxchg16b (%rdi)
14314; O3-NEXT:  .Lpcsection565:
14315; O3-NEXT:    jne .LBB232_1
14316; O3-NEXT:  # %bb.2: # %atomicrmw.end
14317; O3-NEXT:    movq $1, foo(%rip)
14318; O3-NEXT:    popq %rbx
14319; O3-NEXT:    .cfi_def_cfa_offset 8
14320; O3-NEXT:    retq
14321entry:
14322  load volatile i64, ptr @foo, align 8
14323  %x = atomicrmw and ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14324  store volatile i64 1, ptr @foo, align 8
14325  ret void
14326}
14327
14328define void @atomic128_or_acq_rel(ptr %a) {
14329; O0-LABEL: atomic128_or_acq_rel:
14330; O0:       # %bb.0: # %entry
14331; O0-NEXT:    pushq %rbx
14332; O0-NEXT:    .cfi_def_cfa_offset 16
14333; O0-NEXT:    .cfi_offset %rbx, -16
14334; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14335; O0-NEXT:    movq foo(%rip), %rax
14336; O0-NEXT:  .Lpcsection639:
14337; O0-NEXT:    movq (%rdi), %rax
14338; O0-NEXT:  .Lpcsection640:
14339; O0-NEXT:    movq 8(%rdi), %rdx
14340; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14341; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14342; O0-NEXT:  .Lpcsection641:
14343; O0-NEXT:    jmp .LBB233_1
14344; O0-NEXT:  .LBB233_1: # %atomicrmw.start
14345; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14346; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
14347; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14348; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14349; O0-NEXT:    movq %rax, %rbx
14350; O0-NEXT:  .Lpcsection642:
14351; O0-NEXT:    orq $42, %rbx
14352; O0-NEXT:    movq %rcx, %rdx
14353; O0-NEXT:  .Lpcsection643:
14354; O0-NEXT:    lock cmpxchg16b (%rsi)
14355; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14356; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14357; O0-NEXT:  .Lpcsection644:
14358; O0-NEXT:    jne .LBB233_1
14359; O0-NEXT:    jmp .LBB233_2
14360; O0-NEXT:  .LBB233_2: # %atomicrmw.end
14361; O0-NEXT:    movq $1, foo
14362; O0-NEXT:    popq %rbx
14363; O0-NEXT:    .cfi_def_cfa_offset 8
14364; O0-NEXT:    retq
14365;
14366; O1-LABEL: atomic128_or_acq_rel:
14367; O1:       # %bb.0: # %entry
14368; O1-NEXT:    pushq %rbx
14369; O1-NEXT:    .cfi_def_cfa_offset 16
14370; O1-NEXT:    .cfi_offset %rbx, -16
14371; O1-NEXT:    movq foo(%rip), %rax
14372; O1-NEXT:  .Lpcsection566:
14373; O1-NEXT:    movq (%rdi), %rax
14374; O1-NEXT:  .Lpcsection567:
14375; O1-NEXT:    movq 8(%rdi), %rdx
14376; O1-NEXT:    .p2align 4
14377; O1-NEXT:  .LBB233_1: # %atomicrmw.start
14378; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14379; O1-NEXT:    movq %rax, %rbx
14380; O1-NEXT:  .Lpcsection568:
14381; O1-NEXT:    orq $42, %rbx
14382; O1-NEXT:    movq %rdx, %rcx
14383; O1-NEXT:  .Lpcsection569:
14384; O1-NEXT:    lock cmpxchg16b (%rdi)
14385; O1-NEXT:  .Lpcsection570:
14386; O1-NEXT:    jne .LBB233_1
14387; O1-NEXT:  # %bb.2: # %atomicrmw.end
14388; O1-NEXT:    movq $1, foo(%rip)
14389; O1-NEXT:    popq %rbx
14390; O1-NEXT:    .cfi_def_cfa_offset 8
14391; O1-NEXT:    retq
14392;
14393; O2-LABEL: atomic128_or_acq_rel:
14394; O2:       # %bb.0: # %entry
14395; O2-NEXT:    pushq %rbx
14396; O2-NEXT:    .cfi_def_cfa_offset 16
14397; O2-NEXT:    .cfi_offset %rbx, -16
14398; O2-NEXT:    movq foo(%rip), %rax
14399; O2-NEXT:  .Lpcsection566:
14400; O2-NEXT:    movq (%rdi), %rax
14401; O2-NEXT:  .Lpcsection567:
14402; O2-NEXT:    movq 8(%rdi), %rdx
14403; O2-NEXT:    .p2align 4
14404; O2-NEXT:  .LBB233_1: # %atomicrmw.start
14405; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14406; O2-NEXT:    movq %rax, %rbx
14407; O2-NEXT:  .Lpcsection568:
14408; O2-NEXT:    orq $42, %rbx
14409; O2-NEXT:    movq %rdx, %rcx
14410; O2-NEXT:  .Lpcsection569:
14411; O2-NEXT:    lock cmpxchg16b (%rdi)
14412; O2-NEXT:  .Lpcsection570:
14413; O2-NEXT:    jne .LBB233_1
14414; O2-NEXT:  # %bb.2: # %atomicrmw.end
14415; O2-NEXT:    movq $1, foo(%rip)
14416; O2-NEXT:    popq %rbx
14417; O2-NEXT:    .cfi_def_cfa_offset 8
14418; O2-NEXT:    retq
14419;
14420; O3-LABEL: atomic128_or_acq_rel:
14421; O3:       # %bb.0: # %entry
14422; O3-NEXT:    pushq %rbx
14423; O3-NEXT:    .cfi_def_cfa_offset 16
14424; O3-NEXT:    .cfi_offset %rbx, -16
14425; O3-NEXT:    movq foo(%rip), %rax
14426; O3-NEXT:  .Lpcsection566:
14427; O3-NEXT:    movq (%rdi), %rax
14428; O3-NEXT:  .Lpcsection567:
14429; O3-NEXT:    movq 8(%rdi), %rdx
14430; O3-NEXT:    .p2align 4
14431; O3-NEXT:  .LBB233_1: # %atomicrmw.start
14432; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14433; O3-NEXT:    movq %rax, %rbx
14434; O3-NEXT:  .Lpcsection568:
14435; O3-NEXT:    orq $42, %rbx
14436; O3-NEXT:    movq %rdx, %rcx
14437; O3-NEXT:  .Lpcsection569:
14438; O3-NEXT:    lock cmpxchg16b (%rdi)
14439; O3-NEXT:  .Lpcsection570:
14440; O3-NEXT:    jne .LBB233_1
14441; O3-NEXT:  # %bb.2: # %atomicrmw.end
14442; O3-NEXT:    movq $1, foo(%rip)
14443; O3-NEXT:    popq %rbx
14444; O3-NEXT:    .cfi_def_cfa_offset 8
14445; O3-NEXT:    retq
14446entry:
14447  load volatile i64, ptr @foo, align 8
14448  %x = atomicrmw or ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14449  store volatile i64 1, ptr @foo, align 8
14450  ret void
14451}
14452
14453define void @atomic128_xor_acq_rel(ptr %a) {
14454; O0-LABEL: atomic128_xor_acq_rel:
14455; O0:       # %bb.0: # %entry
14456; O0-NEXT:    pushq %rbx
14457; O0-NEXT:    .cfi_def_cfa_offset 16
14458; O0-NEXT:    .cfi_offset %rbx, -16
14459; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14460; O0-NEXT:    movq foo(%rip), %rax
14461; O0-NEXT:  .Lpcsection645:
14462; O0-NEXT:    movq (%rdi), %rax
14463; O0-NEXT:  .Lpcsection646:
14464; O0-NEXT:    movq 8(%rdi), %rdx
14465; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14466; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14467; O0-NEXT:  .Lpcsection647:
14468; O0-NEXT:    jmp .LBB234_1
14469; O0-NEXT:  .LBB234_1: # %atomicrmw.start
14470; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14471; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
14472; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14473; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14474; O0-NEXT:    movq %rax, %rbx
14475; O0-NEXT:  .Lpcsection648:
14476; O0-NEXT:    xorq $42, %rbx
14477; O0-NEXT:    movq %rcx, %rdx
14478; O0-NEXT:  .Lpcsection649:
14479; O0-NEXT:    lock cmpxchg16b (%rsi)
14480; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14481; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14482; O0-NEXT:  .Lpcsection650:
14483; O0-NEXT:    jne .LBB234_1
14484; O0-NEXT:    jmp .LBB234_2
14485; O0-NEXT:  .LBB234_2: # %atomicrmw.end
14486; O0-NEXT:    movq $1, foo
14487; O0-NEXT:    popq %rbx
14488; O0-NEXT:    .cfi_def_cfa_offset 8
14489; O0-NEXT:    retq
14490;
14491; O1-LABEL: atomic128_xor_acq_rel:
14492; O1:       # %bb.0: # %entry
14493; O1-NEXT:    pushq %rbx
14494; O1-NEXT:    .cfi_def_cfa_offset 16
14495; O1-NEXT:    .cfi_offset %rbx, -16
14496; O1-NEXT:    movq foo(%rip), %rax
14497; O1-NEXT:  .Lpcsection571:
14498; O1-NEXT:    movq (%rdi), %rax
14499; O1-NEXT:  .Lpcsection572:
14500; O1-NEXT:    movq 8(%rdi), %rdx
14501; O1-NEXT:    .p2align 4
14502; O1-NEXT:  .LBB234_1: # %atomicrmw.start
14503; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14504; O1-NEXT:    movq %rax, %rbx
14505; O1-NEXT:  .Lpcsection573:
14506; O1-NEXT:    xorq $42, %rbx
14507; O1-NEXT:    movq %rdx, %rcx
14508; O1-NEXT:  .Lpcsection574:
14509; O1-NEXT:    lock cmpxchg16b (%rdi)
14510; O1-NEXT:  .Lpcsection575:
14511; O1-NEXT:    jne .LBB234_1
14512; O1-NEXT:  # %bb.2: # %atomicrmw.end
14513; O1-NEXT:    movq $1, foo(%rip)
14514; O1-NEXT:    popq %rbx
14515; O1-NEXT:    .cfi_def_cfa_offset 8
14516; O1-NEXT:    retq
14517;
14518; O2-LABEL: atomic128_xor_acq_rel:
14519; O2:       # %bb.0: # %entry
14520; O2-NEXT:    pushq %rbx
14521; O2-NEXT:    .cfi_def_cfa_offset 16
14522; O2-NEXT:    .cfi_offset %rbx, -16
14523; O2-NEXT:    movq foo(%rip), %rax
14524; O2-NEXT:  .Lpcsection571:
14525; O2-NEXT:    movq (%rdi), %rax
14526; O2-NEXT:  .Lpcsection572:
14527; O2-NEXT:    movq 8(%rdi), %rdx
14528; O2-NEXT:    .p2align 4
14529; O2-NEXT:  .LBB234_1: # %atomicrmw.start
14530; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14531; O2-NEXT:    movq %rax, %rbx
14532; O2-NEXT:  .Lpcsection573:
14533; O2-NEXT:    xorq $42, %rbx
14534; O2-NEXT:    movq %rdx, %rcx
14535; O2-NEXT:  .Lpcsection574:
14536; O2-NEXT:    lock cmpxchg16b (%rdi)
14537; O2-NEXT:  .Lpcsection575:
14538; O2-NEXT:    jne .LBB234_1
14539; O2-NEXT:  # %bb.2: # %atomicrmw.end
14540; O2-NEXT:    movq $1, foo(%rip)
14541; O2-NEXT:    popq %rbx
14542; O2-NEXT:    .cfi_def_cfa_offset 8
14543; O2-NEXT:    retq
14544;
14545; O3-LABEL: atomic128_xor_acq_rel:
14546; O3:       # %bb.0: # %entry
14547; O3-NEXT:    pushq %rbx
14548; O3-NEXT:    .cfi_def_cfa_offset 16
14549; O3-NEXT:    .cfi_offset %rbx, -16
14550; O3-NEXT:    movq foo(%rip), %rax
14551; O3-NEXT:  .Lpcsection571:
14552; O3-NEXT:    movq (%rdi), %rax
14553; O3-NEXT:  .Lpcsection572:
14554; O3-NEXT:    movq 8(%rdi), %rdx
14555; O3-NEXT:    .p2align 4
14556; O3-NEXT:  .LBB234_1: # %atomicrmw.start
14557; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14558; O3-NEXT:    movq %rax, %rbx
14559; O3-NEXT:  .Lpcsection573:
14560; O3-NEXT:    xorq $42, %rbx
14561; O3-NEXT:    movq %rdx, %rcx
14562; O3-NEXT:  .Lpcsection574:
14563; O3-NEXT:    lock cmpxchg16b (%rdi)
14564; O3-NEXT:  .Lpcsection575:
14565; O3-NEXT:    jne .LBB234_1
14566; O3-NEXT:  # %bb.2: # %atomicrmw.end
14567; O3-NEXT:    movq $1, foo(%rip)
14568; O3-NEXT:    popq %rbx
14569; O3-NEXT:    .cfi_def_cfa_offset 8
14570; O3-NEXT:    retq
14571entry:
14572  load volatile i64, ptr @foo, align 8
14573  %x = atomicrmw xor ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14574  store volatile i64 1, ptr @foo, align 8
14575  ret void
14576}
14577
14578define void @atomic128_nand_acq_rel(ptr %a) {
14579; O0-LABEL: atomic128_nand_acq_rel:
14580; O0:       # %bb.0: # %entry
14581; O0-NEXT:    pushq %rbx
14582; O0-NEXT:    .cfi_def_cfa_offset 16
14583; O0-NEXT:    .cfi_offset %rbx, -16
14584; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14585; O0-NEXT:    movq foo(%rip), %rax
14586; O0-NEXT:  .Lpcsection651:
14587; O0-NEXT:    movq (%rdi), %rax
14588; O0-NEXT:  .Lpcsection652:
14589; O0-NEXT:    movq 8(%rdi), %rdx
14590; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14591; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14592; O0-NEXT:  .Lpcsection653:
14593; O0-NEXT:    jmp .LBB235_1
14594; O0-NEXT:  .LBB235_1: # %atomicrmw.start
14595; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14596; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14597; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14598; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14599; O0-NEXT:    movl %eax, %ecx
14600; O0-NEXT:  .Lpcsection654:
14601; O0-NEXT:    notl %ecx
14602; O0-NEXT:  .Lpcsection655:
14603; O0-NEXT:    # implicit-def: $rbx
14604; O0-NEXT:    movl %ecx, %ebx
14605; O0-NEXT:  .Lpcsection656:
14606; O0-NEXT:    orq $-43, %rbx
14607; O0-NEXT:  .Lpcsection657:
14608; O0-NEXT:    movq $-1, %rcx
14609; O0-NEXT:  .Lpcsection658:
14610; O0-NEXT:    lock cmpxchg16b (%rsi)
14611; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14612; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14613; O0-NEXT:  .Lpcsection659:
14614; O0-NEXT:    jne .LBB235_1
14615; O0-NEXT:    jmp .LBB235_2
14616; O0-NEXT:  .LBB235_2: # %atomicrmw.end
14617; O0-NEXT:    movq $1, foo
14618; O0-NEXT:    popq %rbx
14619; O0-NEXT:    .cfi_def_cfa_offset 8
14620; O0-NEXT:    retq
14621;
14622; O1-LABEL: atomic128_nand_acq_rel:
14623; O1:       # %bb.0: # %entry
14624; O1-NEXT:    pushq %rbx
14625; O1-NEXT:    .cfi_def_cfa_offset 16
14626; O1-NEXT:    .cfi_offset %rbx, -16
14627; O1-NEXT:    movq foo(%rip), %rax
14628; O1-NEXT:  .Lpcsection576:
14629; O1-NEXT:    movq (%rdi), %rax
14630; O1-NEXT:  .Lpcsection577:
14631; O1-NEXT:    movq 8(%rdi), %rdx
14632; O1-NEXT:  .Lpcsection578:
14633; O1-NEXT:    movq $-1, %rcx
14634; O1-NEXT:    .p2align 4
14635; O1-NEXT:  .LBB235_1: # %atomicrmw.start
14636; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14637; O1-NEXT:    movl %eax, %ebx
14638; O1-NEXT:  .Lpcsection579:
14639; O1-NEXT:    notl %ebx
14640; O1-NEXT:  .Lpcsection580:
14641; O1-NEXT:    orq $-43, %rbx
14642; O1-NEXT:  .Lpcsection581:
14643; O1-NEXT:    lock cmpxchg16b (%rdi)
14644; O1-NEXT:  .Lpcsection582:
14645; O1-NEXT:    jne .LBB235_1
14646; O1-NEXT:  # %bb.2: # %atomicrmw.end
14647; O1-NEXT:    movq $1, foo(%rip)
14648; O1-NEXT:    popq %rbx
14649; O1-NEXT:    .cfi_def_cfa_offset 8
14650; O1-NEXT:    retq
14651;
14652; O2-LABEL: atomic128_nand_acq_rel:
14653; O2:       # %bb.0: # %entry
14654; O2-NEXT:    pushq %rbx
14655; O2-NEXT:    .cfi_def_cfa_offset 16
14656; O2-NEXT:    .cfi_offset %rbx, -16
14657; O2-NEXT:    movq foo(%rip), %rax
14658; O2-NEXT:  .Lpcsection576:
14659; O2-NEXT:    movq (%rdi), %rax
14660; O2-NEXT:  .Lpcsection577:
14661; O2-NEXT:    movq 8(%rdi), %rdx
14662; O2-NEXT:  .Lpcsection578:
14663; O2-NEXT:    movq $-1, %rcx
14664; O2-NEXT:    .p2align 4
14665; O2-NEXT:  .LBB235_1: # %atomicrmw.start
14666; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14667; O2-NEXT:    movl %eax, %ebx
14668; O2-NEXT:  .Lpcsection579:
14669; O2-NEXT:    notl %ebx
14670; O2-NEXT:  .Lpcsection580:
14671; O2-NEXT:    orq $-43, %rbx
14672; O2-NEXT:  .Lpcsection581:
14673; O2-NEXT:    lock cmpxchg16b (%rdi)
14674; O2-NEXT:  .Lpcsection582:
14675; O2-NEXT:    jne .LBB235_1
14676; O2-NEXT:  # %bb.2: # %atomicrmw.end
14677; O2-NEXT:    movq $1, foo(%rip)
14678; O2-NEXT:    popq %rbx
14679; O2-NEXT:    .cfi_def_cfa_offset 8
14680; O2-NEXT:    retq
14681;
14682; O3-LABEL: atomic128_nand_acq_rel:
14683; O3:       # %bb.0: # %entry
14684; O3-NEXT:    pushq %rbx
14685; O3-NEXT:    .cfi_def_cfa_offset 16
14686; O3-NEXT:    .cfi_offset %rbx, -16
14687; O3-NEXT:    movq foo(%rip), %rax
14688; O3-NEXT:  .Lpcsection576:
14689; O3-NEXT:    movq (%rdi), %rax
14690; O3-NEXT:  .Lpcsection577:
14691; O3-NEXT:    movq 8(%rdi), %rdx
14692; O3-NEXT:  .Lpcsection578:
14693; O3-NEXT:    movq $-1, %rcx
14694; O3-NEXT:    .p2align 4
14695; O3-NEXT:  .LBB235_1: # %atomicrmw.start
14696; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14697; O3-NEXT:    movl %eax, %ebx
14698; O3-NEXT:  .Lpcsection579:
14699; O3-NEXT:    notl %ebx
14700; O3-NEXT:  .Lpcsection580:
14701; O3-NEXT:    orq $-43, %rbx
14702; O3-NEXT:  .Lpcsection581:
14703; O3-NEXT:    lock cmpxchg16b (%rdi)
14704; O3-NEXT:  .Lpcsection582:
14705; O3-NEXT:    jne .LBB235_1
14706; O3-NEXT:  # %bb.2: # %atomicrmw.end
14707; O3-NEXT:    movq $1, foo(%rip)
14708; O3-NEXT:    popq %rbx
14709; O3-NEXT:    .cfi_def_cfa_offset 8
14710; O3-NEXT:    retq
14711entry:
14712  load volatile i64, ptr @foo, align 8
14713  %x = atomicrmw nand ptr %a, i128 42 acq_rel, align 16, !pcsections !0
14714  store volatile i64 1, ptr @foo, align 8
14715  ret void
14716}
14717
14718define void @atomic128_xchg_seq_cst(ptr %a) {
14719; O0-LABEL: atomic128_xchg_seq_cst:
14720; O0:       # %bb.0: # %entry
14721; O0-NEXT:    pushq %rbx
14722; O0-NEXT:    .cfi_def_cfa_offset 16
14723; O0-NEXT:    .cfi_offset %rbx, -16
14724; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14725; O0-NEXT:    movq foo(%rip), %rax
14726; O0-NEXT:  .Lpcsection660:
14727; O0-NEXT:    movq (%rdi), %rax
14728; O0-NEXT:  .Lpcsection661:
14729; O0-NEXT:    movq 8(%rdi), %rdx
14730; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14731; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14732; O0-NEXT:  .Lpcsection662:
14733; O0-NEXT:    jmp .LBB236_1
14734; O0-NEXT:  .LBB236_1: # %atomicrmw.start
14735; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14736; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14737; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14738; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14739; O0-NEXT:  .Lpcsection663:
14740; O0-NEXT:    xorl %ecx, %ecx
14741; O0-NEXT:  .Lpcsection664:
14742; O0-NEXT:    # kill: def $rcx killed $ecx
14743; O0-NEXT:  .Lpcsection665:
14744; O0-NEXT:    movl $42, %ebx
14745; O0-NEXT:  .Lpcsection666:
14746; O0-NEXT:    lock cmpxchg16b (%rsi)
14747; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14748; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14749; O0-NEXT:  .Lpcsection667:
14750; O0-NEXT:    jne .LBB236_1
14751; O0-NEXT:    jmp .LBB236_2
14752; O0-NEXT:  .LBB236_2: # %atomicrmw.end
14753; O0-NEXT:    movq $1, foo
14754; O0-NEXT:    popq %rbx
14755; O0-NEXT:    .cfi_def_cfa_offset 8
14756; O0-NEXT:    retq
14757;
14758; O1-LABEL: atomic128_xchg_seq_cst:
14759; O1:       # %bb.0: # %entry
14760; O1-NEXT:    pushq %rbx
14761; O1-NEXT:    .cfi_def_cfa_offset 16
14762; O1-NEXT:    .cfi_offset %rbx, -16
14763; O1-NEXT:    movq foo(%rip), %rax
14764; O1-NEXT:  .Lpcsection583:
14765; O1-NEXT:    movq (%rdi), %rax
14766; O1-NEXT:  .Lpcsection584:
14767; O1-NEXT:    movq 8(%rdi), %rdx
14768; O1-NEXT:  .Lpcsection585:
14769; O1-NEXT:    movl $42, %ebx
14770; O1-NEXT:    .p2align 4
14771; O1-NEXT:  .LBB236_1: # %atomicrmw.start
14772; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14773; O1-NEXT:  .Lpcsection586:
14774; O1-NEXT:    xorl %ecx, %ecx
14775; O1-NEXT:  .Lpcsection587:
14776; O1-NEXT:    lock cmpxchg16b (%rdi)
14777; O1-NEXT:  .Lpcsection588:
14778; O1-NEXT:    jne .LBB236_1
14779; O1-NEXT:  # %bb.2: # %atomicrmw.end
14780; O1-NEXT:    movq $1, foo(%rip)
14781; O1-NEXT:    popq %rbx
14782; O1-NEXT:    .cfi_def_cfa_offset 8
14783; O1-NEXT:    retq
14784;
14785; O2-LABEL: atomic128_xchg_seq_cst:
14786; O2:       # %bb.0: # %entry
14787; O2-NEXT:    pushq %rbx
14788; O2-NEXT:    .cfi_def_cfa_offset 16
14789; O2-NEXT:    .cfi_offset %rbx, -16
14790; O2-NEXT:    movq foo(%rip), %rax
14791; O2-NEXT:  .Lpcsection583:
14792; O2-NEXT:    movq (%rdi), %rax
14793; O2-NEXT:  .Lpcsection584:
14794; O2-NEXT:    movq 8(%rdi), %rdx
14795; O2-NEXT:  .Lpcsection585:
14796; O2-NEXT:    movl $42, %ebx
14797; O2-NEXT:    .p2align 4
14798; O2-NEXT:  .LBB236_1: # %atomicrmw.start
14799; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14800; O2-NEXT:  .Lpcsection586:
14801; O2-NEXT:    xorl %ecx, %ecx
14802; O2-NEXT:  .Lpcsection587:
14803; O2-NEXT:    lock cmpxchg16b (%rdi)
14804; O2-NEXT:  .Lpcsection588:
14805; O2-NEXT:    jne .LBB236_1
14806; O2-NEXT:  # %bb.2: # %atomicrmw.end
14807; O2-NEXT:    movq $1, foo(%rip)
14808; O2-NEXT:    popq %rbx
14809; O2-NEXT:    .cfi_def_cfa_offset 8
14810; O2-NEXT:    retq
14811;
14812; O3-LABEL: atomic128_xchg_seq_cst:
14813; O3:       # %bb.0: # %entry
14814; O3-NEXT:    pushq %rbx
14815; O3-NEXT:    .cfi_def_cfa_offset 16
14816; O3-NEXT:    .cfi_offset %rbx, -16
14817; O3-NEXT:    movq foo(%rip), %rax
14818; O3-NEXT:  .Lpcsection583:
14819; O3-NEXT:    movq (%rdi), %rax
14820; O3-NEXT:  .Lpcsection584:
14821; O3-NEXT:    movq 8(%rdi), %rdx
14822; O3-NEXT:  .Lpcsection585:
14823; O3-NEXT:    movl $42, %ebx
14824; O3-NEXT:    .p2align 4
14825; O3-NEXT:  .LBB236_1: # %atomicrmw.start
14826; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14827; O3-NEXT:  .Lpcsection586:
14828; O3-NEXT:    xorl %ecx, %ecx
14829; O3-NEXT:  .Lpcsection587:
14830; O3-NEXT:    lock cmpxchg16b (%rdi)
14831; O3-NEXT:  .Lpcsection588:
14832; O3-NEXT:    jne .LBB236_1
14833; O3-NEXT:  # %bb.2: # %atomicrmw.end
14834; O3-NEXT:    movq $1, foo(%rip)
14835; O3-NEXT:    popq %rbx
14836; O3-NEXT:    .cfi_def_cfa_offset 8
14837; O3-NEXT:    retq
14838entry:
14839  load volatile i64, ptr @foo, align 8
14840  %x = atomicrmw xchg ptr %a, i128 42 seq_cst, align 16, !pcsections !0
14841  store volatile i64 1, ptr @foo, align 8
14842  ret void
14843}
14844
14845define void @atomic128_add_seq_cst(ptr %a) {
14846; O0-LABEL: atomic128_add_seq_cst:
14847; O0:       # %bb.0: # %entry
14848; O0-NEXT:    pushq %rbx
14849; O0-NEXT:    .cfi_def_cfa_offset 16
14850; O0-NEXT:    .cfi_offset %rbx, -16
14851; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14852; O0-NEXT:    movq foo(%rip), %rax
14853; O0-NEXT:  .Lpcsection668:
14854; O0-NEXT:    movq (%rdi), %rax
14855; O0-NEXT:  .Lpcsection669:
14856; O0-NEXT:    movq 8(%rdi), %rdx
14857; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14858; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14859; O0-NEXT:  .Lpcsection670:
14860; O0-NEXT:    jmp .LBB237_1
14861; O0-NEXT:  .LBB237_1: # %atomicrmw.start
14862; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14863; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14864; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14865; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14866; O0-NEXT:    movq %rax, %rbx
14867; O0-NEXT:  .Lpcsection671:
14868; O0-NEXT:    addq $42, %rbx
14869; O0-NEXT:    movq %rdx, %rcx
14870; O0-NEXT:  .Lpcsection672:
14871; O0-NEXT:    adcq $0, %rcx
14872; O0-NEXT:  .Lpcsection673:
14873; O0-NEXT:    lock cmpxchg16b (%rsi)
14874; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14875; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14876; O0-NEXT:  .Lpcsection674:
14877; O0-NEXT:    jne .LBB237_1
14878; O0-NEXT:    jmp .LBB237_2
14879; O0-NEXT:  .LBB237_2: # %atomicrmw.end
14880; O0-NEXT:    movq $1, foo
14881; O0-NEXT:    popq %rbx
14882; O0-NEXT:    .cfi_def_cfa_offset 8
14883; O0-NEXT:    retq
14884;
14885; O1-LABEL: atomic128_add_seq_cst:
14886; O1:       # %bb.0: # %entry
14887; O1-NEXT:    pushq %rbx
14888; O1-NEXT:    .cfi_def_cfa_offset 16
14889; O1-NEXT:    .cfi_offset %rbx, -16
14890; O1-NEXT:    movq foo(%rip), %rax
14891; O1-NEXT:  .Lpcsection589:
14892; O1-NEXT:    movq (%rdi), %rax
14893; O1-NEXT:  .Lpcsection590:
14894; O1-NEXT:    movq 8(%rdi), %rdx
14895; O1-NEXT:    .p2align 4
14896; O1-NEXT:  .LBB237_1: # %atomicrmw.start
14897; O1-NEXT:    # =>This Inner Loop Header: Depth=1
14898; O1-NEXT:    movq %rax, %rbx
14899; O1-NEXT:  .Lpcsection591:
14900; O1-NEXT:    addq $42, %rbx
14901; O1-NEXT:    movq %rdx, %rcx
14902; O1-NEXT:  .Lpcsection592:
14903; O1-NEXT:    adcq $0, %rcx
14904; O1-NEXT:  .Lpcsection593:
14905; O1-NEXT:    lock cmpxchg16b (%rdi)
14906; O1-NEXT:  .Lpcsection594:
14907; O1-NEXT:    jne .LBB237_1
14908; O1-NEXT:  # %bb.2: # %atomicrmw.end
14909; O1-NEXT:    movq $1, foo(%rip)
14910; O1-NEXT:    popq %rbx
14911; O1-NEXT:    .cfi_def_cfa_offset 8
14912; O1-NEXT:    retq
14913;
14914; O2-LABEL: atomic128_add_seq_cst:
14915; O2:       # %bb.0: # %entry
14916; O2-NEXT:    pushq %rbx
14917; O2-NEXT:    .cfi_def_cfa_offset 16
14918; O2-NEXT:    .cfi_offset %rbx, -16
14919; O2-NEXT:    movq foo(%rip), %rax
14920; O2-NEXT:  .Lpcsection589:
14921; O2-NEXT:    movq (%rdi), %rax
14922; O2-NEXT:  .Lpcsection590:
14923; O2-NEXT:    movq 8(%rdi), %rdx
14924; O2-NEXT:    .p2align 4
14925; O2-NEXT:  .LBB237_1: # %atomicrmw.start
14926; O2-NEXT:    # =>This Inner Loop Header: Depth=1
14927; O2-NEXT:    movq %rax, %rbx
14928; O2-NEXT:  .Lpcsection591:
14929; O2-NEXT:    addq $42, %rbx
14930; O2-NEXT:    movq %rdx, %rcx
14931; O2-NEXT:  .Lpcsection592:
14932; O2-NEXT:    adcq $0, %rcx
14933; O2-NEXT:  .Lpcsection593:
14934; O2-NEXT:    lock cmpxchg16b (%rdi)
14935; O2-NEXT:  .Lpcsection594:
14936; O2-NEXT:    jne .LBB237_1
14937; O2-NEXT:  # %bb.2: # %atomicrmw.end
14938; O2-NEXT:    movq $1, foo(%rip)
14939; O2-NEXT:    popq %rbx
14940; O2-NEXT:    .cfi_def_cfa_offset 8
14941; O2-NEXT:    retq
14942;
14943; O3-LABEL: atomic128_add_seq_cst:
14944; O3:       # %bb.0: # %entry
14945; O3-NEXT:    pushq %rbx
14946; O3-NEXT:    .cfi_def_cfa_offset 16
14947; O3-NEXT:    .cfi_offset %rbx, -16
14948; O3-NEXT:    movq foo(%rip), %rax
14949; O3-NEXT:  .Lpcsection589:
14950; O3-NEXT:    movq (%rdi), %rax
14951; O3-NEXT:  .Lpcsection590:
14952; O3-NEXT:    movq 8(%rdi), %rdx
14953; O3-NEXT:    .p2align 4
14954; O3-NEXT:  .LBB237_1: # %atomicrmw.start
14955; O3-NEXT:    # =>This Inner Loop Header: Depth=1
14956; O3-NEXT:    movq %rax, %rbx
14957; O3-NEXT:  .Lpcsection591:
14958; O3-NEXT:    addq $42, %rbx
14959; O3-NEXT:    movq %rdx, %rcx
14960; O3-NEXT:  .Lpcsection592:
14961; O3-NEXT:    adcq $0, %rcx
14962; O3-NEXT:  .Lpcsection593:
14963; O3-NEXT:    lock cmpxchg16b (%rdi)
14964; O3-NEXT:  .Lpcsection594:
14965; O3-NEXT:    jne .LBB237_1
14966; O3-NEXT:  # %bb.2: # %atomicrmw.end
14967; O3-NEXT:    movq $1, foo(%rip)
14968; O3-NEXT:    popq %rbx
14969; O3-NEXT:    .cfi_def_cfa_offset 8
14970; O3-NEXT:    retq
14971entry:
14972  load volatile i64, ptr @foo, align 8
14973  %x = atomicrmw add ptr %a, i128 42 seq_cst, align 16, !pcsections !0
14974  store volatile i64 1, ptr @foo, align 8
14975  ret void
14976}
14977
14978define void @atomic128_sub_seq_cst(ptr %a) {
14979; O0-LABEL: atomic128_sub_seq_cst:
14980; O0:       # %bb.0: # %entry
14981; O0-NEXT:    pushq %rbx
14982; O0-NEXT:    .cfi_def_cfa_offset 16
14983; O0-NEXT:    .cfi_offset %rbx, -16
14984; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14985; O0-NEXT:    movq foo(%rip), %rax
14986; O0-NEXT:  .Lpcsection675:
14987; O0-NEXT:    movq (%rdi), %rax
14988; O0-NEXT:  .Lpcsection676:
14989; O0-NEXT:    movq 8(%rdi), %rdx
14990; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14991; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
14992; O0-NEXT:  .Lpcsection677:
14993; O0-NEXT:    jmp .LBB238_1
14994; O0-NEXT:  .LBB238_1: # %atomicrmw.start
14995; O0-NEXT:    # =>This Inner Loop Header: Depth=1
14996; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
14997; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
14998; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
14999; O0-NEXT:    movq %rax, %rbx
15000; O0-NEXT:  .Lpcsection678:
15001; O0-NEXT:    addq $-42, %rbx
15002; O0-NEXT:    movq %rdx, %rcx
15003; O0-NEXT:  .Lpcsection679:
15004; O0-NEXT:    adcq $-1, %rcx
15005; O0-NEXT:  .Lpcsection680:
15006; O0-NEXT:    lock cmpxchg16b (%rsi)
15007; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15008; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15009; O0-NEXT:  .Lpcsection681:
15010; O0-NEXT:    jne .LBB238_1
15011; O0-NEXT:    jmp .LBB238_2
15012; O0-NEXT:  .LBB238_2: # %atomicrmw.end
15013; O0-NEXT:    movq $1, foo
15014; O0-NEXT:    popq %rbx
15015; O0-NEXT:    .cfi_def_cfa_offset 8
15016; O0-NEXT:    retq
15017;
15018; O1-LABEL: atomic128_sub_seq_cst:
15019; O1:       # %bb.0: # %entry
15020; O1-NEXT:    pushq %rbx
15021; O1-NEXT:    .cfi_def_cfa_offset 16
15022; O1-NEXT:    .cfi_offset %rbx, -16
15023; O1-NEXT:    movq foo(%rip), %rax
15024; O1-NEXT:  .Lpcsection595:
15025; O1-NEXT:    movq (%rdi), %rax
15026; O1-NEXT:  .Lpcsection596:
15027; O1-NEXT:    movq 8(%rdi), %rdx
15028; O1-NEXT:    .p2align 4
15029; O1-NEXT:  .LBB238_1: # %atomicrmw.start
15030; O1-NEXT:    # =>This Inner Loop Header: Depth=1
15031; O1-NEXT:    movq %rax, %rbx
15032; O1-NEXT:  .Lpcsection597:
15033; O1-NEXT:    addq $-42, %rbx
15034; O1-NEXT:    movq %rdx, %rcx
15035; O1-NEXT:  .Lpcsection598:
15036; O1-NEXT:    adcq $-1, %rcx
15037; O1-NEXT:  .Lpcsection599:
15038; O1-NEXT:    lock cmpxchg16b (%rdi)
15039; O1-NEXT:  .Lpcsection600:
15040; O1-NEXT:    jne .LBB238_1
15041; O1-NEXT:  # %bb.2: # %atomicrmw.end
15042; O1-NEXT:    movq $1, foo(%rip)
15043; O1-NEXT:    popq %rbx
15044; O1-NEXT:    .cfi_def_cfa_offset 8
15045; O1-NEXT:    retq
15046;
15047; O2-LABEL: atomic128_sub_seq_cst:
15048; O2:       # %bb.0: # %entry
15049; O2-NEXT:    pushq %rbx
15050; O2-NEXT:    .cfi_def_cfa_offset 16
15051; O2-NEXT:    .cfi_offset %rbx, -16
15052; O2-NEXT:    movq foo(%rip), %rax
15053; O2-NEXT:  .Lpcsection595:
15054; O2-NEXT:    movq (%rdi), %rax
15055; O2-NEXT:  .Lpcsection596:
15056; O2-NEXT:    movq 8(%rdi), %rdx
15057; O2-NEXT:    .p2align 4
15058; O2-NEXT:  .LBB238_1: # %atomicrmw.start
15059; O2-NEXT:    # =>This Inner Loop Header: Depth=1
15060; O2-NEXT:    movq %rax, %rbx
15061; O2-NEXT:  .Lpcsection597:
15062; O2-NEXT:    addq $-42, %rbx
15063; O2-NEXT:    movq %rdx, %rcx
15064; O2-NEXT:  .Lpcsection598:
15065; O2-NEXT:    adcq $-1, %rcx
15066; O2-NEXT:  .Lpcsection599:
15067; O2-NEXT:    lock cmpxchg16b (%rdi)
15068; O2-NEXT:  .Lpcsection600:
15069; O2-NEXT:    jne .LBB238_1
15070; O2-NEXT:  # %bb.2: # %atomicrmw.end
15071; O2-NEXT:    movq $1, foo(%rip)
15072; O2-NEXT:    popq %rbx
15073; O2-NEXT:    .cfi_def_cfa_offset 8
15074; O2-NEXT:    retq
15075;
15076; O3-LABEL: atomic128_sub_seq_cst:
15077; O3:       # %bb.0: # %entry
15078; O3-NEXT:    pushq %rbx
15079; O3-NEXT:    .cfi_def_cfa_offset 16
15080; O3-NEXT:    .cfi_offset %rbx, -16
15081; O3-NEXT:    movq foo(%rip), %rax
15082; O3-NEXT:  .Lpcsection595:
15083; O3-NEXT:    movq (%rdi), %rax
15084; O3-NEXT:  .Lpcsection596:
15085; O3-NEXT:    movq 8(%rdi), %rdx
15086; O3-NEXT:    .p2align 4
15087; O3-NEXT:  .LBB238_1: # %atomicrmw.start
15088; O3-NEXT:    # =>This Inner Loop Header: Depth=1
15089; O3-NEXT:    movq %rax, %rbx
15090; O3-NEXT:  .Lpcsection597:
15091; O3-NEXT:    addq $-42, %rbx
15092; O3-NEXT:    movq %rdx, %rcx
15093; O3-NEXT:  .Lpcsection598:
15094; O3-NEXT:    adcq $-1, %rcx
15095; O3-NEXT:  .Lpcsection599:
15096; O3-NEXT:    lock cmpxchg16b (%rdi)
15097; O3-NEXT:  .Lpcsection600:
15098; O3-NEXT:    jne .LBB238_1
15099; O3-NEXT:  # %bb.2: # %atomicrmw.end
15100; O3-NEXT:    movq $1, foo(%rip)
15101; O3-NEXT:    popq %rbx
15102; O3-NEXT:    .cfi_def_cfa_offset 8
15103; O3-NEXT:    retq
15104entry:
15105  load volatile i64, ptr @foo, align 8
15106  %x = atomicrmw sub ptr %a, i128 42 seq_cst, align 16, !pcsections !0
15107  store volatile i64 1, ptr @foo, align 8
15108  ret void
15109}
15110
15111define void @atomic128_and_seq_cst(ptr %a) {
15112; O0-LABEL: atomic128_and_seq_cst:
15113; O0:       # %bb.0: # %entry
15114; O0-NEXT:    pushq %rbx
15115; O0-NEXT:    .cfi_def_cfa_offset 16
15116; O0-NEXT:    .cfi_offset %rbx, -16
15117; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15118; O0-NEXT:    movq foo(%rip), %rax
15119; O0-NEXT:  .Lpcsection682:
15120; O0-NEXT:    movq (%rdi), %rax
15121; O0-NEXT:  .Lpcsection683:
15122; O0-NEXT:    movq 8(%rdi), %rdx
15123; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15124; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15125; O0-NEXT:  .Lpcsection684:
15126; O0-NEXT:    jmp .LBB239_1
15127; O0-NEXT:  .LBB239_1: # %atomicrmw.start
15128; O0-NEXT:    # =>This Inner Loop Header: Depth=1
15129; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
15130; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15131; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
15132; O0-NEXT:    movl %eax, %ecx
15133; O0-NEXT:  .Lpcsection685:
15134; O0-NEXT:    andl $42, %ecx
15135; O0-NEXT:    movl %ecx, %ebx
15136; O0-NEXT:  .Lpcsection686:
15137; O0-NEXT:    xorl %ecx, %ecx
15138; O0-NEXT:  .Lpcsection687:
15139; O0-NEXT:    # kill: def $rcx killed $ecx
15140; O0-NEXT:  .Lpcsection688:
15141; O0-NEXT:    lock cmpxchg16b (%rsi)
15142; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15143; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15144; O0-NEXT:  .Lpcsection689:
15145; O0-NEXT:    jne .LBB239_1
15146; O0-NEXT:    jmp .LBB239_2
15147; O0-NEXT:  .LBB239_2: # %atomicrmw.end
15148; O0-NEXT:    movq $1, foo
15149; O0-NEXT:    popq %rbx
15150; O0-NEXT:    .cfi_def_cfa_offset 8
15151; O0-NEXT:    retq
15152;
15153; O1-LABEL: atomic128_and_seq_cst:
15154; O1:       # %bb.0: # %entry
15155; O1-NEXT:    pushq %rbx
15156; O1-NEXT:    .cfi_def_cfa_offset 16
15157; O1-NEXT:    .cfi_offset %rbx, -16
15158; O1-NEXT:    movq foo(%rip), %rax
15159; O1-NEXT:  .Lpcsection601:
15160; O1-NEXT:    movq (%rdi), %rax
15161; O1-NEXT:  .Lpcsection602:
15162; O1-NEXT:    movq 8(%rdi), %rdx
15163; O1-NEXT:    .p2align 4
15164; O1-NEXT:  .LBB239_1: # %atomicrmw.start
15165; O1-NEXT:    # =>This Inner Loop Header: Depth=1
15166; O1-NEXT:    movl %eax, %ebx
15167; O1-NEXT:  .Lpcsection603:
15168; O1-NEXT:    andl $42, %ebx
15169; O1-NEXT:  .Lpcsection604:
15170; O1-NEXT:    xorl %ecx, %ecx
15171; O1-NEXT:  .Lpcsection605:
15172; O1-NEXT:    lock cmpxchg16b (%rdi)
15173; O1-NEXT:  .Lpcsection606:
15174; O1-NEXT:    jne .LBB239_1
15175; O1-NEXT:  # %bb.2: # %atomicrmw.end
15176; O1-NEXT:    movq $1, foo(%rip)
15177; O1-NEXT:    popq %rbx
15178; O1-NEXT:    .cfi_def_cfa_offset 8
15179; O1-NEXT:    retq
15180;
15181; O2-LABEL: atomic128_and_seq_cst:
15182; O2:       # %bb.0: # %entry
15183; O2-NEXT:    pushq %rbx
15184; O2-NEXT:    .cfi_def_cfa_offset 16
15185; O2-NEXT:    .cfi_offset %rbx, -16
15186; O2-NEXT:    movq foo(%rip), %rax
15187; O2-NEXT:  .Lpcsection601:
15188; O2-NEXT:    movq (%rdi), %rax
15189; O2-NEXT:  .Lpcsection602:
15190; O2-NEXT:    movq 8(%rdi), %rdx
15191; O2-NEXT:    .p2align 4
15192; O2-NEXT:  .LBB239_1: # %atomicrmw.start
15193; O2-NEXT:    # =>This Inner Loop Header: Depth=1
15194; O2-NEXT:    movl %eax, %ebx
15195; O2-NEXT:  .Lpcsection603:
15196; O2-NEXT:    andl $42, %ebx
15197; O2-NEXT:  .Lpcsection604:
15198; O2-NEXT:    xorl %ecx, %ecx
15199; O2-NEXT:  .Lpcsection605:
15200; O2-NEXT:    lock cmpxchg16b (%rdi)
15201; O2-NEXT:  .Lpcsection606:
15202; O2-NEXT:    jne .LBB239_1
15203; O2-NEXT:  # %bb.2: # %atomicrmw.end
15204; O2-NEXT:    movq $1, foo(%rip)
15205; O2-NEXT:    popq %rbx
15206; O2-NEXT:    .cfi_def_cfa_offset 8
15207; O2-NEXT:    retq
15208;
15209; O3-LABEL: atomic128_and_seq_cst:
15210; O3:       # %bb.0: # %entry
15211; O3-NEXT:    pushq %rbx
15212; O3-NEXT:    .cfi_def_cfa_offset 16
15213; O3-NEXT:    .cfi_offset %rbx, -16
15214; O3-NEXT:    movq foo(%rip), %rax
15215; O3-NEXT:  .Lpcsection601:
15216; O3-NEXT:    movq (%rdi), %rax
15217; O3-NEXT:  .Lpcsection602:
15218; O3-NEXT:    movq 8(%rdi), %rdx
15219; O3-NEXT:    .p2align 4
15220; O3-NEXT:  .LBB239_1: # %atomicrmw.start
15221; O3-NEXT:    # =>This Inner Loop Header: Depth=1
15222; O3-NEXT:    movl %eax, %ebx
15223; O3-NEXT:  .Lpcsection603:
15224; O3-NEXT:    andl $42, %ebx
15225; O3-NEXT:  .Lpcsection604:
15226; O3-NEXT:    xorl %ecx, %ecx
15227; O3-NEXT:  .Lpcsection605:
15228; O3-NEXT:    lock cmpxchg16b (%rdi)
15229; O3-NEXT:  .Lpcsection606:
15230; O3-NEXT:    jne .LBB239_1
15231; O3-NEXT:  # %bb.2: # %atomicrmw.end
15232; O3-NEXT:    movq $1, foo(%rip)
15233; O3-NEXT:    popq %rbx
15234; O3-NEXT:    .cfi_def_cfa_offset 8
15235; O3-NEXT:    retq
15236entry:
15237  load volatile i64, ptr @foo, align 8
15238  %x = atomicrmw and ptr %a, i128 42 seq_cst, align 16, !pcsections !0
15239  store volatile i64 1, ptr @foo, align 8
15240  ret void
15241}
15242
15243define void @atomic128_or_seq_cst(ptr %a) {
15244; O0-LABEL: atomic128_or_seq_cst:
15245; O0:       # %bb.0: # %entry
15246; O0-NEXT:    pushq %rbx
15247; O0-NEXT:    .cfi_def_cfa_offset 16
15248; O0-NEXT:    .cfi_offset %rbx, -16
15249; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15250; O0-NEXT:    movq foo(%rip), %rax
15251; O0-NEXT:  .Lpcsection690:
15252; O0-NEXT:    movq (%rdi), %rax
15253; O0-NEXT:  .Lpcsection691:
15254; O0-NEXT:    movq 8(%rdi), %rdx
15255; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15256; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15257; O0-NEXT:  .Lpcsection692:
15258; O0-NEXT:    jmp .LBB240_1
15259; O0-NEXT:  .LBB240_1: # %atomicrmw.start
15260; O0-NEXT:    # =>This Inner Loop Header: Depth=1
15261; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15262; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15263; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
15264; O0-NEXT:    movq %rax, %rbx
15265; O0-NEXT:  .Lpcsection693:
15266; O0-NEXT:    orq $42, %rbx
15267; O0-NEXT:    movq %rcx, %rdx
15268; O0-NEXT:  .Lpcsection694:
15269; O0-NEXT:    lock cmpxchg16b (%rsi)
15270; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15271; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15272; O0-NEXT:  .Lpcsection695:
15273; O0-NEXT:    jne .LBB240_1
15274; O0-NEXT:    jmp .LBB240_2
15275; O0-NEXT:  .LBB240_2: # %atomicrmw.end
15276; O0-NEXT:    movq $1, foo
15277; O0-NEXT:    popq %rbx
15278; O0-NEXT:    .cfi_def_cfa_offset 8
15279; O0-NEXT:    retq
15280;
15281; O1-LABEL: atomic128_or_seq_cst:
15282; O1:       # %bb.0: # %entry
15283; O1-NEXT:    pushq %rbx
15284; O1-NEXT:    .cfi_def_cfa_offset 16
15285; O1-NEXT:    .cfi_offset %rbx, -16
15286; O1-NEXT:    movq foo(%rip), %rax
15287; O1-NEXT:  .Lpcsection607:
15288; O1-NEXT:    movq (%rdi), %rax
15289; O1-NEXT:  .Lpcsection608:
15290; O1-NEXT:    movq 8(%rdi), %rdx
15291; O1-NEXT:    .p2align 4
15292; O1-NEXT:  .LBB240_1: # %atomicrmw.start
15293; O1-NEXT:    # =>This Inner Loop Header: Depth=1
15294; O1-NEXT:    movq %rax, %rbx
15295; O1-NEXT:  .Lpcsection609:
15296; O1-NEXT:    orq $42, %rbx
15297; O1-NEXT:    movq %rdx, %rcx
15298; O1-NEXT:  .Lpcsection610:
15299; O1-NEXT:    lock cmpxchg16b (%rdi)
15300; O1-NEXT:  .Lpcsection611:
15301; O1-NEXT:    jne .LBB240_1
15302; O1-NEXT:  # %bb.2: # %atomicrmw.end
15303; O1-NEXT:    movq $1, foo(%rip)
15304; O1-NEXT:    popq %rbx
15305; O1-NEXT:    .cfi_def_cfa_offset 8
15306; O1-NEXT:    retq
15307;
15308; O2-LABEL: atomic128_or_seq_cst:
15309; O2:       # %bb.0: # %entry
15310; O2-NEXT:    pushq %rbx
15311; O2-NEXT:    .cfi_def_cfa_offset 16
15312; O2-NEXT:    .cfi_offset %rbx, -16
15313; O2-NEXT:    movq foo(%rip), %rax
15314; O2-NEXT:  .Lpcsection607:
15315; O2-NEXT:    movq (%rdi), %rax
15316; O2-NEXT:  .Lpcsection608:
15317; O2-NEXT:    movq 8(%rdi), %rdx
15318; O2-NEXT:    .p2align 4
15319; O2-NEXT:  .LBB240_1: # %atomicrmw.start
15320; O2-NEXT:    # =>This Inner Loop Header: Depth=1
15321; O2-NEXT:    movq %rax, %rbx
15322; O2-NEXT:  .Lpcsection609:
15323; O2-NEXT:    orq $42, %rbx
15324; O2-NEXT:    movq %rdx, %rcx
15325; O2-NEXT:  .Lpcsection610:
15326; O2-NEXT:    lock cmpxchg16b (%rdi)
15327; O2-NEXT:  .Lpcsection611:
15328; O2-NEXT:    jne .LBB240_1
15329; O2-NEXT:  # %bb.2: # %atomicrmw.end
15330; O2-NEXT:    movq $1, foo(%rip)
15331; O2-NEXT:    popq %rbx
15332; O2-NEXT:    .cfi_def_cfa_offset 8
15333; O2-NEXT:    retq
15334;
15335; O3-LABEL: atomic128_or_seq_cst:
15336; O3:       # %bb.0: # %entry
15337; O3-NEXT:    pushq %rbx
15338; O3-NEXT:    .cfi_def_cfa_offset 16
15339; O3-NEXT:    .cfi_offset %rbx, -16
15340; O3-NEXT:    movq foo(%rip), %rax
15341; O3-NEXT:  .Lpcsection607:
15342; O3-NEXT:    movq (%rdi), %rax
15343; O3-NEXT:  .Lpcsection608:
15344; O3-NEXT:    movq 8(%rdi), %rdx
15345; O3-NEXT:    .p2align 4
15346; O3-NEXT:  .LBB240_1: # %atomicrmw.start
15347; O3-NEXT:    # =>This Inner Loop Header: Depth=1
15348; O3-NEXT:    movq %rax, %rbx
15349; O3-NEXT:  .Lpcsection609:
15350; O3-NEXT:    orq $42, %rbx
15351; O3-NEXT:    movq %rdx, %rcx
15352; O3-NEXT:  .Lpcsection610:
15353; O3-NEXT:    lock cmpxchg16b (%rdi)
15354; O3-NEXT:  .Lpcsection611:
15355; O3-NEXT:    jne .LBB240_1
15356; O3-NEXT:  # %bb.2: # %atomicrmw.end
15357; O3-NEXT:    movq $1, foo(%rip)
15358; O3-NEXT:    popq %rbx
15359; O3-NEXT:    .cfi_def_cfa_offset 8
15360; O3-NEXT:    retq
15361entry:
15362  load volatile i64, ptr @foo, align 8
15363  %x = atomicrmw or ptr %a, i128 42 seq_cst, align 16, !pcsections !0
15364  store volatile i64 1, ptr @foo, align 8
15365  ret void
15366}
15367
15368define void @atomic128_xor_seq_cst(ptr %a) {
15369; O0-LABEL: atomic128_xor_seq_cst:
15370; O0:       # %bb.0: # %entry
15371; O0-NEXT:    pushq %rbx
15372; O0-NEXT:    .cfi_def_cfa_offset 16
15373; O0-NEXT:    .cfi_offset %rbx, -16
15374; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15375; O0-NEXT:    movq foo(%rip), %rax
15376; O0-NEXT:  .Lpcsection696:
15377; O0-NEXT:    movq (%rdi), %rax
15378; O0-NEXT:  .Lpcsection697:
15379; O0-NEXT:    movq 8(%rdi), %rdx
15380; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15381; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15382; O0-NEXT:  .Lpcsection698:
15383; O0-NEXT:    jmp .LBB241_1
15384; O0-NEXT:  .LBB241_1: # %atomicrmw.start
15385; O0-NEXT:    # =>This Inner Loop Header: Depth=1
15386; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15387; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15388; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
15389; O0-NEXT:    movq %rax, %rbx
15390; O0-NEXT:  .Lpcsection699:
15391; O0-NEXT:    xorq $42, %rbx
15392; O0-NEXT:    movq %rcx, %rdx
15393; O0-NEXT:  .Lpcsection700:
15394; O0-NEXT:    lock cmpxchg16b (%rsi)
15395; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15396; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15397; O0-NEXT:  .Lpcsection701:
15398; O0-NEXT:    jne .LBB241_1
15399; O0-NEXT:    jmp .LBB241_2
15400; O0-NEXT:  .LBB241_2: # %atomicrmw.end
15401; O0-NEXT:    movq $1, foo
15402; O0-NEXT:    popq %rbx
15403; O0-NEXT:    .cfi_def_cfa_offset 8
15404; O0-NEXT:    retq
15405;
15406; O1-LABEL: atomic128_xor_seq_cst:
15407; O1:       # %bb.0: # %entry
15408; O1-NEXT:    pushq %rbx
15409; O1-NEXT:    .cfi_def_cfa_offset 16
15410; O1-NEXT:    .cfi_offset %rbx, -16
15411; O1-NEXT:    movq foo(%rip), %rax
15412; O1-NEXT:  .Lpcsection612:
15413; O1-NEXT:    movq (%rdi), %rax
15414; O1-NEXT:  .Lpcsection613:
15415; O1-NEXT:    movq 8(%rdi), %rdx
15416; O1-NEXT:    .p2align 4
15417; O1-NEXT:  .LBB241_1: # %atomicrmw.start
15418; O1-NEXT:    # =>This Inner Loop Header: Depth=1
15419; O1-NEXT:    movq %rax, %rbx
15420; O1-NEXT:  .Lpcsection614:
15421; O1-NEXT:    xorq $42, %rbx
15422; O1-NEXT:    movq %rdx, %rcx
15423; O1-NEXT:  .Lpcsection615:
15424; O1-NEXT:    lock cmpxchg16b (%rdi)
15425; O1-NEXT:  .Lpcsection616:
15426; O1-NEXT:    jne .LBB241_1
15427; O1-NEXT:  # %bb.2: # %atomicrmw.end
15428; O1-NEXT:    movq $1, foo(%rip)
15429; O1-NEXT:    popq %rbx
15430; O1-NEXT:    .cfi_def_cfa_offset 8
15431; O1-NEXT:    retq
15432;
15433; O2-LABEL: atomic128_xor_seq_cst:
15434; O2:       # %bb.0: # %entry
15435; O2-NEXT:    pushq %rbx
15436; O2-NEXT:    .cfi_def_cfa_offset 16
15437; O2-NEXT:    .cfi_offset %rbx, -16
15438; O2-NEXT:    movq foo(%rip), %rax
15439; O2-NEXT:  .Lpcsection612:
15440; O2-NEXT:    movq (%rdi), %rax
15441; O2-NEXT:  .Lpcsection613:
15442; O2-NEXT:    movq 8(%rdi), %rdx
15443; O2-NEXT:    .p2align 4
15444; O2-NEXT:  .LBB241_1: # %atomicrmw.start
15445; O2-NEXT:    # =>This Inner Loop Header: Depth=1
15446; O2-NEXT:    movq %rax, %rbx
15447; O2-NEXT:  .Lpcsection614:
15448; O2-NEXT:    xorq $42, %rbx
15449; O2-NEXT:    movq %rdx, %rcx
15450; O2-NEXT:  .Lpcsection615:
15451; O2-NEXT:    lock cmpxchg16b (%rdi)
15452; O2-NEXT:  .Lpcsection616:
15453; O2-NEXT:    jne .LBB241_1
15454; O2-NEXT:  # %bb.2: # %atomicrmw.end
15455; O2-NEXT:    movq $1, foo(%rip)
15456; O2-NEXT:    popq %rbx
15457; O2-NEXT:    .cfi_def_cfa_offset 8
15458; O2-NEXT:    retq
15459;
15460; O3-LABEL: atomic128_xor_seq_cst:
15461; O3:       # %bb.0: # %entry
15462; O3-NEXT:    pushq %rbx
15463; O3-NEXT:    .cfi_def_cfa_offset 16
15464; O3-NEXT:    .cfi_offset %rbx, -16
15465; O3-NEXT:    movq foo(%rip), %rax
15466; O3-NEXT:  .Lpcsection612:
15467; O3-NEXT:    movq (%rdi), %rax
15468; O3-NEXT:  .Lpcsection613:
15469; O3-NEXT:    movq 8(%rdi), %rdx
15470; O3-NEXT:    .p2align 4
15471; O3-NEXT:  .LBB241_1: # %atomicrmw.start
15472; O3-NEXT:    # =>This Inner Loop Header: Depth=1
15473; O3-NEXT:    movq %rax, %rbx
15474; O3-NEXT:  .Lpcsection614:
15475; O3-NEXT:    xorq $42, %rbx
15476; O3-NEXT:    movq %rdx, %rcx
15477; O3-NEXT:  .Lpcsection615:
15478; O3-NEXT:    lock cmpxchg16b (%rdi)
15479; O3-NEXT:  .Lpcsection616:
15480; O3-NEXT:    jne .LBB241_1
15481; O3-NEXT:  # %bb.2: # %atomicrmw.end
15482; O3-NEXT:    movq $1, foo(%rip)
15483; O3-NEXT:    popq %rbx
15484; O3-NEXT:    .cfi_def_cfa_offset 8
15485; O3-NEXT:    retq
15486entry:
15487  load volatile i64, ptr @foo, align 8
15488  %x = atomicrmw xor ptr %a, i128 42 seq_cst, align 16, !pcsections !0
15489  store volatile i64 1, ptr @foo, align 8
15490  ret void
15491}
15492
15493define void @atomic128_nand_seq_cst(ptr %a) {
15494; O0-LABEL: atomic128_nand_seq_cst:
15495; O0:       # %bb.0: # %entry
15496; O0-NEXT:    pushq %rbx
15497; O0-NEXT:    .cfi_def_cfa_offset 16
15498; O0-NEXT:    .cfi_offset %rbx, -16
15499; O0-NEXT:    movq %rdi, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15500; O0-NEXT:    movq foo(%rip), %rax
15501; O0-NEXT:  .Lpcsection702:
15502; O0-NEXT:    movq (%rdi), %rax
15503; O0-NEXT:  .Lpcsection703:
15504; O0-NEXT:    movq 8(%rdi), %rdx
15505; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15506; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15507; O0-NEXT:  .Lpcsection704:
15508; O0-NEXT:    jmp .LBB242_1
15509; O0-NEXT:  .LBB242_1: # %atomicrmw.start
15510; O0-NEXT:    # =>This Inner Loop Header: Depth=1
15511; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rdx # 8-byte Reload
15512; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15513; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rsi # 8-byte Reload
15514; O0-NEXT:    movl %eax, %ecx
15515; O0-NEXT:  .Lpcsection705:
15516; O0-NEXT:    notl %ecx
15517; O0-NEXT:  .Lpcsection706:
15518; O0-NEXT:    # implicit-def: $rbx
15519; O0-NEXT:    movl %ecx, %ebx
15520; O0-NEXT:  .Lpcsection707:
15521; O0-NEXT:    orq $-43, %rbx
15522; O0-NEXT:  .Lpcsection708:
15523; O0-NEXT:    movq $-1, %rcx
15524; O0-NEXT:  .Lpcsection709:
15525; O0-NEXT:    lock cmpxchg16b (%rsi)
15526; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15527; O0-NEXT:    movq %rdx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15528; O0-NEXT:  .Lpcsection710:
15529; O0-NEXT:    jne .LBB242_1
15530; O0-NEXT:    jmp .LBB242_2
15531; O0-NEXT:  .LBB242_2: # %atomicrmw.end
15532; O0-NEXT:    movq $1, foo
15533; O0-NEXT:    popq %rbx
15534; O0-NEXT:    .cfi_def_cfa_offset 8
15535; O0-NEXT:    retq
15536;
15537; O1-LABEL: atomic128_nand_seq_cst:
15538; O1:       # %bb.0: # %entry
15539; O1-NEXT:    pushq %rbx
15540; O1-NEXT:    .cfi_def_cfa_offset 16
15541; O1-NEXT:    .cfi_offset %rbx, -16
15542; O1-NEXT:    movq foo(%rip), %rax
15543; O1-NEXT:  .Lpcsection617:
15544; O1-NEXT:    movq (%rdi), %rax
15545; O1-NEXT:  .Lpcsection618:
15546; O1-NEXT:    movq 8(%rdi), %rdx
15547; O1-NEXT:  .Lpcsection619:
15548; O1-NEXT:    movq $-1, %rcx
15549; O1-NEXT:    .p2align 4
15550; O1-NEXT:  .LBB242_1: # %atomicrmw.start
15551; O1-NEXT:    # =>This Inner Loop Header: Depth=1
15552; O1-NEXT:    movl %eax, %ebx
15553; O1-NEXT:  .Lpcsection620:
15554; O1-NEXT:    notl %ebx
15555; O1-NEXT:  .Lpcsection621:
15556; O1-NEXT:    orq $-43, %rbx
15557; O1-NEXT:  .Lpcsection622:
15558; O1-NEXT:    lock cmpxchg16b (%rdi)
15559; O1-NEXT:  .Lpcsection623:
15560; O1-NEXT:    jne .LBB242_1
15561; O1-NEXT:  # %bb.2: # %atomicrmw.end
15562; O1-NEXT:    movq $1, foo(%rip)
15563; O1-NEXT:    popq %rbx
15564; O1-NEXT:    .cfi_def_cfa_offset 8
15565; O1-NEXT:    retq
15566;
15567; O2-LABEL: atomic128_nand_seq_cst:
15568; O2:       # %bb.0: # %entry
15569; O2-NEXT:    pushq %rbx
15570; O2-NEXT:    .cfi_def_cfa_offset 16
15571; O2-NEXT:    .cfi_offset %rbx, -16
15572; O2-NEXT:    movq foo(%rip), %rax
15573; O2-NEXT:  .Lpcsection617:
15574; O2-NEXT:    movq (%rdi), %rax
15575; O2-NEXT:  .Lpcsection618:
15576; O2-NEXT:    movq 8(%rdi), %rdx
15577; O2-NEXT:  .Lpcsection619:
15578; O2-NEXT:    movq $-1, %rcx
15579; O2-NEXT:    .p2align 4
15580; O2-NEXT:  .LBB242_1: # %atomicrmw.start
15581; O2-NEXT:    # =>This Inner Loop Header: Depth=1
15582; O2-NEXT:    movl %eax, %ebx
15583; O2-NEXT:  .Lpcsection620:
15584; O2-NEXT:    notl %ebx
15585; O2-NEXT:  .Lpcsection621:
15586; O2-NEXT:    orq $-43, %rbx
15587; O2-NEXT:  .Lpcsection622:
15588; O2-NEXT:    lock cmpxchg16b (%rdi)
15589; O2-NEXT:  .Lpcsection623:
15590; O2-NEXT:    jne .LBB242_1
15591; O2-NEXT:  # %bb.2: # %atomicrmw.end
15592; O2-NEXT:    movq $1, foo(%rip)
15593; O2-NEXT:    popq %rbx
15594; O2-NEXT:    .cfi_def_cfa_offset 8
15595; O2-NEXT:    retq
15596;
15597; O3-LABEL: atomic128_nand_seq_cst:
15598; O3:       # %bb.0: # %entry
15599; O3-NEXT:    pushq %rbx
15600; O3-NEXT:    .cfi_def_cfa_offset 16
15601; O3-NEXT:    .cfi_offset %rbx, -16
15602; O3-NEXT:    movq foo(%rip), %rax
15603; O3-NEXT:  .Lpcsection617:
15604; O3-NEXT:    movq (%rdi), %rax
15605; O3-NEXT:  .Lpcsection618:
15606; O3-NEXT:    movq 8(%rdi), %rdx
15607; O3-NEXT:  .Lpcsection619:
15608; O3-NEXT:    movq $-1, %rcx
15609; O3-NEXT:    .p2align 4
15610; O3-NEXT:  .LBB242_1: # %atomicrmw.start
15611; O3-NEXT:    # =>This Inner Loop Header: Depth=1
15612; O3-NEXT:    movl %eax, %ebx
15613; O3-NEXT:  .Lpcsection620:
15614; O3-NEXT:    notl %ebx
15615; O3-NEXT:  .Lpcsection621:
15616; O3-NEXT:    orq $-43, %rbx
15617; O3-NEXT:  .Lpcsection622:
15618; O3-NEXT:    lock cmpxchg16b (%rdi)
15619; O3-NEXT:  .Lpcsection623:
15620; O3-NEXT:    jne .LBB242_1
15621; O3-NEXT:  # %bb.2: # %atomicrmw.end
15622; O3-NEXT:    movq $1, foo(%rip)
15623; O3-NEXT:    popq %rbx
15624; O3-NEXT:    .cfi_def_cfa_offset 8
15625; O3-NEXT:    retq
15626entry:
15627  load volatile i64, ptr @foo, align 8
15628  %x = atomicrmw nand ptr %a, i128 42 seq_cst, align 16, !pcsections !0
15629  store volatile i64 1, ptr @foo, align 8
15630  ret void
15631}
15632
15633define void @atomic128_cas_monotonic(ptr %a) {
15634; O0-LABEL: atomic128_cas_monotonic:
15635; O0:       # %bb.0: # %entry
15636; O0-NEXT:    pushq %rbx
15637; O0-NEXT:    .cfi_def_cfa_offset 16
15638; O0-NEXT:    .cfi_offset %rbx, -16
15639; O0-NEXT:    movq foo(%rip), %rax
15640; O0-NEXT:  .Lpcsection711:
15641; O0-NEXT:    xorl %eax, %eax
15642; O0-NEXT:    movl %eax, %ecx
15643; O0-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15644; O0-NEXT:  .Lpcsection712:
15645; O0-NEXT:    movl $42, %eax
15646; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15647; O0-NEXT:  .Lpcsection713:
15648; O0-NEXT:    movl $1, %ebx
15649; O0-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15650; O0-NEXT:    movq %rcx, %rdx
15651; O0-NEXT:  .Lpcsection714:
15652; O0-NEXT:    lock cmpxchg16b (%rdi)
15653; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15654; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15655; O0-NEXT:  .Lpcsection715:
15656; O0-NEXT:    # kill: def $rsi killed $rax
15657; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15658; O0-NEXT:    movq %rcx, %rdx
15659; O0-NEXT:  .Lpcsection716:
15660; O0-NEXT:    lock cmpxchg16b (%rdi)
15661; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15662; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15663; O0-NEXT:  .Lpcsection717:
15664; O0-NEXT:    # kill: def $rsi killed $rax
15665; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15666; O0-NEXT:    movq %rcx, %rdx
15667; O0-NEXT:  .Lpcsection718:
15668; O0-NEXT:    lock cmpxchg16b (%rdi)
15669; O0-NEXT:    movq $1, foo
15670; O0-NEXT:    popq %rbx
15671; O0-NEXT:    .cfi_def_cfa_offset 8
15672; O0-NEXT:    retq
15673;
15674; O1-LABEL: atomic128_cas_monotonic:
15675; O1:       # %bb.0: # %entry
15676; O1-NEXT:    pushq %rbx
15677; O1-NEXT:    .cfi_def_cfa_offset 16
15678; O1-NEXT:    .cfi_offset %rbx, -16
15679; O1-NEXT:    movq foo(%rip), %rax
15680; O1-NEXT:  .Lpcsection624:
15681; O1-NEXT:    movl $42, %eax
15682; O1-NEXT:  .Lpcsection625:
15683; O1-NEXT:    movl $1, %ebx
15684; O1-NEXT:  .Lpcsection626:
15685; O1-NEXT:    xorl %edx, %edx
15686; O1-NEXT:  .Lpcsection627:
15687; O1-NEXT:    xorl %ecx, %ecx
15688; O1-NEXT:  .Lpcsection628:
15689; O1-NEXT:    lock cmpxchg16b (%rdi)
15690; O1-NEXT:  .Lpcsection629:
15691; O1-NEXT:    movl $42, %eax
15692; O1-NEXT:  .Lpcsection630:
15693; O1-NEXT:    xorl %edx, %edx
15694; O1-NEXT:  .Lpcsection631:
15695; O1-NEXT:    xorl %ecx, %ecx
15696; O1-NEXT:  .Lpcsection632:
15697; O1-NEXT:    lock cmpxchg16b (%rdi)
15698; O1-NEXT:  .Lpcsection633:
15699; O1-NEXT:    movl $42, %eax
15700; O1-NEXT:  .Lpcsection634:
15701; O1-NEXT:    xorl %edx, %edx
15702; O1-NEXT:  .Lpcsection635:
15703; O1-NEXT:    xorl %ecx, %ecx
15704; O1-NEXT:  .Lpcsection636:
15705; O1-NEXT:    lock cmpxchg16b (%rdi)
15706; O1-NEXT:    movq $1, foo(%rip)
15707; O1-NEXT:    popq %rbx
15708; O1-NEXT:    .cfi_def_cfa_offset 8
15709; O1-NEXT:    retq
15710;
15711; O2-LABEL: atomic128_cas_monotonic:
15712; O2:       # %bb.0: # %entry
15713; O2-NEXT:    pushq %rbx
15714; O2-NEXT:    .cfi_def_cfa_offset 16
15715; O2-NEXT:    .cfi_offset %rbx, -16
15716; O2-NEXT:    movq foo(%rip), %rax
15717; O2-NEXT:  .Lpcsection624:
15718; O2-NEXT:    movl $42, %eax
15719; O2-NEXT:  .Lpcsection625:
15720; O2-NEXT:    movl $1, %ebx
15721; O2-NEXT:  .Lpcsection626:
15722; O2-NEXT:    xorl %edx, %edx
15723; O2-NEXT:  .Lpcsection627:
15724; O2-NEXT:    xorl %ecx, %ecx
15725; O2-NEXT:  .Lpcsection628:
15726; O2-NEXT:    lock cmpxchg16b (%rdi)
15727; O2-NEXT:  .Lpcsection629:
15728; O2-NEXT:    movl $42, %eax
15729; O2-NEXT:  .Lpcsection630:
15730; O2-NEXT:    xorl %edx, %edx
15731; O2-NEXT:  .Lpcsection631:
15732; O2-NEXT:    xorl %ecx, %ecx
15733; O2-NEXT:  .Lpcsection632:
15734; O2-NEXT:    lock cmpxchg16b (%rdi)
15735; O2-NEXT:  .Lpcsection633:
15736; O2-NEXT:    movl $42, %eax
15737; O2-NEXT:  .Lpcsection634:
15738; O2-NEXT:    xorl %edx, %edx
15739; O2-NEXT:  .Lpcsection635:
15740; O2-NEXT:    xorl %ecx, %ecx
15741; O2-NEXT:  .Lpcsection636:
15742; O2-NEXT:    lock cmpxchg16b (%rdi)
15743; O2-NEXT:    movq $1, foo(%rip)
15744; O2-NEXT:    popq %rbx
15745; O2-NEXT:    .cfi_def_cfa_offset 8
15746; O2-NEXT:    retq
15747;
15748; O3-LABEL: atomic128_cas_monotonic:
15749; O3:       # %bb.0: # %entry
15750; O3-NEXT:    pushq %rbx
15751; O3-NEXT:    .cfi_def_cfa_offset 16
15752; O3-NEXT:    .cfi_offset %rbx, -16
15753; O3-NEXT:    movq foo(%rip), %rax
15754; O3-NEXT:  .Lpcsection624:
15755; O3-NEXT:    movl $42, %eax
15756; O3-NEXT:  .Lpcsection625:
15757; O3-NEXT:    movl $1, %ebx
15758; O3-NEXT:  .Lpcsection626:
15759; O3-NEXT:    xorl %edx, %edx
15760; O3-NEXT:  .Lpcsection627:
15761; O3-NEXT:    xorl %ecx, %ecx
15762; O3-NEXT:  .Lpcsection628:
15763; O3-NEXT:    lock cmpxchg16b (%rdi)
15764; O3-NEXT:  .Lpcsection629:
15765; O3-NEXT:    movl $42, %eax
15766; O3-NEXT:  .Lpcsection630:
15767; O3-NEXT:    xorl %edx, %edx
15768; O3-NEXT:  .Lpcsection631:
15769; O3-NEXT:    xorl %ecx, %ecx
15770; O3-NEXT:  .Lpcsection632:
15771; O3-NEXT:    lock cmpxchg16b (%rdi)
15772; O3-NEXT:  .Lpcsection633:
15773; O3-NEXT:    movl $42, %eax
15774; O3-NEXT:  .Lpcsection634:
15775; O3-NEXT:    xorl %edx, %edx
15776; O3-NEXT:  .Lpcsection635:
15777; O3-NEXT:    xorl %ecx, %ecx
15778; O3-NEXT:  .Lpcsection636:
15779; O3-NEXT:    lock cmpxchg16b (%rdi)
15780; O3-NEXT:    movq $1, foo(%rip)
15781; O3-NEXT:    popq %rbx
15782; O3-NEXT:    .cfi_def_cfa_offset 8
15783; O3-NEXT:    retq
15784entry:
15785  load volatile i64, ptr @foo, align 8
15786  %x = cmpxchg ptr %a, i128 42, i128 1 monotonic monotonic, align 16, !pcsections !0
15787  %y = cmpxchg ptr %a, i128 42, i128 1 monotonic acquire, align 16, !pcsections !0
15788  %z = cmpxchg ptr %a, i128 42, i128 1 monotonic seq_cst, align 16, !pcsections !0
15789  store volatile i64 1, ptr @foo, align 8
15790  ret void
15791}
15792
15793define void @atomic128_cas_acquire(ptr %a) {
15794; O0-LABEL: atomic128_cas_acquire:
15795; O0:       # %bb.0: # %entry
15796; O0-NEXT:    pushq %rbx
15797; O0-NEXT:    .cfi_def_cfa_offset 16
15798; O0-NEXT:    .cfi_offset %rbx, -16
15799; O0-NEXT:    movq foo(%rip), %rax
15800; O0-NEXT:  .Lpcsection719:
15801; O0-NEXT:    xorl %eax, %eax
15802; O0-NEXT:    movl %eax, %ecx
15803; O0-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15804; O0-NEXT:  .Lpcsection720:
15805; O0-NEXT:    movl $42, %eax
15806; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15807; O0-NEXT:  .Lpcsection721:
15808; O0-NEXT:    movl $1, %ebx
15809; O0-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15810; O0-NEXT:    movq %rcx, %rdx
15811; O0-NEXT:  .Lpcsection722:
15812; O0-NEXT:    lock cmpxchg16b (%rdi)
15813; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15814; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15815; O0-NEXT:  .Lpcsection723:
15816; O0-NEXT:    # kill: def $rsi killed $rax
15817; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15818; O0-NEXT:    movq %rcx, %rdx
15819; O0-NEXT:  .Lpcsection724:
15820; O0-NEXT:    lock cmpxchg16b (%rdi)
15821; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15822; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15823; O0-NEXT:  .Lpcsection725:
15824; O0-NEXT:    # kill: def $rsi killed $rax
15825; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15826; O0-NEXT:    movq %rcx, %rdx
15827; O0-NEXT:  .Lpcsection726:
15828; O0-NEXT:    lock cmpxchg16b (%rdi)
15829; O0-NEXT:    movq $1, foo
15830; O0-NEXT:    popq %rbx
15831; O0-NEXT:    .cfi_def_cfa_offset 8
15832; O0-NEXT:    retq
15833;
15834; O1-LABEL: atomic128_cas_acquire:
15835; O1:       # %bb.0: # %entry
15836; O1-NEXT:    pushq %rbx
15837; O1-NEXT:    .cfi_def_cfa_offset 16
15838; O1-NEXT:    .cfi_offset %rbx, -16
15839; O1-NEXT:    movq foo(%rip), %rax
15840; O1-NEXT:  .Lpcsection637:
15841; O1-NEXT:    movl $42, %eax
15842; O1-NEXT:  .Lpcsection638:
15843; O1-NEXT:    movl $1, %ebx
15844; O1-NEXT:  .Lpcsection639:
15845; O1-NEXT:    xorl %edx, %edx
15846; O1-NEXT:  .Lpcsection640:
15847; O1-NEXT:    xorl %ecx, %ecx
15848; O1-NEXT:  .Lpcsection641:
15849; O1-NEXT:    lock cmpxchg16b (%rdi)
15850; O1-NEXT:  .Lpcsection642:
15851; O1-NEXT:    movl $42, %eax
15852; O1-NEXT:  .Lpcsection643:
15853; O1-NEXT:    xorl %edx, %edx
15854; O1-NEXT:  .Lpcsection644:
15855; O1-NEXT:    xorl %ecx, %ecx
15856; O1-NEXT:  .Lpcsection645:
15857; O1-NEXT:    lock cmpxchg16b (%rdi)
15858; O1-NEXT:  .Lpcsection646:
15859; O1-NEXT:    movl $42, %eax
15860; O1-NEXT:  .Lpcsection647:
15861; O1-NEXT:    xorl %edx, %edx
15862; O1-NEXT:  .Lpcsection648:
15863; O1-NEXT:    xorl %ecx, %ecx
15864; O1-NEXT:  .Lpcsection649:
15865; O1-NEXT:    lock cmpxchg16b (%rdi)
15866; O1-NEXT:    movq $1, foo(%rip)
15867; O1-NEXT:    popq %rbx
15868; O1-NEXT:    .cfi_def_cfa_offset 8
15869; O1-NEXT:    retq
15870;
15871; O2-LABEL: atomic128_cas_acquire:
15872; O2:       # %bb.0: # %entry
15873; O2-NEXT:    pushq %rbx
15874; O2-NEXT:    .cfi_def_cfa_offset 16
15875; O2-NEXT:    .cfi_offset %rbx, -16
15876; O2-NEXT:    movq foo(%rip), %rax
15877; O2-NEXT:  .Lpcsection637:
15878; O2-NEXT:    movl $42, %eax
15879; O2-NEXT:  .Lpcsection638:
15880; O2-NEXT:    movl $1, %ebx
15881; O2-NEXT:  .Lpcsection639:
15882; O2-NEXT:    xorl %edx, %edx
15883; O2-NEXT:  .Lpcsection640:
15884; O2-NEXT:    xorl %ecx, %ecx
15885; O2-NEXT:  .Lpcsection641:
15886; O2-NEXT:    lock cmpxchg16b (%rdi)
15887; O2-NEXT:  .Lpcsection642:
15888; O2-NEXT:    movl $42, %eax
15889; O2-NEXT:  .Lpcsection643:
15890; O2-NEXT:    xorl %edx, %edx
15891; O2-NEXT:  .Lpcsection644:
15892; O2-NEXT:    xorl %ecx, %ecx
15893; O2-NEXT:  .Lpcsection645:
15894; O2-NEXT:    lock cmpxchg16b (%rdi)
15895; O2-NEXT:  .Lpcsection646:
15896; O2-NEXT:    movl $42, %eax
15897; O2-NEXT:  .Lpcsection647:
15898; O2-NEXT:    xorl %edx, %edx
15899; O2-NEXT:  .Lpcsection648:
15900; O2-NEXT:    xorl %ecx, %ecx
15901; O2-NEXT:  .Lpcsection649:
15902; O2-NEXT:    lock cmpxchg16b (%rdi)
15903; O2-NEXT:    movq $1, foo(%rip)
15904; O2-NEXT:    popq %rbx
15905; O2-NEXT:    .cfi_def_cfa_offset 8
15906; O2-NEXT:    retq
15907;
15908; O3-LABEL: atomic128_cas_acquire:
15909; O3:       # %bb.0: # %entry
15910; O3-NEXT:    pushq %rbx
15911; O3-NEXT:    .cfi_def_cfa_offset 16
15912; O3-NEXT:    .cfi_offset %rbx, -16
15913; O3-NEXT:    movq foo(%rip), %rax
15914; O3-NEXT:  .Lpcsection637:
15915; O3-NEXT:    movl $42, %eax
15916; O3-NEXT:  .Lpcsection638:
15917; O3-NEXT:    movl $1, %ebx
15918; O3-NEXT:  .Lpcsection639:
15919; O3-NEXT:    xorl %edx, %edx
15920; O3-NEXT:  .Lpcsection640:
15921; O3-NEXT:    xorl %ecx, %ecx
15922; O3-NEXT:  .Lpcsection641:
15923; O3-NEXT:    lock cmpxchg16b (%rdi)
15924; O3-NEXT:  .Lpcsection642:
15925; O3-NEXT:    movl $42, %eax
15926; O3-NEXT:  .Lpcsection643:
15927; O3-NEXT:    xorl %edx, %edx
15928; O3-NEXT:  .Lpcsection644:
15929; O3-NEXT:    xorl %ecx, %ecx
15930; O3-NEXT:  .Lpcsection645:
15931; O3-NEXT:    lock cmpxchg16b (%rdi)
15932; O3-NEXT:  .Lpcsection646:
15933; O3-NEXT:    movl $42, %eax
15934; O3-NEXT:  .Lpcsection647:
15935; O3-NEXT:    xorl %edx, %edx
15936; O3-NEXT:  .Lpcsection648:
15937; O3-NEXT:    xorl %ecx, %ecx
15938; O3-NEXT:  .Lpcsection649:
15939; O3-NEXT:    lock cmpxchg16b (%rdi)
15940; O3-NEXT:    movq $1, foo(%rip)
15941; O3-NEXT:    popq %rbx
15942; O3-NEXT:    .cfi_def_cfa_offset 8
15943; O3-NEXT:    retq
15944entry:
15945  load volatile i64, ptr @foo, align 8
15946  %x = cmpxchg ptr %a, i128 42, i128 1 acquire monotonic, align 16, !pcsections !0
15947  %y = cmpxchg ptr %a, i128 42, i128 1 acquire acquire, align 16, !pcsections !0
15948  %z = cmpxchg ptr %a, i128 42, i128 1 acquire seq_cst, align 16, !pcsections !0
15949  store volatile i64 1, ptr @foo, align 8
15950  ret void
15951}
15952
15953define void @atomic128_cas_release(ptr %a) {
15954; O0-LABEL: atomic128_cas_release:
15955; O0:       # %bb.0: # %entry
15956; O0-NEXT:    pushq %rbx
15957; O0-NEXT:    .cfi_def_cfa_offset 16
15958; O0-NEXT:    .cfi_offset %rbx, -16
15959; O0-NEXT:    movq foo(%rip), %rax
15960; O0-NEXT:  .Lpcsection727:
15961; O0-NEXT:    xorl %eax, %eax
15962; O0-NEXT:    movl %eax, %ecx
15963; O0-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15964; O0-NEXT:  .Lpcsection728:
15965; O0-NEXT:    movl $42, %eax
15966; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15967; O0-NEXT:  .Lpcsection729:
15968; O0-NEXT:    movl $1, %ebx
15969; O0-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
15970; O0-NEXT:    movq %rcx, %rdx
15971; O0-NEXT:  .Lpcsection730:
15972; O0-NEXT:    lock cmpxchg16b (%rdi)
15973; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15974; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15975; O0-NEXT:  .Lpcsection731:
15976; O0-NEXT:    # kill: def $rsi killed $rax
15977; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15978; O0-NEXT:    movq %rcx, %rdx
15979; O0-NEXT:  .Lpcsection732:
15980; O0-NEXT:    lock cmpxchg16b (%rdi)
15981; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
15982; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
15983; O0-NEXT:  .Lpcsection733:
15984; O0-NEXT:    # kill: def $rsi killed $rax
15985; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
15986; O0-NEXT:    movq %rcx, %rdx
15987; O0-NEXT:  .Lpcsection734:
15988; O0-NEXT:    lock cmpxchg16b (%rdi)
15989; O0-NEXT:    movq $1, foo
15990; O0-NEXT:    popq %rbx
15991; O0-NEXT:    .cfi_def_cfa_offset 8
15992; O0-NEXT:    retq
15993;
15994; O1-LABEL: atomic128_cas_release:
15995; O1:       # %bb.0: # %entry
15996; O1-NEXT:    pushq %rbx
15997; O1-NEXT:    .cfi_def_cfa_offset 16
15998; O1-NEXT:    .cfi_offset %rbx, -16
15999; O1-NEXT:    movq foo(%rip), %rax
16000; O1-NEXT:  .Lpcsection650:
16001; O1-NEXT:    movl $42, %eax
16002; O1-NEXT:  .Lpcsection651:
16003; O1-NEXT:    movl $1, %ebx
16004; O1-NEXT:  .Lpcsection652:
16005; O1-NEXT:    xorl %edx, %edx
16006; O1-NEXT:  .Lpcsection653:
16007; O1-NEXT:    xorl %ecx, %ecx
16008; O1-NEXT:  .Lpcsection654:
16009; O1-NEXT:    lock cmpxchg16b (%rdi)
16010; O1-NEXT:  .Lpcsection655:
16011; O1-NEXT:    movl $42, %eax
16012; O1-NEXT:  .Lpcsection656:
16013; O1-NEXT:    xorl %edx, %edx
16014; O1-NEXT:  .Lpcsection657:
16015; O1-NEXT:    xorl %ecx, %ecx
16016; O1-NEXT:  .Lpcsection658:
16017; O1-NEXT:    lock cmpxchg16b (%rdi)
16018; O1-NEXT:  .Lpcsection659:
16019; O1-NEXT:    movl $42, %eax
16020; O1-NEXT:  .Lpcsection660:
16021; O1-NEXT:    xorl %edx, %edx
16022; O1-NEXT:  .Lpcsection661:
16023; O1-NEXT:    xorl %ecx, %ecx
16024; O1-NEXT:  .Lpcsection662:
16025; O1-NEXT:    lock cmpxchg16b (%rdi)
16026; O1-NEXT:    movq $1, foo(%rip)
16027; O1-NEXT:    popq %rbx
16028; O1-NEXT:    .cfi_def_cfa_offset 8
16029; O1-NEXT:    retq
16030;
16031; O2-LABEL: atomic128_cas_release:
16032; O2:       # %bb.0: # %entry
16033; O2-NEXT:    pushq %rbx
16034; O2-NEXT:    .cfi_def_cfa_offset 16
16035; O2-NEXT:    .cfi_offset %rbx, -16
16036; O2-NEXT:    movq foo(%rip), %rax
16037; O2-NEXT:  .Lpcsection650:
16038; O2-NEXT:    movl $42, %eax
16039; O2-NEXT:  .Lpcsection651:
16040; O2-NEXT:    movl $1, %ebx
16041; O2-NEXT:  .Lpcsection652:
16042; O2-NEXT:    xorl %edx, %edx
16043; O2-NEXT:  .Lpcsection653:
16044; O2-NEXT:    xorl %ecx, %ecx
16045; O2-NEXT:  .Lpcsection654:
16046; O2-NEXT:    lock cmpxchg16b (%rdi)
16047; O2-NEXT:  .Lpcsection655:
16048; O2-NEXT:    movl $42, %eax
16049; O2-NEXT:  .Lpcsection656:
16050; O2-NEXT:    xorl %edx, %edx
16051; O2-NEXT:  .Lpcsection657:
16052; O2-NEXT:    xorl %ecx, %ecx
16053; O2-NEXT:  .Lpcsection658:
16054; O2-NEXT:    lock cmpxchg16b (%rdi)
16055; O2-NEXT:  .Lpcsection659:
16056; O2-NEXT:    movl $42, %eax
16057; O2-NEXT:  .Lpcsection660:
16058; O2-NEXT:    xorl %edx, %edx
16059; O2-NEXT:  .Lpcsection661:
16060; O2-NEXT:    xorl %ecx, %ecx
16061; O2-NEXT:  .Lpcsection662:
16062; O2-NEXT:    lock cmpxchg16b (%rdi)
16063; O2-NEXT:    movq $1, foo(%rip)
16064; O2-NEXT:    popq %rbx
16065; O2-NEXT:    .cfi_def_cfa_offset 8
16066; O2-NEXT:    retq
16067;
16068; O3-LABEL: atomic128_cas_release:
16069; O3:       # %bb.0: # %entry
16070; O3-NEXT:    pushq %rbx
16071; O3-NEXT:    .cfi_def_cfa_offset 16
16072; O3-NEXT:    .cfi_offset %rbx, -16
16073; O3-NEXT:    movq foo(%rip), %rax
16074; O3-NEXT:  .Lpcsection650:
16075; O3-NEXT:    movl $42, %eax
16076; O3-NEXT:  .Lpcsection651:
16077; O3-NEXT:    movl $1, %ebx
16078; O3-NEXT:  .Lpcsection652:
16079; O3-NEXT:    xorl %edx, %edx
16080; O3-NEXT:  .Lpcsection653:
16081; O3-NEXT:    xorl %ecx, %ecx
16082; O3-NEXT:  .Lpcsection654:
16083; O3-NEXT:    lock cmpxchg16b (%rdi)
16084; O3-NEXT:  .Lpcsection655:
16085; O3-NEXT:    movl $42, %eax
16086; O3-NEXT:  .Lpcsection656:
16087; O3-NEXT:    xorl %edx, %edx
16088; O3-NEXT:  .Lpcsection657:
16089; O3-NEXT:    xorl %ecx, %ecx
16090; O3-NEXT:  .Lpcsection658:
16091; O3-NEXT:    lock cmpxchg16b (%rdi)
16092; O3-NEXT:  .Lpcsection659:
16093; O3-NEXT:    movl $42, %eax
16094; O3-NEXT:  .Lpcsection660:
16095; O3-NEXT:    xorl %edx, %edx
16096; O3-NEXT:  .Lpcsection661:
16097; O3-NEXT:    xorl %ecx, %ecx
16098; O3-NEXT:  .Lpcsection662:
16099; O3-NEXT:    lock cmpxchg16b (%rdi)
16100; O3-NEXT:    movq $1, foo(%rip)
16101; O3-NEXT:    popq %rbx
16102; O3-NEXT:    .cfi_def_cfa_offset 8
16103; O3-NEXT:    retq
16104entry:
16105  load volatile i64, ptr @foo, align 8
16106  %x = cmpxchg ptr %a, i128 42, i128 1 release monotonic, align 16, !pcsections !0
16107  %y = cmpxchg ptr %a, i128 42, i128 1 release acquire, align 16, !pcsections !0
16108  %z = cmpxchg ptr %a, i128 42, i128 1 release seq_cst, align 16, !pcsections !0
16109  store volatile i64 1, ptr @foo, align 8
16110  ret void
16111}
16112
16113define void @atomic128_cas_acq_rel(ptr %a) {
16114; O0-LABEL: atomic128_cas_acq_rel:
16115; O0:       # %bb.0: # %entry
16116; O0-NEXT:    pushq %rbx
16117; O0-NEXT:    .cfi_def_cfa_offset 16
16118; O0-NEXT:    .cfi_offset %rbx, -16
16119; O0-NEXT:    movq foo(%rip), %rax
16120; O0-NEXT:  .Lpcsection735:
16121; O0-NEXT:    xorl %eax, %eax
16122; O0-NEXT:    movl %eax, %ecx
16123; O0-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16124; O0-NEXT:  .Lpcsection736:
16125; O0-NEXT:    movl $42, %eax
16126; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16127; O0-NEXT:  .Lpcsection737:
16128; O0-NEXT:    movl $1, %ebx
16129; O0-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16130; O0-NEXT:    movq %rcx, %rdx
16131; O0-NEXT:  .Lpcsection738:
16132; O0-NEXT:    lock cmpxchg16b (%rdi)
16133; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
16134; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
16135; O0-NEXT:  .Lpcsection739:
16136; O0-NEXT:    # kill: def $rsi killed $rax
16137; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
16138; O0-NEXT:    movq %rcx, %rdx
16139; O0-NEXT:  .Lpcsection740:
16140; O0-NEXT:    lock cmpxchg16b (%rdi)
16141; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
16142; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
16143; O0-NEXT:  .Lpcsection741:
16144; O0-NEXT:    # kill: def $rsi killed $rax
16145; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
16146; O0-NEXT:    movq %rcx, %rdx
16147; O0-NEXT:  .Lpcsection742:
16148; O0-NEXT:    lock cmpxchg16b (%rdi)
16149; O0-NEXT:    movq $1, foo
16150; O0-NEXT:    popq %rbx
16151; O0-NEXT:    .cfi_def_cfa_offset 8
16152; O0-NEXT:    retq
16153;
16154; O1-LABEL: atomic128_cas_acq_rel:
16155; O1:       # %bb.0: # %entry
16156; O1-NEXT:    pushq %rbx
16157; O1-NEXT:    .cfi_def_cfa_offset 16
16158; O1-NEXT:    .cfi_offset %rbx, -16
16159; O1-NEXT:    movq foo(%rip), %rax
16160; O1-NEXT:  .Lpcsection663:
16161; O1-NEXT:    movl $42, %eax
16162; O1-NEXT:  .Lpcsection664:
16163; O1-NEXT:    movl $1, %ebx
16164; O1-NEXT:  .Lpcsection665:
16165; O1-NEXT:    xorl %edx, %edx
16166; O1-NEXT:  .Lpcsection666:
16167; O1-NEXT:    xorl %ecx, %ecx
16168; O1-NEXT:  .Lpcsection667:
16169; O1-NEXT:    lock cmpxchg16b (%rdi)
16170; O1-NEXT:  .Lpcsection668:
16171; O1-NEXT:    movl $42, %eax
16172; O1-NEXT:  .Lpcsection669:
16173; O1-NEXT:    xorl %edx, %edx
16174; O1-NEXT:  .Lpcsection670:
16175; O1-NEXT:    xorl %ecx, %ecx
16176; O1-NEXT:  .Lpcsection671:
16177; O1-NEXT:    lock cmpxchg16b (%rdi)
16178; O1-NEXT:  .Lpcsection672:
16179; O1-NEXT:    movl $42, %eax
16180; O1-NEXT:  .Lpcsection673:
16181; O1-NEXT:    xorl %edx, %edx
16182; O1-NEXT:  .Lpcsection674:
16183; O1-NEXT:    xorl %ecx, %ecx
16184; O1-NEXT:  .Lpcsection675:
16185; O1-NEXT:    lock cmpxchg16b (%rdi)
16186; O1-NEXT:    movq $1, foo(%rip)
16187; O1-NEXT:    popq %rbx
16188; O1-NEXT:    .cfi_def_cfa_offset 8
16189; O1-NEXT:    retq
16190;
16191; O2-LABEL: atomic128_cas_acq_rel:
16192; O2:       # %bb.0: # %entry
16193; O2-NEXT:    pushq %rbx
16194; O2-NEXT:    .cfi_def_cfa_offset 16
16195; O2-NEXT:    .cfi_offset %rbx, -16
16196; O2-NEXT:    movq foo(%rip), %rax
16197; O2-NEXT:  .Lpcsection663:
16198; O2-NEXT:    movl $42, %eax
16199; O2-NEXT:  .Lpcsection664:
16200; O2-NEXT:    movl $1, %ebx
16201; O2-NEXT:  .Lpcsection665:
16202; O2-NEXT:    xorl %edx, %edx
16203; O2-NEXT:  .Lpcsection666:
16204; O2-NEXT:    xorl %ecx, %ecx
16205; O2-NEXT:  .Lpcsection667:
16206; O2-NEXT:    lock cmpxchg16b (%rdi)
16207; O2-NEXT:  .Lpcsection668:
16208; O2-NEXT:    movl $42, %eax
16209; O2-NEXT:  .Lpcsection669:
16210; O2-NEXT:    xorl %edx, %edx
16211; O2-NEXT:  .Lpcsection670:
16212; O2-NEXT:    xorl %ecx, %ecx
16213; O2-NEXT:  .Lpcsection671:
16214; O2-NEXT:    lock cmpxchg16b (%rdi)
16215; O2-NEXT:  .Lpcsection672:
16216; O2-NEXT:    movl $42, %eax
16217; O2-NEXT:  .Lpcsection673:
16218; O2-NEXT:    xorl %edx, %edx
16219; O2-NEXT:  .Lpcsection674:
16220; O2-NEXT:    xorl %ecx, %ecx
16221; O2-NEXT:  .Lpcsection675:
16222; O2-NEXT:    lock cmpxchg16b (%rdi)
16223; O2-NEXT:    movq $1, foo(%rip)
16224; O2-NEXT:    popq %rbx
16225; O2-NEXT:    .cfi_def_cfa_offset 8
16226; O2-NEXT:    retq
16227;
16228; O3-LABEL: atomic128_cas_acq_rel:
16229; O3:       # %bb.0: # %entry
16230; O3-NEXT:    pushq %rbx
16231; O3-NEXT:    .cfi_def_cfa_offset 16
16232; O3-NEXT:    .cfi_offset %rbx, -16
16233; O3-NEXT:    movq foo(%rip), %rax
16234; O3-NEXT:  .Lpcsection663:
16235; O3-NEXT:    movl $42, %eax
16236; O3-NEXT:  .Lpcsection664:
16237; O3-NEXT:    movl $1, %ebx
16238; O3-NEXT:  .Lpcsection665:
16239; O3-NEXT:    xorl %edx, %edx
16240; O3-NEXT:  .Lpcsection666:
16241; O3-NEXT:    xorl %ecx, %ecx
16242; O3-NEXT:  .Lpcsection667:
16243; O3-NEXT:    lock cmpxchg16b (%rdi)
16244; O3-NEXT:  .Lpcsection668:
16245; O3-NEXT:    movl $42, %eax
16246; O3-NEXT:  .Lpcsection669:
16247; O3-NEXT:    xorl %edx, %edx
16248; O3-NEXT:  .Lpcsection670:
16249; O3-NEXT:    xorl %ecx, %ecx
16250; O3-NEXT:  .Lpcsection671:
16251; O3-NEXT:    lock cmpxchg16b (%rdi)
16252; O3-NEXT:  .Lpcsection672:
16253; O3-NEXT:    movl $42, %eax
16254; O3-NEXT:  .Lpcsection673:
16255; O3-NEXT:    xorl %edx, %edx
16256; O3-NEXT:  .Lpcsection674:
16257; O3-NEXT:    xorl %ecx, %ecx
16258; O3-NEXT:  .Lpcsection675:
16259; O3-NEXT:    lock cmpxchg16b (%rdi)
16260; O3-NEXT:    movq $1, foo(%rip)
16261; O3-NEXT:    popq %rbx
16262; O3-NEXT:    .cfi_def_cfa_offset 8
16263; O3-NEXT:    retq
16264entry:
16265  load volatile i64, ptr @foo, align 8
16266  %x = cmpxchg ptr %a, i128 42, i128 1 acq_rel monotonic, align 16, !pcsections !0
16267  %y = cmpxchg ptr %a, i128 42, i128 1 acq_rel acquire, align 16, !pcsections !0
16268  %z = cmpxchg ptr %a, i128 42, i128 1 acq_rel seq_cst, align 16, !pcsections !0
16269  store volatile i64 1, ptr @foo, align 8
16270  ret void
16271}
16272
16273define void @atomic128_cas_seq_cst(ptr %a) {
16274; O0-LABEL: atomic128_cas_seq_cst:
16275; O0:       # %bb.0: # %entry
16276; O0-NEXT:    pushq %rbx
16277; O0-NEXT:    .cfi_def_cfa_offset 16
16278; O0-NEXT:    .cfi_offset %rbx, -16
16279; O0-NEXT:    movq foo(%rip), %rax
16280; O0-NEXT:  .Lpcsection743:
16281; O0-NEXT:    xorl %eax, %eax
16282; O0-NEXT:    movl %eax, %ecx
16283; O0-NEXT:    movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16284; O0-NEXT:  .Lpcsection744:
16285; O0-NEXT:    movl $42, %eax
16286; O0-NEXT:    movq %rax, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16287; O0-NEXT:  .Lpcsection745:
16288; O0-NEXT:    movl $1, %ebx
16289; O0-NEXT:    movq %rbx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill
16290; O0-NEXT:    movq %rcx, %rdx
16291; O0-NEXT:  .Lpcsection746:
16292; O0-NEXT:    lock cmpxchg16b (%rdi)
16293; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
16294; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
16295; O0-NEXT:  .Lpcsection747:
16296; O0-NEXT:    # kill: def $rsi killed $rax
16297; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
16298; O0-NEXT:    movq %rcx, %rdx
16299; O0-NEXT:  .Lpcsection748:
16300; O0-NEXT:    lock cmpxchg16b (%rdi)
16301; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rcx # 8-byte Reload
16302; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rbx # 8-byte Reload
16303; O0-NEXT:  .Lpcsection749:
16304; O0-NEXT:    # kill: def $rsi killed $rax
16305; O0-NEXT:    movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload
16306; O0-NEXT:    movq %rcx, %rdx
16307; O0-NEXT:  .Lpcsection750:
16308; O0-NEXT:    lock cmpxchg16b (%rdi)
16309; O0-NEXT:    movq $3, foo
16310; O0-NEXT:    popq %rbx
16311; O0-NEXT:    .cfi_def_cfa_offset 8
16312; O0-NEXT:    retq
16313;
16314; O1-LABEL: atomic128_cas_seq_cst:
16315; O1:       # %bb.0: # %entry
16316; O1-NEXT:    pushq %rbx
16317; O1-NEXT:    .cfi_def_cfa_offset 16
16318; O1-NEXT:    .cfi_offset %rbx, -16
16319; O1-NEXT:    movq foo(%rip), %rax
16320; O1-NEXT:  .Lpcsection676:
16321; O1-NEXT:    movl $42, %eax
16322; O1-NEXT:  .Lpcsection677:
16323; O1-NEXT:    movl $1, %ebx
16324; O1-NEXT:  .Lpcsection678:
16325; O1-NEXT:    xorl %edx, %edx
16326; O1-NEXT:  .Lpcsection679:
16327; O1-NEXT:    xorl %ecx, %ecx
16328; O1-NEXT:  .Lpcsection680:
16329; O1-NEXT:    lock cmpxchg16b (%rdi)
16330; O1-NEXT:  .Lpcsection681:
16331; O1-NEXT:    movl $42, %eax
16332; O1-NEXT:  .Lpcsection682:
16333; O1-NEXT:    xorl %edx, %edx
16334; O1-NEXT:  .Lpcsection683:
16335; O1-NEXT:    xorl %ecx, %ecx
16336; O1-NEXT:  .Lpcsection684:
16337; O1-NEXT:    lock cmpxchg16b (%rdi)
16338; O1-NEXT:  .Lpcsection685:
16339; O1-NEXT:    movl $42, %eax
16340; O1-NEXT:  .Lpcsection686:
16341; O1-NEXT:    xorl %edx, %edx
16342; O1-NEXT:  .Lpcsection687:
16343; O1-NEXT:    xorl %ecx, %ecx
16344; O1-NEXT:  .Lpcsection688:
16345; O1-NEXT:    lock cmpxchg16b (%rdi)
16346; O1-NEXT:    movq $3, foo(%rip)
16347; O1-NEXT:    popq %rbx
16348; O1-NEXT:    .cfi_def_cfa_offset 8
16349; O1-NEXT:    retq
16350;
16351; O2-LABEL: atomic128_cas_seq_cst:
16352; O2:       # %bb.0: # %entry
16353; O2-NEXT:    pushq %rbx
16354; O2-NEXT:    .cfi_def_cfa_offset 16
16355; O2-NEXT:    .cfi_offset %rbx, -16
16356; O2-NEXT:    movq foo(%rip), %rax
16357; O2-NEXT:  .Lpcsection676:
16358; O2-NEXT:    movl $42, %eax
16359; O2-NEXT:  .Lpcsection677:
16360; O2-NEXT:    movl $1, %ebx
16361; O2-NEXT:  .Lpcsection678:
16362; O2-NEXT:    xorl %edx, %edx
16363; O2-NEXT:  .Lpcsection679:
16364; O2-NEXT:    xorl %ecx, %ecx
16365; O2-NEXT:  .Lpcsection680:
16366; O2-NEXT:    lock cmpxchg16b (%rdi)
16367; O2-NEXT:  .Lpcsection681:
16368; O2-NEXT:    movl $42, %eax
16369; O2-NEXT:  .Lpcsection682:
16370; O2-NEXT:    xorl %edx, %edx
16371; O2-NEXT:  .Lpcsection683:
16372; O2-NEXT:    xorl %ecx, %ecx
16373; O2-NEXT:  .Lpcsection684:
16374; O2-NEXT:    lock cmpxchg16b (%rdi)
16375; O2-NEXT:  .Lpcsection685:
16376; O2-NEXT:    movl $42, %eax
16377; O2-NEXT:  .Lpcsection686:
16378; O2-NEXT:    xorl %edx, %edx
16379; O2-NEXT:  .Lpcsection687:
16380; O2-NEXT:    xorl %ecx, %ecx
16381; O2-NEXT:  .Lpcsection688:
16382; O2-NEXT:    lock cmpxchg16b (%rdi)
16383; O2-NEXT:    movq $3, foo(%rip)
16384; O2-NEXT:    popq %rbx
16385; O2-NEXT:    .cfi_def_cfa_offset 8
16386; O2-NEXT:    retq
16387;
16388; O3-LABEL: atomic128_cas_seq_cst:
16389; O3:       # %bb.0: # %entry
16390; O3-NEXT:    pushq %rbx
16391; O3-NEXT:    .cfi_def_cfa_offset 16
16392; O3-NEXT:    .cfi_offset %rbx, -16
16393; O3-NEXT:    movq foo(%rip), %rax
16394; O3-NEXT:  .Lpcsection676:
16395; O3-NEXT:    movl $42, %eax
16396; O3-NEXT:  .Lpcsection677:
16397; O3-NEXT:    movl $1, %ebx
16398; O3-NEXT:  .Lpcsection678:
16399; O3-NEXT:    xorl %edx, %edx
16400; O3-NEXT:  .Lpcsection679:
16401; O3-NEXT:    xorl %ecx, %ecx
16402; O3-NEXT:  .Lpcsection680:
16403; O3-NEXT:    lock cmpxchg16b (%rdi)
16404; O3-NEXT:  .Lpcsection681:
16405; O3-NEXT:    movl $42, %eax
16406; O3-NEXT:  .Lpcsection682:
16407; O3-NEXT:    xorl %edx, %edx
16408; O3-NEXT:  .Lpcsection683:
16409; O3-NEXT:    xorl %ecx, %ecx
16410; O3-NEXT:  .Lpcsection684:
16411; O3-NEXT:    lock cmpxchg16b (%rdi)
16412; O3-NEXT:  .Lpcsection685:
16413; O3-NEXT:    movl $42, %eax
16414; O3-NEXT:  .Lpcsection686:
16415; O3-NEXT:    xorl %edx, %edx
16416; O3-NEXT:  .Lpcsection687:
16417; O3-NEXT:    xorl %ecx, %ecx
16418; O3-NEXT:  .Lpcsection688:
16419; O3-NEXT:    lock cmpxchg16b (%rdi)
16420; O3-NEXT:    movq $3, foo(%rip)
16421; O3-NEXT:    popq %rbx
16422; O3-NEXT:    .cfi_def_cfa_offset 8
16423; O3-NEXT:    retq
16424entry:
16425  load volatile i64, ptr @foo, align 8
16426  %x = cmpxchg ptr %a, i128 42, i128 1 seq_cst monotonic, align 16, !pcsections !0
16427  %y = cmpxchg ptr %a, i128 42, i128 1 seq_cst acquire, align 16, !pcsections !0
16428  %z = cmpxchg ptr %a, i128 42, i128 1 seq_cst seq_cst, align 16, !pcsections !0
16429  store volatile i64 3, ptr @foo, align 8
16430  ret void
16431}
16432
16433!0 = !{!"somesection"}
16434