1; RUN: llc < %s -march=x86 -stackrealign -O2 | FileCheck %s 2; PR28755 3 4; Check that register allocator is able to handle that 5; a-lot-of-fixed-and-reserved-registers case. We do that by 6; emmiting lea before 4 cmpxchg8b operands generators. 7 8define void @foo_alloca(i64* %a, i32 %off, i32 %n) { 9 %dummy = alloca i32, i32 %n 10 %addr = getelementptr inbounds i64, i64* %a, i32 %off 11 12 %res = cmpxchg i64* %addr, i64 0, i64 1 monotonic monotonic 13 ret void 14} 15 16; CHECK-LABEL: foo_alloca 17; CHECK: leal {{\(%e..,%e..,.*\)}}, [[REGISTER:%e.i]] 18; CHECK-NEXT: xorl %eax, %eax 19; CHECK-NEXT: xorl %edx, %edx 20; CHECK-NEXT: xorl %ecx, %ecx 21; CHECK-NEXT: movl $1, %ebx 22; CHECK-NEXT: lock cmpxchg8b ([[REGISTER]]) 23 24; If we don't use index register in the address mode - 25; check that we did not generate the lea. 26define void @foo_alloca_direct_address(i64* %addr, i32 %n) { 27 %dummy = alloca i32, i32 %n 28 29 %res = cmpxchg i64* %addr, i64 0, i64 1 monotonic monotonic 30 ret void 31} 32 33; CHECK-LABEL: foo_alloca_direct_address 34; CHECK-NOT: leal {{\(%e.*\)}}, [[REGISTER:%e.i]] 35; CHECK: lock cmpxchg8b ([[REGISTER]]) 36