1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instsimplify %s | FileCheck %s
define float @sitofp_floor(i32 %arg) {
; CHECK-LABEL: @sitofp_floor(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%round = call float @llvm.floor.f32(float %cvt)
ret float %round
}
define float @uitofp_floor(i32 %arg) {
; CHECK-LABEL: @uitofp_floor(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%round = call float @llvm.floor.f32(float %cvt)
ret float %round
}
define float @sitofp_trunc(i32 %arg) {
; CHECK-LABEL: @sitofp_trunc(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%round = call float @llvm.trunc.f32(float %cvt)
ret float %round
}
define float @uitofp_trunc(i32 %arg) {
; CHECK-LABEL: @uitofp_trunc(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%round = call float @llvm.trunc.f32(float %cvt)
ret float %round
}
define float @sitofp_ceil(i32 %arg) {
; CHECK-LABEL: @sitofp_ceil(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%round = call float @llvm.ceil.f32(float %cvt)
ret float %round
}
define float @uitofp_ceil(i32 %arg) {
; CHECK-LABEL: @uitofp_ceil(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%round = call float @llvm.ceil.f32(float %cvt)
ret float %round
}
define float @sitofp_round(i32 %arg) {
; CHECK-LABEL: @sitofp_round(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%round = call float @llvm.round.f32(float %cvt)
ret float %round
}
define float @uitofp_round(i32 %arg) {
; CHECK-LABEL: @uitofp_round(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%round = call float @llvm.round.f32(float %cvt)
ret float %round
}
define float @sitofp_nearbyint(i32 %arg) {
; CHECK-LABEL: @sitofp_nearbyint(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%nearbyint = call float @llvm.nearbyint.f32(float %cvt)
ret float %nearbyint
}
define float @uitofp_nearbyint(i32 %arg) {
; CHECK-LABEL: @uitofp_nearbyint(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%nearbyint = call float @llvm.nearbyint.f32(float %cvt)
ret float %nearbyint
}
define float @sitofp_rint(i32 %arg) {
; CHECK-LABEL: @sitofp_rint(
; CHECK-NEXT: [[CVT:%.*]] = sitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = sitofp i32 %arg to float
%rint = call float @llvm.rint.f32(float %cvt)
ret float %rint
}
define float @uitofp_rint(i32 %arg) {
; CHECK-LABEL: @uitofp_rint(
; CHECK-NEXT: [[CVT:%.*]] = uitofp i32 [[ARG:%.*]] to float
; CHECK-NEXT: ret float [[CVT]]
;
%cvt = uitofp i32 %arg to float
%rint = call float @llvm.rint.f32(float %cvt)
ret float %rint
}
declare float @llvm.floor.f32(float) #0
declare float @llvm.trunc.f32(float) #0
declare float @llvm.ceil.f32(float) #0
declare float @llvm.round.f32(float) #0
declare float @llvm.nearbyint.f32(float) #0
declare float @llvm.rint.f32(float) #0
attributes #0 = { nounwind readnone speculatable }
|