1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -instsimplify %s | FileCheck %s
4 define float @sitofp_floor(i32 %arg) {
5 ; CHECK-LABEL: @sitofp_floor(
6 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
7 ; CHECK-NEXT: ret float [[CVT]]
9 %cvt = sitofp i32 %arg to float
10 %round = call float @llvm.floor.f32(float %cvt)
14 define float @uitofp_floor(i32 %arg) {
15 ; CHECK-LABEL: @uitofp_floor(
16 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
17 ; CHECK-NEXT: ret float [[CVT]]
19 %cvt = uitofp i32 %arg to float
20 %round = call float @llvm.floor.f32(float %cvt)
24 define float @sitofp_trunc(i32 %arg) {
25 ; CHECK-LABEL: @sitofp_trunc(
26 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
27 ; CHECK-NEXT: ret float [[CVT]]
29 %cvt = sitofp i32 %arg to float
30 %round = call float @llvm.trunc.f32(float %cvt)
34 define float @uitofp_trunc(i32 %arg) {
35 ; CHECK-LABEL: @uitofp_trunc(
36 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
37 ; CHECK-NEXT: ret float [[CVT]]
39 %cvt = uitofp i32 %arg to float
40 %round = call float @llvm.trunc.f32(float %cvt)
44 define float @sitofp_ceil(i32 %arg) {
45 ; CHECK-LABEL: @sitofp_ceil(
46 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
47 ; CHECK-NEXT: ret float [[CVT]]
49 %cvt = sitofp i32 %arg to float
50 %round = call float @llvm.ceil.f32(float %cvt)
54 define float @uitofp_ceil(i32 %arg) {
55 ; CHECK-LABEL: @uitofp_ceil(
56 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
57 ; CHECK-NEXT: ret float [[CVT]]
59 %cvt = uitofp i32 %arg to float
60 %round = call float @llvm.ceil.f32(float %cvt)
64 define float @sitofp_round(i32 %arg) {
65 ; CHECK-LABEL: @sitofp_round(
66 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
67 ; CHECK-NEXT: ret float [[CVT]]
69 %cvt = sitofp i32 %arg to float
70 %round = call float @llvm.round.f32(float %cvt)
74 define float @uitofp_round(i32 %arg) {
75 ; CHECK-LABEL: @uitofp_round(
76 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
77 ; CHECK-NEXT: ret float [[CVT]]
79 %cvt = uitofp i32 %arg to float
80 %round = call float @llvm.round.f32(float %cvt)
84 define float @sitofp_nearbyint(i32 %arg) {
85 ; CHECK-LABEL: @sitofp_nearbyint(
86 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
87 ; CHECK-NEXT: ret float [[CVT]]
89 %cvt = sitofp i32 %arg to float
90 %nearbyint = call float @llvm.nearbyint.f32(float %cvt)
94 define float @uitofp_nearbyint(i32 %arg) {
95 ; CHECK-LABEL: @uitofp_nearbyint(
96 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
97 ; CHECK-NEXT: ret float [[CVT]]
99 %cvt = uitofp i32 %arg to float
100 %nearbyint = call float @llvm.nearbyint.f32(float %cvt)
104 define float @sitofp_rint(i32 %arg) {
105 ; CHECK-LABEL: @sitofp_rint(
106 ; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
107 ; CHECK-NEXT: ret float [[CVT]]
109 %cvt = sitofp i32 %arg to float
110 %rint = call float @llvm.rint.f32(float %cvt)
114 define float @uitofp_rint(i32 %arg) {
115 ; CHECK-LABEL: @uitofp_rint(
116 ; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
117 ; CHECK-NEXT: ret float [[CVT]]
119 %cvt = uitofp i32 %arg to float
120 %rint = call float @llvm.rint.f32(float %cvt)
124 declare float @llvm.floor.f32(float) #0
125 declare float @llvm.trunc.f32(float) #0
126 declare float @llvm.ceil.f32(float) #0
127 declare float @llvm.round.f32(float) #0
128 declare float @llvm.nearbyint.f32(float) #0
129 declare float @llvm.rint.f32(float) #0
131 attributes #0 = { nounwind readnone speculatable }