1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mtriple=i386-apple-darwin | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; PR8297 3*9880d681SAndroid Build Coastguard Worker; 4*9880d681SAndroid Build Coastguard Worker; On i386, i64 cmpxchg is lowered during legalize types to extract the 5*9880d681SAndroid Build Coastguard Worker; 64-bit result into a pair of fixed regs. So creation of the DAG node 6*9880d681SAndroid Build Coastguard Worker; happens in a different place. See 7*9880d681SAndroid Build Coastguard Worker; X86TargetLowering::ReplaceNodeResults, case ATOMIC_CMP_SWAP. 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; Neither Atomic-xx.ll nor atomic_op.ll cover this. Those tests were 10*9880d681SAndroid Build Coastguard Worker; autogenerated from C source before 64-bit variants were supported. 11*9880d681SAndroid Build Coastguard Worker; 12*9880d681SAndroid Build Coastguard Worker; Note that this case requires a loop around the cmpxchg to force 13*9880d681SAndroid Build Coastguard Worker; machine licm to query alias anlysis, exposing a bad 14*9880d681SAndroid Build Coastguard Worker; MachineMemOperand. 15*9880d681SAndroid Build Coastguard Workerdefine void @foo(i64* %ptr) nounwind inlinehint { 16*9880d681SAndroid Build Coastguard Workerentry: 17*9880d681SAndroid Build Coastguard Worker br label %loop 18*9880d681SAndroid Build Coastguard Workerloop: 19*9880d681SAndroid Build Coastguard Worker; CHECK: lock cmpxchg8b 20*9880d681SAndroid Build Coastguard Worker %pair = cmpxchg i64* %ptr, i64 0, i64 1 monotonic monotonic 21*9880d681SAndroid Build Coastguard Worker %r = extractvalue { i64, i1 } %pair, 0 22*9880d681SAndroid Build Coastguard Worker %stored1 = icmp eq i64 %r, 0 23*9880d681SAndroid Build Coastguard Worker br i1 %stored1, label %loop, label %continue 24*9880d681SAndroid Build Coastguard Workercontinue: 25*9880d681SAndroid Build Coastguard Worker ret void 26*9880d681SAndroid Build Coastguard Worker} 27