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