Detect need for autoalignment of the stack earlier to catch spills more
[oota-llvm.git] / test / CodeGen / ARM / spill-q.ll
1 ; RUN: llc < %s -mtriple=armv7-elf -mattr=+neon | FileCheck %s
2 ; PR4789
3
4 %bar = type { float, float, float }
5 %baz = type { i32, [16 x %bar], [16 x float], [16 x i32], i8 }
6 %foo = type { <4 x float> }
7 %quux = type { i32 (...)**, %baz*, i32 }
8 %quuz = type { %quux, i32, %bar, [128 x i8], [16 x %foo], %foo, %foo, %foo }
9
10 declare <4 x float> @llvm.arm.neon.vld1.v4f32(i8*) nounwind readonly
11
12 define arm_apcscc void @aaa(%quuz* %this, i8* %block) {
13 ; CHECK: aaa:
14 ; CHECK: bic sp, sp, #15
15 ; CHECK: vst1.64 {{.*}}sp @128
16 ; CHECK: vld1.64 {{.*}}sp @128
17 entry:
18   %0 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1]
19   store float 6.300000e+01, float* undef, align 4
20   %1 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1]
21   store float 0.000000e+00, float* undef, align 4
22   %2 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1]
23   %val173 = load <4 x float>* undef               ; <<4 x float>> [#uses=1]
24   br label %bb4
25
26 bb4:                                              ; preds = %bb193, %entry
27   %besterror.0.2264 = phi <4 x float> [ undef, %entry ], [ %besterror.0.0, %bb193 ] ; <<4 x float>> [#uses=2]
28   %part0.0.0261 = phi <4 x float> [ zeroinitializer, %entry ], [ %23, %bb193 ] ; <<4 x float>> [#uses=2]
29   %3 = fmul <4 x float> zeroinitializer, %0       ; <<4 x float>> [#uses=2]
30   %4 = fadd <4 x float> %3, %part0.0.0261         ; <<4 x float>> [#uses=1]
31   %5 = shufflevector <4 x float> %3, <4 x float> undef, <2 x i32> <i32 2, i32 3> ; <<2 x float>> [#uses=1]
32   %6 = shufflevector <2 x float> %5, <2 x float> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1> ; <<4 x float>> [#uses=1]
33   %7 = fmul <4 x float> %1, undef                 ; <<4 x float>> [#uses=1]
34   %8 = fadd <4 x float> %7, <float 5.000000e-01, float 5.000000e-01, float 5.000000e-01, float 5.000000e-01> ; <<4 x float>> [#uses=1]
35   %9 = fptosi <4 x float> %8 to <4 x i32>         ; <<4 x i32>> [#uses=1]
36   %10 = sitofp <4 x i32> %9 to <4 x float>        ; <<4 x float>> [#uses=1]
37   %11 = fmul <4 x float> %10, %2                  ; <<4 x float>> [#uses=1]
38   %12 = fmul <4 x float> undef, %6                ; <<4 x float>> [#uses=1]
39   %13 = fmul <4 x float> %11, %4                  ; <<4 x float>> [#uses=1]
40   %14 = fsub <4 x float> %12, %13                 ; <<4 x float>> [#uses=1]
41   %15 = fsub <4 x float> %14, undef               ; <<4 x float>> [#uses=1]
42   %16 = fmul <4 x float> %15, <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00> ; <<4 x float>> [#uses=1]
43   %17 = fadd <4 x float> %16, undef               ; <<4 x float>> [#uses=1]
44   %18 = fmul <4 x float> %17, %val173             ; <<4 x float>> [#uses=1]
45   %19 = shufflevector <4 x float> %18, <4 x float> undef, <2 x i32> <i32 2, i32 3> ; <<2 x float>> [#uses=1]
46   %20 = shufflevector <2 x float> %19, <2 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>> [#uses=1]
47   %21 = fadd <4 x float> zeroinitializer, %20     ; <<4 x float>> [#uses=2]
48   %22 = fcmp ogt <4 x float> %besterror.0.2264, %21 ; <<4 x i1>> [#uses=0]
49   br i1 undef, label %bb193, label %bb186
50
51 bb186:                                            ; preds = %bb4
52   br label %bb193
53
54 bb193:                                            ; preds = %bb186, %bb4
55   %besterror.0.0 = phi <4 x float> [ %21, %bb186 ], [ %besterror.0.2264, %bb4 ] ; <<4 x float>> [#uses=1]
56   %23 = fadd <4 x float> %part0.0.0261, zeroinitializer ; <<4 x float>> [#uses=1]
57   br label %bb4
58 }