Skip to content

Commit 535df47

Browse files
committed
Revert rG2149aa73f640c96 "[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)"
This might be the cause of some msan build failures - I don't have access to a msan build right now, so this is a speculative revert.
1 parent c5cb505 commit 535df47

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4020,12 +4020,10 @@ inline static bool isDefConvertible(const MachineInstr &MI, bool &NoSignFlag,
40204020
case X86::SBB8ri: case X86::SBB64rr: case X86::SBB32rr:
40214021
case X86::SBB16rr: case X86::SBB8rr: case X86::SBB64rm:
40224022
case X86::SBB32rm: case X86::SBB16rm: case X86::SBB8rm:
4023-
case X86::NEG8r: case X86::NEG16r: case X86::NEG32r: case X86::NEG64r:
4024-
case X86::LXADD64: case X86::LXADD32: case X86::LXADD16: case X86::LXADD8:
4025-
// TODO: Add additional LOCK/XADD instructions when we have test coverage.
4026-
case X86::SAR8r1: case X86::SAR16r1: case X86::SAR32r1: case X86::SAR64r1:
4027-
case X86::SHR8r1: case X86::SHR16r1: case X86::SHR32r1: case X86::SHR64r1:
4028-
case X86::SHL8r1: case X86::SHL16r1: case X86::SHL32r1: case X86::SHL64r1:
4023+
case X86::NEG8r: case X86::NEG16r: case X86::NEG32r: case X86::NEG64r:
4024+
case X86::SAR8r1: case X86::SAR16r1: case X86::SAR32r1:case X86::SAR64r1:
4025+
case X86::SHR8r1: case X86::SHR16r1: case X86::SHR32r1:case X86::SHR64r1:
4026+
case X86::SHL8r1: case X86::SHL16r1: case X86::SHL32r1:case X86::SHL64r1:
40294027
case X86::LZCNT16rr: case X86::LZCNT16rm:
40304028
case X86::LZCNT32rr: case X86::LZCNT32rm:
40314029
case X86::LZCNT64rr: case X86::LZCNT64rm:

llvm/test/CodeGen/X86/atomic-eflags-reuse.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ define i8 @test_add_1_cmov_cmov(i64* %p, i8* %q) #0 {
228228
; CHECK: # %bb.0: # %entry
229229
; CHECK-NEXT: movl $1, %eax
230230
; CHECK-NEXT: lock xaddq %rax, (%rdi)
231+
; CHECK-NEXT: testq %rax, %rax
231232
; CHECK-NEXT: movl $12, %eax
232233
; CHECK-NEXT: movl $34, %ecx
233234
; CHECK-NEXT: cmovsl %eax, %ecx

llvm/test/CodeGen/X86/atomic-flags.ll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ L4:
124124
ret i32 4
125125
}
126126

127-
; PR20841 - ensure we reuse the ZF flag from XADD for compares with zero.
127+
; FIXME: PR20841 - ensure we reuse the ZF flag from XADD for compares with zero.
128128

129129
define zeroext i1 @xadd_cmp0_i64(i64* %x) nounwind {
130130
; X64-LABEL: xadd_cmp0_i64:
131131
; X64: # %bb.0:
132132
; X64-NEXT: movl $1, %eax
133133
; X64-NEXT: lock xaddq %rax, (%rdi)
134+
; X64-NEXT: testq %rax, %rax
134135
; X64-NEXT: sete %al
135136
; X64-NEXT: retq
136137
;
@@ -166,6 +167,7 @@ define zeroext i1 @xadd_cmp0_i32(i32* %x) nounwind {
166167
; X64: # %bb.0:
167168
; X64-NEXT: movl $1, %eax
168169
; X64-NEXT: lock xaddl %eax, (%rdi)
170+
; X64-NEXT: testl %eax, %eax
169171
; X64-NEXT: setne %al
170172
; X64-NEXT: retq
171173
;
@@ -174,6 +176,7 @@ define zeroext i1 @xadd_cmp0_i32(i32* %x) nounwind {
174176
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
175177
; X86-NEXT: movl $1, %ecx
176178
; X86-NEXT: lock xaddl %ecx, (%eax)
179+
; X86-NEXT: testl %ecx, %ecx
177180
; X86-NEXT: setne %al
178181
; X86-NEXT: retl
179182
%add = atomicrmw add i32* %x, i32 1 seq_cst
@@ -186,6 +189,7 @@ define zeroext i1 @xadd_cmp0_i16(i16* %x) nounwind {
186189
; X64: # %bb.0:
187190
; X64-NEXT: movw $1, %ax
188191
; X64-NEXT: lock xaddw %ax, (%rdi)
192+
; X64-NEXT: testw %ax, %ax
189193
; X64-NEXT: sete %al
190194
; X64-NEXT: retq
191195
;
@@ -194,6 +198,7 @@ define zeroext i1 @xadd_cmp0_i16(i16* %x) nounwind {
194198
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
195199
; X86-NEXT: movw $1, %cx
196200
; X86-NEXT: lock xaddw %cx, (%eax)
201+
; X86-NEXT: testw %cx, %cx
197202
; X86-NEXT: sete %al
198203
; X86-NEXT: retl
199204
%add = atomicrmw add i16* %x, i16 1 seq_cst
@@ -206,6 +211,7 @@ define zeroext i1 @xadd_cmp0_i8(i8* %x) nounwind {
206211
; X64: # %bb.0:
207212
; X64-NEXT: movb $1, %al
208213
; X64-NEXT: lock xaddb %al, (%rdi)
214+
; X64-NEXT: testb %al, %al
209215
; X64-NEXT: setne %al
210216
; X64-NEXT: retq
211217
;
@@ -214,6 +220,7 @@ define zeroext i1 @xadd_cmp0_i8(i8* %x) nounwind {
214220
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
215221
; X86-NEXT: movb $1, %cl
216222
; X86-NEXT: lock xaddb %cl, (%eax)
223+
; X86-NEXT: testb %cl, %cl
217224
; X86-NEXT: setne %al
218225
; X86-NEXT: retl
219226
%add = atomicrmw add i8* %x, i8 1 seq_cst

0 commit comments

Comments
 (0)