1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define i1 @floor_x_ole(float %x) {
5 ; CHECK-LABEL: @floor_x_ole(
6 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf ord float [[X:%.*]], 0.000000e+00
7 ; CHECK-NEXT: ret i1 [[RET]]
9 %floor = call float @llvm.floor.f32(float %x)
10 %ret = fcmp ninf ole float %floor, %x
14 define i1 @floor_x_ule(float %x) {
15 ; CHECK-LABEL: @floor_x_ule(
16 ; CHECK-NEXT: ret i1 true
18 %floor = call float @llvm.floor.f32(float %x)
19 %ret = fcmp ule float %floor, %x
23 define i1 @floor_x_ogt(float %x) {
24 ; CHECK-LABEL: @floor_x_ogt(
25 ; CHECK-NEXT: ret i1 false
27 %floor = call float @llvm.floor.f32(float %x)
28 %ret = fcmp ogt float %floor, %x
32 define i1 @floor_x_ugt(float %x) {
33 ; CHECK-LABEL: @floor_x_ugt(
34 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf uno float [[X:%.*]], 0.000000e+00
35 ; CHECK-NEXT: ret i1 [[RET]]
37 %floor = call float @llvm.floor.f32(float %x)
38 %ret = fcmp ninf ugt float %floor, %x
42 define i1 @x_floor_oge(float %x) {
43 ; CHECK-LABEL: @x_floor_oge(
44 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf ord float [[X:%.*]], 0.000000e+00
45 ; CHECK-NEXT: ret i1 [[RET]]
47 %floor = call float @llvm.floor.f32(float %x)
48 %ret = fcmp ninf oge float %x, %floor
52 define i1 @x_floor_uge(float %x) {
53 ; CHECK-LABEL: @x_floor_uge(
54 ; CHECK-NEXT: ret i1 true
56 %floor = call float @llvm.floor.f32(float %x)
57 %ret = fcmp uge float %x, %floor
61 define i1 @x_floor_olt(float %x) {
62 ; CHECK-LABEL: @x_floor_olt(
63 ; CHECK-NEXT: ret i1 false
65 %floor = call float @llvm.floor.f32(float %x)
66 %ret = fcmp olt float %x, %floor
70 define i1 @x_floor_ult(float %x) {
71 ; CHECK-LABEL: @x_floor_ult(
72 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf uno float [[X:%.*]], 0.000000e+00
73 ; CHECK-NEXT: ret i1 [[RET]]
75 %floor = call float @llvm.floor.f32(float %x)
76 %ret = fcmp ninf ult float %x, %floor
80 define <2 x i1> @x_floor_olt_vec(<2 x float> %x) {
81 ; CHECK-LABEL: @x_floor_olt_vec(
82 ; CHECK-NEXT: ret <2 x i1> zeroinitializer
84 %floor = call <2 x float> @llvm.floor.f32(<2 x float> %x)
85 %ret = fcmp olt <2 x float> %x, %floor
89 define i1 @x_floor_ole_neg(float %x) {
90 ; CHECK-LABEL: @x_floor_ole_neg(
91 ; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
92 ; CHECK-NEXT: [[RET:%.*]] = fcmp ole float [[X]], [[FLOOR]]
93 ; CHECK-NEXT: ret i1 [[RET]]
95 %floor = call float @llvm.floor.f32(float %x)
96 %ret = fcmp ole float %x, %floor
100 define i1 @x_floor_ogt_neg(float %x) {
101 ; CHECK-LABEL: @x_floor_ogt_neg(
102 ; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
103 ; CHECK-NEXT: [[RET:%.*]] = fcmp ogt float [[X]], [[FLOOR]]
104 ; CHECK-NEXT: ret i1 [[RET]]
106 %floor = call float @llvm.floor.f32(float %x)
107 %ret = fcmp ogt float %x, %floor
111 define i1 @x_floor_ueq_neg(float %x) {
112 ; CHECK-LABEL: @x_floor_ueq_neg(
113 ; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
114 ; CHECK-NEXT: [[RET:%.*]] = fcmp ueq float [[X]], [[FLOOR]]
115 ; CHECK-NEXT: ret i1 [[RET]]
117 %floor = call float @llvm.floor.f32(float %x)
118 %ret = fcmp ueq float %x, %floor
122 define i1 @x_floor_une_neg(float %x) {
123 ; CHECK-LABEL: @x_floor_une_neg(
124 ; CHECK-NEXT: [[FLOOR:%.*]] = call float @llvm.floor.f32(float [[X:%.*]])
125 ; CHECK-NEXT: [[RET:%.*]] = fcmp une float [[X]], [[FLOOR]]
126 ; CHECK-NEXT: ret i1 [[RET]]
128 %floor = call float @llvm.floor.f32(float %x)
129 %ret = fcmp une float %x, %floor
133 define i1 @ceil_x_oge(float %x) {
134 ; CHECK-LABEL: @ceil_x_oge(
135 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf ord float [[X:%.*]], 0.000000e+00
136 ; CHECK-NEXT: ret i1 [[RET]]
138 %ceil = call float @llvm.ceil.f32(float %x)
139 %ret = fcmp ninf oge float %ceil, %x
143 define i1 @ceil_x_uge(float %x) {
144 ; CHECK-LABEL: @ceil_x_uge(
145 ; CHECK-NEXT: ret i1 true
147 %ceil = call float @llvm.ceil.f32(float %x)
148 %ret = fcmp uge float %ceil, %x
152 define i1 @ceil_x_olt(float %x) {
153 ; CHECK-LABEL: @ceil_x_olt(
154 ; CHECK-NEXT: ret i1 false
156 %ceil = call float @llvm.ceil.f32(float %x)
157 %ret = fcmp olt float %ceil, %x
161 define i1 @ceil_x_ult(float %x) {
162 ; CHECK-LABEL: @ceil_x_ult(
163 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf uno float [[X:%.*]], 0.000000e+00
164 ; CHECK-NEXT: ret i1 [[RET]]
166 %ceil = call float @llvm.ceil.f32(float %x)
167 %ret = fcmp ninf ult float %ceil, %x
171 define i1 @x_ceil_ole(float %x) {
172 ; CHECK-LABEL: @x_ceil_ole(
173 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf ord float [[X:%.*]], 0.000000e+00
174 ; CHECK-NEXT: ret i1 [[RET]]
176 %ceil = call float @llvm.ceil.f32(float %x)
177 %ret = fcmp ninf ole float %x, %ceil
181 define i1 @x_ceil_ule(float %x) {
182 ; CHECK-LABEL: @x_ceil_ule(
183 ; CHECK-NEXT: ret i1 true
185 %ceil = call float @llvm.ceil.f32(float %x)
186 %ret = fcmp ule float %x, %ceil
190 define i1 @x_ceil_ogt(float %x) {
191 ; CHECK-LABEL: @x_ceil_ogt(
192 ; CHECK-NEXT: ret i1 false
194 %ceil = call float @llvm.ceil.f32(float %x)
195 %ret = fcmp ogt float %x, %ceil
199 define i1 @x_ceil_ugt(float %x) {
200 ; CHECK-LABEL: @x_ceil_ugt(
201 ; CHECK-NEXT: [[RET:%.*]] = fcmp ninf uno float [[X:%.*]], 0.000000e+00
202 ; CHECK-NEXT: ret i1 [[RET]]
204 %ceil = call float @llvm.ceil.f32(float %x)
205 %ret = fcmp ninf ugt float %x, %ceil
209 define <2 x i1> @x_ceil_ogt_vec(<2 x float> %x) {
210 ; CHECK-LABEL: @x_ceil_ogt_vec(
211 ; CHECK-NEXT: ret <2 x i1> zeroinitializer
213 %ceil = call <2 x float> @llvm.ceil.f32(<2 x float> %x)
214 %ret = fcmp ogt <2 x float> %x, %ceil
218 define i1 @x_ceil_oge_neg(float %x) {
219 ; CHECK-LABEL: @x_ceil_oge_neg(
220 ; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
221 ; CHECK-NEXT: [[RET:%.*]] = fcmp oge float [[X]], [[CEIL]]
222 ; CHECK-NEXT: ret i1 [[RET]]
224 %ceil = call float @llvm.ceil.f32(float %x)
225 %ret = fcmp oge float %x, %ceil
229 define i1 @x_ceil_olt_neg(float %x) {
230 ; CHECK-LABEL: @x_ceil_olt_neg(
231 ; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
232 ; CHECK-NEXT: [[RET:%.*]] = fcmp olt float [[X]], [[CEIL]]
233 ; CHECK-NEXT: ret i1 [[RET]]
235 %ceil = call float @llvm.ceil.f32(float %x)
236 %ret = fcmp olt float %x, %ceil
240 define i1 @x_ceil_oeq_neg(float %x) {
241 ; CHECK-LABEL: @x_ceil_oeq_neg(
242 ; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
243 ; CHECK-NEXT: [[RET:%.*]] = fcmp oeq float [[X]], [[CEIL]]
244 ; CHECK-NEXT: ret i1 [[RET]]
246 %ceil = call float @llvm.ceil.f32(float %x)
247 %ret = fcmp oeq float %x, %ceil
251 define i1 @x_ceil_one_neg(float %x) {
252 ; CHECK-LABEL: @x_ceil_one_neg(
253 ; CHECK-NEXT: [[CEIL:%.*]] = call float @llvm.ceil.f32(float [[X:%.*]])
254 ; CHECK-NEXT: [[RET:%.*]] = fcmp one float [[X]], [[CEIL]]
255 ; CHECK-NEXT: ret i1 [[RET]]
257 %ceil = call float @llvm.ceil.f32(float %x)
258 %ret = fcmp one float %x, %ceil