1414define i8 @add8 (ptr %p ) {
1515; X64-LABEL: add8:
1616; X64: # %bb.0:
17- ; X64-NEXT: xorl %eax, %eax
18- ; X64-NEXT: lock xaddb %al, (%rdi)
19- ; X64-NEXT: # kill: def $al killed $al killed $eax
17+ ; X64-NEXT: #MEMBARRIER
18+ ; X64-NEXT: movzbl (%rdi), %eax
2019; X64-NEXT: retq
2120;
2221; X86-GENERIC-LABEL: add8:
2322; X86-GENERIC: # %bb.0:
24- ; X86-GENERIC-NEXT: movl {{[0-9]+}}(%esp), %ecx
25- ; X86-GENERIC-NEXT: xorl %eax, %eax
26- ; X86-GENERIC-NEXT: lock xaddb %al, (%ecx)
27- ; X86-GENERIC-NEXT: # kill: def $al killed $al killed $eax
23+ ; X86-GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax
24+ ; X86-GENERIC-NEXT: #MEMBARRIER
25+ ; X86-GENERIC-NEXT: movzbl (%eax), %eax
2826; X86-GENERIC-NEXT: retl
2927;
3028; X86-ATOM-LABEL: add8:
3129; X86-ATOM: # %bb.0:
32- ; X86-ATOM-NEXT: movl {{[0-9]+}}(%esp), %ecx
33- ; X86-ATOM-NEXT: xorl %eax, %eax
34- ; X86-ATOM-NEXT: lock xaddb %al, (%ecx)
35- ; X86-ATOM-NEXT: # kill: def $al killed $al killed $eax
30+ ; X86-ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax
31+ ; X86-ATOM-NEXT: #MEMBARRIER
32+ ; X86-ATOM-NEXT: movzbl (%eax), %eax
33+ ; X86-ATOM-NEXT: nop
34+ ; X86-ATOM-NEXT: nop
3635; X86-ATOM-NEXT: nop
3736; X86-ATOM-NEXT: nop
3837; X86-ATOM-NEXT: retl
@@ -43,62 +42,64 @@ define i8 @add8(ptr %p) {
4342define i16 @or16 (ptr %p ) {
4443; X64-LABEL: or16:
4544; X64: # %bb.0:
45+ ; X64-NEXT: #MEMBARRIER
4646; X64-NEXT: movzwl (%rdi), %eax
47- ; X64-NEXT: .p2align 4, 0x90
48- ; X64-NEXT: .LBB1_1: # %atomicrmw.start
49- ; X64-NEXT: # =>This Inner Loop Header: Depth=1
50- ; X64-NEXT: lock cmpxchgw %ax, (%rdi)
51- ; X64-NEXT: jne .LBB1_1
52- ; X64-NEXT: # %bb.2: # %atomicrmw.end
5347; X64-NEXT: retq
5448;
55- ; X86-LABEL: or16:
56- ; X86: # %bb.0:
57- ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
58- ; X86-NEXT: movzwl (%ecx), %eax
59- ; X86-NEXT: .p2align 4, 0x90
60- ; X86-NEXT: .LBB1_1: # %atomicrmw.start
61- ; X86-NEXT: # =>This Inner Loop Header: Depth=1
62- ; X86-NEXT: lock cmpxchgw %ax, (%ecx)
63- ; X86-NEXT: jne .LBB1_1
64- ; X86-NEXT: # %bb.2: # %atomicrmw.end
65- ; X86-NEXT: retl
49+ ; X86-GENERIC-LABEL: or16:
50+ ; X86-GENERIC: # %bb.0:
51+ ; X86-GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax
52+ ; X86-GENERIC-NEXT: #MEMBARRIER
53+ ; X86-GENERIC-NEXT: movzwl (%eax), %eax
54+ ; X86-GENERIC-NEXT: retl
55+ ;
56+ ; X86-ATOM-LABEL: or16:
57+ ; X86-ATOM: # %bb.0:
58+ ; X86-ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax
59+ ; X86-ATOM-NEXT: #MEMBARRIER
60+ ; X86-ATOM-NEXT: movzwl (%eax), %eax
61+ ; X86-ATOM-NEXT: nop
62+ ; X86-ATOM-NEXT: nop
63+ ; X86-ATOM-NEXT: nop
64+ ; X86-ATOM-NEXT: nop
65+ ; X86-ATOM-NEXT: retl
6666 %1 = atomicrmw or ptr %p , i16 0 syncscope("singlethread" ) acquire
6767 ret i16 %1
6868}
6969
7070define i32 @xor32 (ptr %p ) {
7171; X64-LABEL: xor32:
7272; X64: # %bb.0:
73+ ; X64-NEXT: #MEMBARRIER
7374; X64-NEXT: movl (%rdi), %eax
74- ; X64-NEXT: .p2align 4, 0x90
75- ; X64-NEXT: .LBB2_1: # %atomicrmw.start
76- ; X64-NEXT: # =>This Inner Loop Header: Depth=1
77- ; X64-NEXT: lock cmpxchgl %eax, (%rdi)
78- ; X64-NEXT: jne .LBB2_1
79- ; X64-NEXT: # %bb.2: # %atomicrmw.end
8075; X64-NEXT: retq
8176;
82- ; X86-LABEL: xor32:
83- ; X86: # %bb.0:
84- ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
85- ; X86-NEXT: movl (%ecx), %eax
86- ; X86-NEXT: .p2align 4, 0x90
87- ; X86-NEXT: .LBB2_1: # %atomicrmw.start
88- ; X86-NEXT: # =>This Inner Loop Header: Depth=1
89- ; X86-NEXT: lock cmpxchgl %eax, (%ecx)
90- ; X86-NEXT: jne .LBB2_1
91- ; X86-NEXT: # %bb.2: # %atomicrmw.end
92- ; X86-NEXT: retl
77+ ; X86-GENERIC-LABEL: xor32:
78+ ; X86-GENERIC: # %bb.0:
79+ ; X86-GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax
80+ ; X86-GENERIC-NEXT: #MEMBARRIER
81+ ; X86-GENERIC-NEXT: movl (%eax), %eax
82+ ; X86-GENERIC-NEXT: retl
83+ ;
84+ ; X86-ATOM-LABEL: xor32:
85+ ; X86-ATOM: # %bb.0:
86+ ; X86-ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax
87+ ; X86-ATOM-NEXT: #MEMBARRIER
88+ ; X86-ATOM-NEXT: movl (%eax), %eax
89+ ; X86-ATOM-NEXT: nop
90+ ; X86-ATOM-NEXT: nop
91+ ; X86-ATOM-NEXT: nop
92+ ; X86-ATOM-NEXT: nop
93+ ; X86-ATOM-NEXT: retl
9394 %1 = atomicrmw xor ptr %p , i32 0 syncscope("singlethread" ) release
9495 ret i32 %1
9596}
9697
9798define i64 @sub64 (ptr %p ) {
9899; X64-LABEL: sub64:
99100; X64: # %bb.0:
100- ; X64-NEXT: xorl %eax, %eax
101- ; X64-NEXT: lock xaddq %rax, (%rdi)
101+ ; X64-NEXT: #MEMBARRIER
102+ ; X64-NEXT: movq (%rdi), %rax
102103; X64-NEXT: retq
103104;
104105; X86-LABEL: sub64:
@@ -112,7 +113,7 @@ define i64 @sub64(ptr %p) {
112113; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
113114; X86-NEXT: movl (%esi), %eax
114115; X86-NEXT: movl 4(%esi), %edx
115- ; X86-NEXT: .p2align 4, 0x90
116+ ; X86-NEXT: .p2align 4
116117; X86-NEXT: .LBB3_1: # %atomicrmw.start
117118; X86-NEXT: # =>This Inner Loop Header: Depth=1
118119; X86-NEXT: movl %edx, %ecx
@@ -162,7 +163,7 @@ define i128 @or128(ptr %p) {
162163; X86-GENERIC-NEXT: movl 8(%edi), %edx
163164; X86-GENERIC-NEXT: movl (%edi), %ebx
164165; X86-GENERIC-NEXT: movl 4(%edi), %esi
165- ; X86-GENERIC-NEXT: .p2align 4, 0x90
166+ ; X86-GENERIC-NEXT: .p2align 4
166167; X86-GENERIC-NEXT: .LBB4_1: # %atomicrmw.start
167168; X86-GENERIC-NEXT: # =>This Inner Loop Header: Depth=1
168169; X86-GENERIC-NEXT: movl %ebx, (%esp)
@@ -223,7 +224,7 @@ define i128 @or128(ptr %p) {
223224; X86-ATOM-NEXT: movl 8(%edi), %edx
224225; X86-ATOM-NEXT: movl (%edi), %esi
225226; X86-ATOM-NEXT: movl 4(%edi), %ebx
226- ; X86-ATOM-NEXT: .p2align 4, 0x90
227+ ; X86-ATOM-NEXT: .p2align 4
227228; X86-ATOM-NEXT: .LBB4_1: # %atomicrmw.start
228229; X86-ATOM-NEXT: # =>This Inner Loop Header: Depth=1
229230; X86-ATOM-NEXT: movl %esi, (%esp)
@@ -271,26 +272,27 @@ define i128 @or128(ptr %p) {
271272define i32 @and32 (ptr %p ) {
272273; X64-LABEL: and32:
273274; X64: # %bb.0:
275+ ; X64-NEXT: #MEMBARRIER
274276; X64-NEXT: movl (%rdi), %eax
275- ; X64-NEXT: .p2align 4, 0x90
276- ; X64-NEXT: .LBB5_1: # %atomicrmw.start
277- ; X64-NEXT: # =>This Inner Loop Header: Depth=1
278- ; X64-NEXT: lock cmpxchgl %eax, (%rdi)
279- ; X64-NEXT: jne .LBB5_1
280- ; X64-NEXT: # %bb.2: # %atomicrmw.end
281277; X64-NEXT: retq
282278;
283- ; X86-LABEL: and32:
284- ; X86: # %bb.0:
285- ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
286- ; X86-NEXT: movl (%ecx), %eax
287- ; X86-NEXT: .p2align 4, 0x90
288- ; X86-NEXT: .LBB5_1: # %atomicrmw.start
289- ; X86-NEXT: # =>This Inner Loop Header: Depth=1
290- ; X86-NEXT: lock cmpxchgl %eax, (%ecx)
291- ; X86-NEXT: jne .LBB5_1
292- ; X86-NEXT: # %bb.2: # %atomicrmw.end
293- ; X86-NEXT: retl
279+ ; X86-GENERIC-LABEL: and32:
280+ ; X86-GENERIC: # %bb.0:
281+ ; X86-GENERIC-NEXT: movl {{[0-9]+}}(%esp), %eax
282+ ; X86-GENERIC-NEXT: #MEMBARRIER
283+ ; X86-GENERIC-NEXT: movl (%eax), %eax
284+ ; X86-GENERIC-NEXT: retl
285+ ;
286+ ; X86-ATOM-LABEL: and32:
287+ ; X86-ATOM: # %bb.0:
288+ ; X86-ATOM-NEXT: movl {{[0-9]+}}(%esp), %eax
289+ ; X86-ATOM-NEXT: #MEMBARRIER
290+ ; X86-ATOM-NEXT: movl (%eax), %eax
291+ ; X86-ATOM-NEXT: nop
292+ ; X86-ATOM-NEXT: nop
293+ ; X86-ATOM-NEXT: nop
294+ ; X86-ATOM-NEXT: nop
295+ ; X86-ATOM-NEXT: retl
294296 %1 = atomicrmw and ptr %p , i32 -1 syncscope("singlethread" ) acq_rel
295297 ret i32 %1
296298}
@@ -449,7 +451,7 @@ define void @or64_nouse_seq_cst(ptr %p) {
449451; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
450452; X86-NEXT: movl (%esi), %eax
451453; X86-NEXT: movl 4(%esi), %edx
452- ; X86-NEXT: .p2align 4, 0x90
454+ ; X86-NEXT: .p2align 4
453455; X86-NEXT: .LBB11_1: # %atomicrmw.start
454456; X86-NEXT: # =>This Inner Loop Header: Depth=1
455457; X86-NEXT: movl %edx, %ecx
@@ -500,7 +502,7 @@ define void @or128_nouse_seq_cst(ptr %p) {
500502; X86-GENERIC-NEXT: movl 8(%esi), %edi
501503; X86-GENERIC-NEXT: movl (%esi), %edx
502504; X86-GENERIC-NEXT: movl 4(%esi), %ebx
503- ; X86-GENERIC-NEXT: .p2align 4, 0x90
505+ ; X86-GENERIC-NEXT: .p2align 4
504506; X86-GENERIC-NEXT: .LBB12_1: # %atomicrmw.start
505507; X86-GENERIC-NEXT: # =>This Inner Loop Header: Depth=1
506508; X86-GENERIC-NEXT: movl %edx, (%esp)
@@ -557,7 +559,7 @@ define void @or128_nouse_seq_cst(ptr %p) {
557559; X86-ATOM-NEXT: movl 8(%esi), %edx
558560; X86-ATOM-NEXT: movl (%esi), %eax
559561; X86-ATOM-NEXT: movl 4(%esi), %edi
560- ; X86-ATOM-NEXT: .p2align 4, 0x90
562+ ; X86-ATOM-NEXT: .p2align 4
561563; X86-ATOM-NEXT: .LBB12_1: # %atomicrmw.start
562564; X86-ATOM-NEXT: # =>This Inner Loop Header: Depth=1
563565; X86-ATOM-NEXT: movl %eax, (%esp)
0 commit comments