157 lines · plain
1; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra | FileCheck %s2; RUN: llc < %s -mtriple=arm-apple-ios -mattr=+vfp2 -disable-post-ra -regalloc=basic | FileCheck %s3 4define void @test(ptr %P, ptr %D) {5 %A = load float, ptr %P ; <float> [#uses=1]6 %B = load double, ptr %D ; <double> [#uses=1]7 store float %A, ptr %P8 store double %B, ptr %D9 ret void10}11 12declare float @fabsf(float)13 14declare double @fabs(double)15 16define void @test_abs(ptr %P, ptr %D) {17;CHECK-LABEL: test_abs:18 %a = load float, ptr %P ; <float> [#uses=1]19;CHECK: vabs.f3220 %b = call float @fabsf( float %a ) readnone ; <float> [#uses=1]21 store float %b, ptr %P22 %A = load double, ptr %D ; <double> [#uses=1]23;CHECK: vabs.f6424 %B = call double @fabs( double %A ) readnone ; <double> [#uses=1]25 store double %B, ptr %D26 ret void27}28 29define void @test_add(ptr %P, ptr %D) {30;CHECK-LABEL: test_add:31 %a = load float, ptr %P ; <float> [#uses=2]32 %b = fadd float %a, %a ; <float> [#uses=1]33 store float %b, ptr %P34 %A = load double, ptr %D ; <double> [#uses=2]35 %B = fadd double %A, %A ; <double> [#uses=1]36 store double %B, ptr %D37 ret void38}39 40define void @test_ext_round(ptr %P, ptr %D) {41;CHECK-LABEL: test_ext_round:42 %a = load float, ptr %P ; <float> [#uses=1]43;CHECK-DAG: vcvt.f64.f3244;CHECK-DAG: vcvt.f32.f6445 %b = fpext float %a to double ; <double> [#uses=1]46 %A = load double, ptr %D ; <double> [#uses=1]47 %B = fptrunc double %A to float ; <float> [#uses=1]48 store double %b, ptr %D49 store float %B, ptr %P50 ret void51}52 53define void @test_fma(ptr %P1, ptr %P2, ptr %P3) {54;CHECK-LABEL: test_fma:55 %a1 = load float, ptr %P1 ; <float> [#uses=1]56 %a2 = load float, ptr %P2 ; <float> [#uses=1]57 %a3 = load float, ptr %P3 ; <float> [#uses=1]58;CHECK: vnmls.f3259 %X = fmul float %a1, %a2 ; <float> [#uses=1]60 %Y = fsub float %X, %a3 ; <float> [#uses=1]61 store float %Y, ptr %P162 ret void63}64 65define i32 @test_ftoi(ptr %P1) {66;CHECK-LABEL: test_ftoi:67 %a1 = load float, ptr %P1 ; <float> [#uses=1]68;CHECK: vcvt.s32.f3269 %b1 = fptosi float %a1 to i32 ; <i32> [#uses=1]70 ret i32 %b171}72 73define i32 @test_ftou(ptr %P1) {74;CHECK-LABEL: test_ftou:75 %a1 = load float, ptr %P1 ; <float> [#uses=1]76;CHECK: vcvt.u32.f3277 %b1 = fptoui float %a1 to i32 ; <i32> [#uses=1]78 ret i32 %b179}80 81define i32 @test_dtoi(ptr %P1) {82;CHECK-LABEL: test_dtoi:83 %a1 = load double, ptr %P1 ; <double> [#uses=1]84;CHECK: vcvt.s32.f6485 %b1 = fptosi double %a1 to i32 ; <i32> [#uses=1]86 ret i32 %b187}88 89define i32 @test_dtou(ptr %P1) {90;CHECK-LABEL: test_dtou:91 %a1 = load double, ptr %P1 ; <double> [#uses=1]92;CHECK: vcvt.u32.f6493 %b1 = fptoui double %a1 to i32 ; <i32> [#uses=1]94 ret i32 %b195}96 97define void @test_utod(ptr %P1, i32 %X) {98;CHECK-LABEL: test_utod:99;CHECK: vcvt.f64.u32100 %b1 = uitofp i32 %X to double ; <double> [#uses=1]101 store double %b1, ptr %P1102 ret void103}104 105define void @test_utod2(ptr %P1, i8 %X) {106;CHECK-LABEL: test_utod2:107;CHECK: vcvt.f64.u32108 %b1 = uitofp i8 %X to double ; <double> [#uses=1]109 store double %b1, ptr %P1110 ret void111}112 113define void @test_cmp(ptr %glob, i32 %X) {114;CHECK-LABEL: test_cmp:115entry:116 %tmp = load float, ptr %glob ; <float> [#uses=2]117 %tmp3 = getelementptr float, ptr %glob, i32 2 ; <ptr> [#uses=1]118 %tmp4 = load float, ptr %tmp3 ; <float> [#uses=2]119 %tmp.upgrd.1 = fcmp oeq float %tmp, %tmp4 ; <i1> [#uses=1]120 %tmp5 = fcmp uno float %tmp, %tmp4 ; <i1> [#uses=1]121 %tmp6 = or i1 %tmp.upgrd.1, %tmp5 ; <i1> [#uses=1]122;CHECK: bmi123;CHECK-NEXT: bgt124 br i1 %tmp6, label %cond_true, label %cond_false125 126cond_true: ; preds = %entry127 %tmp.upgrd.2 = tail call i32 (...) @bar( ) ; <i32> [#uses=0]128 ret void129 130cond_false: ; preds = %entry131 %tmp7 = tail call i32 (...) @baz( ) ; <i32> [#uses=0]132 ret void133}134 135declare i1 @llvm.isunordered.f32(float, float)136 137declare i32 @bar(...)138 139declare i32 @baz(...)140 141define void @test_cmpfp0(ptr %glob, i32 %X) {142;CHECK-LABEL: test_cmpfp0:143entry:144 %tmp = load float, ptr %glob ; <float> [#uses=1]145;CHECK: vcmp.f32146 %tmp.upgrd.3 = fcmp ogt float %tmp, 0.000000e+00 ; <i1> [#uses=1]147 br i1 %tmp.upgrd.3, label %cond_true, label %cond_false148 149cond_true: ; preds = %entry150 %tmp.upgrd.4 = tail call i32 (...) @bar( ) ; <i32> [#uses=0]151 ret void152 153cond_false: ; preds = %entry154 %tmp1 = tail call i32 (...) @baz( ) ; <i32> [#uses=0]155 ret void156}157