• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6define i32 @test1(float %a) {
7entry:
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
15define i32 @test2(float %a) {
16entry:
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
24define i32 @test3(double %a) {
25entry:
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
33define i32 @test4(double %a) {
34entry:
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
42define i32 @test5(float %a) {
43entry:
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
51define i32 @test6(float %a) {
52entry:
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
60define i32 @test7(double %a) {
61entry:
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
69define i32 @test8(double %a) {
70entry:
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
78define i32 @test9(float %a) {
79entry:
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
87define i32 @test10(float %a) {
88entry:
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
96define i32 @test11(double %a) {
97entry:
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
105define i32 @test12(double %a) {
106entry:
107  %call = call double @round(double %a) nounwind readnone
108  %conv = fptoui double %call to i32
109  ret i32 %conv
110}
111
112declare float @floorf(float) nounwind readnone
113declare double @floor(double) nounwind readnone
114declare float @ceilf(float) nounwind readnone
115declare double @ceil(double) nounwind readnone
116declare float @roundf(float) nounwind readnone
117declare double @round(double) nounwind readnone
118