1*e62f3654SChad Rosier; RUN: llc < %s -mtriple=armv8-linux-gnueabi -mattr=+fp-armv8 | FileCheck %s 2*e62f3654SChad Rosier; RUN: llc < %s -mtriple=armv8-linux-gnueabihf -mattr=+fp-armv8 | FileCheck %s 3*e62f3654SChad Rosier 4*e62f3654SChad Rosier; CHECK-LABEL: test1 5*e62f3654SChad Rosier; CHECK: vcvtm.s32.f32 6*e62f3654SChad Rosierdefine i32 @test1(float %a) { 7*e62f3654SChad Rosierentry: 8*e62f3654SChad Rosier %call = call float @floorf(float %a) nounwind readnone 9*e62f3654SChad Rosier %conv = fptosi float %call to i32 10*e62f3654SChad Rosier ret i32 %conv 11*e62f3654SChad Rosier} 12*e62f3654SChad Rosier 13*e62f3654SChad Rosier; CHECK-LABEL: test2 14*e62f3654SChad Rosier; CHECK: vcvtm.u32.f32 15*e62f3654SChad Rosierdefine i32 @test2(float %a) { 16*e62f3654SChad Rosierentry: 17*e62f3654SChad Rosier %call = call float @floorf(float %a) nounwind readnone 18*e62f3654SChad Rosier %conv = fptoui float %call to i32 19*e62f3654SChad Rosier ret i32 %conv 20*e62f3654SChad Rosier} 21*e62f3654SChad Rosier 22*e62f3654SChad Rosier; CHECK-LABEL: test3 23*e62f3654SChad Rosier; CHECK: vcvtm.s32.f64 24*e62f3654SChad Rosierdefine i32 @test3(double %a) { 25*e62f3654SChad Rosierentry: 26*e62f3654SChad Rosier %call = call double @floor(double %a) nounwind readnone 27*e62f3654SChad Rosier %conv = fptosi double %call to i32 28*e62f3654SChad Rosier ret i32 %conv 29*e62f3654SChad Rosier} 30*e62f3654SChad Rosier 31*e62f3654SChad Rosier; CHECK-LABEL: test4 32*e62f3654SChad Rosier; CHECK: vcvtm.u32.f64 33*e62f3654SChad Rosierdefine i32 @test4(double %a) { 34*e62f3654SChad Rosierentry: 35*e62f3654SChad Rosier %call = call double @floor(double %a) nounwind readnone 36*e62f3654SChad Rosier %conv = fptoui double %call to i32 37*e62f3654SChad Rosier ret i32 %conv 38*e62f3654SChad Rosier} 39*e62f3654SChad Rosier 40*e62f3654SChad Rosier; CHECK-LABEL: test5 41*e62f3654SChad Rosier; CHECK: vcvtp.s32.f32 42*e62f3654SChad Rosierdefine i32 @test5(float %a) { 43*e62f3654SChad Rosierentry: 44*e62f3654SChad Rosier %call = call float @ceilf(float %a) nounwind readnone 45*e62f3654SChad Rosier %conv = fptosi float %call to i32 46*e62f3654SChad Rosier ret i32 %conv 47*e62f3654SChad Rosier} 48*e62f3654SChad Rosier 49*e62f3654SChad Rosier; CHECK-LABEL: test6 50*e62f3654SChad Rosier; CHECK: vcvtp.u32.f32 51*e62f3654SChad Rosierdefine i32 @test6(float %a) { 52*e62f3654SChad Rosierentry: 53*e62f3654SChad Rosier %call = call float @ceilf(float %a) nounwind readnone 54*e62f3654SChad Rosier %conv = fptoui float %call to i32 55*e62f3654SChad Rosier ret i32 %conv 56*e62f3654SChad Rosier} 57*e62f3654SChad Rosier 58*e62f3654SChad Rosier; CHECK-LABEL: test7 59*e62f3654SChad Rosier; CHECK: vcvtp.s32.f64 60*e62f3654SChad Rosierdefine i32 @test7(double %a) { 61*e62f3654SChad Rosierentry: 62*e62f3654SChad Rosier %call = call double @ceil(double %a) nounwind readnone 63*e62f3654SChad Rosier %conv = fptosi double %call to i32 64*e62f3654SChad Rosier ret i32 %conv 65*e62f3654SChad Rosier} 66*e62f3654SChad Rosier 67*e62f3654SChad Rosier; CHECK-LABEL: test8 68*e62f3654SChad Rosier; CHECK: vcvtp.u32.f64 69*e62f3654SChad Rosierdefine i32 @test8(double %a) { 70*e62f3654SChad Rosierentry: 71*e62f3654SChad Rosier %call = call double @ceil(double %a) nounwind readnone 72*e62f3654SChad Rosier %conv = fptoui double %call to i32 73*e62f3654SChad Rosier ret i32 %conv 74*e62f3654SChad Rosier} 75*e62f3654SChad Rosier 76*e62f3654SChad Rosier; CHECK-LABEL: test9 77*e62f3654SChad Rosier; CHECK: vcvta.s32.f32 78*e62f3654SChad Rosierdefine i32 @test9(float %a) { 79*e62f3654SChad Rosierentry: 80*e62f3654SChad Rosier %call = call float @roundf(float %a) nounwind readnone 81*e62f3654SChad Rosier %conv = fptosi float %call to i32 82*e62f3654SChad Rosier ret i32 %conv 83*e62f3654SChad Rosier} 84*e62f3654SChad Rosier 85*e62f3654SChad Rosier; CHECK-LABEL: test10 86*e62f3654SChad Rosier; CHECK: vcvta.u32.f32 87*e62f3654SChad Rosierdefine i32 @test10(float %a) { 88*e62f3654SChad Rosierentry: 89*e62f3654SChad Rosier %call = call float @roundf(float %a) nounwind readnone 90*e62f3654SChad Rosier %conv = fptoui float %call to i32 91*e62f3654SChad Rosier ret i32 %conv 92*e62f3654SChad Rosier} 93*e62f3654SChad Rosier 94*e62f3654SChad Rosier; CHECK-LABEL: test11 95*e62f3654SChad Rosier; CHECK: vcvta.s32.f64 96*e62f3654SChad Rosierdefine i32 @test11(double %a) { 97*e62f3654SChad Rosierentry: 98*e62f3654SChad Rosier %call = call double @round(double %a) nounwind readnone 99*e62f3654SChad Rosier %conv = fptosi double %call to i32 100*e62f3654SChad Rosier ret i32 %conv 101*e62f3654SChad Rosier} 102*e62f3654SChad Rosier 103*e62f3654SChad Rosier; CHECK-LABEL: test12 104*e62f3654SChad Rosier; CHECK: vcvta.u32.f64 105*e62f3654SChad Rosierdefine i32 @test12(double %a) { 106*e62f3654SChad Rosierentry: 107*e62f3654SChad Rosier %call = call double @round(double %a) nounwind readnone 108*e62f3654SChad Rosier %conv = fptoui double %call to i32 109*e62f3654SChad Rosier ret i32 %conv 110*e62f3654SChad Rosier} 111*e62f3654SChad Rosier 112*e62f3654SChad Rosierdeclare float @floorf(float) nounwind readnone 113*e62f3654SChad Rosierdeclare double @floor(double) nounwind readnone 114*e62f3654SChad Rosierdeclare float @ceilf(float) nounwind readnone 115*e62f3654SChad Rosierdeclare double @ceil(double) nounwind readnone 116*e62f3654SChad Rosierdeclare float @roundf(float) nounwind readnone 117*e62f3654SChad Rosierdeclare double @round(double) nounwind readnone 118