xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2010-01-08-Atomic64Bug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386-apple-darwin -mcpu=corei7 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; rdar://r7512579
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; PHI defs in the atomic loop should be used by the add / adc
5*9880d681SAndroid Build Coastguard Worker; instructions. They should not be dead.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @t(i64* nocapture %p) nounwind ssp {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t:
10*9880d681SAndroid Build Coastguard Worker; CHECK: movl ([[REG:%[a-z]+]]), %eax
11*9880d681SAndroid Build Coastguard Worker; CHECK: movl 4([[REG]]), %edx
12*9880d681SAndroid Build Coastguard Worker; CHECK: LBB0_1:
13*9880d681SAndroid Build Coastguard Worker; CHECK: movl %eax, %ebx
14*9880d681SAndroid Build Coastguard Worker; CHECK: addl $1, %ebx
15*9880d681SAndroid Build Coastguard Worker; CHECK: movl %edx, %ecx
16*9880d681SAndroid Build Coastguard Worker; CHECK: adcl $0, %ecx
17*9880d681SAndroid Build Coastguard Worker; CHECK: lock cmpxchg8b ([[REG]])
18*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: jne
19*9880d681SAndroid Build Coastguard Worker  %0 = atomicrmw add i64* %p, i64 1 seq_cst
20*9880d681SAndroid Build Coastguard Worker  ret void
21*9880d681SAndroid Build Coastguard Worker}
22