Re-apply bottom-up fast-isel, with fixes. Be very careful to avoid emitting
[oota-llvm.git] / test / CodeGen / X86 / fast-isel-loads.ll
1 ; RUN: llc -march=x86-64 -O0 -asm-verbose=false < %s | FileCheck %s
2
3 ; Fast-isel shouldn't reload the argument values from the stack.
4
5 ; CHECK: foo:
6 ; CHECK-NEXT: movq  %rdi, -8(%rsp)
7 ; CHECK-NEXT: movq  %rsi, -16(%rsp)
8 ; CHECK-NEXT: movsd 128(%rsi,%rdi,8), %xmm0
9 ; CHECK-NEXT: ret
10
11 define double @foo(i64 %x, double* %p) nounwind {
12 entry:
13   %x.addr = alloca i64, align 8                   ; <i64*> [#uses=2]
14   %p.addr = alloca double*, align 8               ; <double**> [#uses=2]
15   store i64 %x, i64* %x.addr
16   store double* %p, double** %p.addr
17   %tmp = load i64* %x.addr                        ; <i64> [#uses=1]
18   %tmp1 = load double** %p.addr                   ; <double*> [#uses=1]
19   %add = add nsw i64 %tmp, 16                     ; <i64> [#uses=1]
20   %arrayidx = getelementptr inbounds double* %tmp1, i64 %add ; <double*> [#uses=1]
21   %tmp2 = load double* %arrayidx                  ; <double> [#uses=1]
22   ret double %tmp2
23 }