567 lines · plain
1// RUN: mlir-opt %s -canonicalize="test-convergence" | FileCheck %s2 3// CHECK-LABEL: @ceil_fold4// CHECK: %[[cst:.+]] = arith.constant 1.000000e+00 : f325// CHECK: return %[[cst]]6func.func @ceil_fold() -> f32 {7 %c = arith.constant 0.3 : f328 %r = math.ceil %c : f329 return %r : f3210}11 12// CHECK-LABEL: @ceil_fold213// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f3214// CHECK: return %[[cst]]15func.func @ceil_fold2() -> f32 {16 %c = arith.constant 2.0 : f3217 %r = math.ceil %c : f3218 return %r : f3219}20 21// CHECK-LABEL: @log2_fold22// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f3223 // CHECK: return %[[cst]]24func.func @log2_fold() -> f32 {25 %c = arith.constant 4.0 : f3226 %r = math.log2 %c : f3227 return %r : f3228}29 30// CHECK-LABEL: @log2_fold231// CHECK: %[[cst:.+]] = arith.constant 0xFF800000 : f3232 // CHECK: return %[[cst]]33func.func @log2_fold2() -> f32 {34 %c = arith.constant 0.0 : f3235 %r = math.log2 %c : f3236 return %r : f3237}38 39// CHECK-LABEL: @log2_nofold240// CHECK: %[[cst:.+]] = arith.constant -1.000000e+00 : f3241// CHECK: %[[res:.+]] = math.log2 %[[cst]] : f3242 // CHECK: return %[[res]]43func.func @log2_nofold2() -> f32 {44 %c = arith.constant -1.0 : f3245 %r = math.log2 %c : f3246 return %r : f3247}48 49// CHECK-LABEL: @log2_fold_6450// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f6451 // CHECK: return %[[cst]]52func.func @log2_fold_64() -> f64 {53 %c = arith.constant 4.0 : f6454 %r = math.log2 %c : f6455 return %r : f6456}57 58// CHECK-LABEL: @log2_fold2_6459// CHECK: %[[cst:.+]] = arith.constant 0xFFF0000000000000 : f6460 // CHECK: return %[[cst]]61func.func @log2_fold2_64() -> f64 {62 %c = arith.constant 0.0 : f6463 %r = math.log2 %c : f6464 return %r : f6465}66 67// CHECK-LABEL: @log2_nofold2_6468// CHECK: %[[cst:.+]] = arith.constant -1.000000e+00 : f6469// CHECK: %[[res:.+]] = math.log2 %[[cst]] : f6470 // CHECK: return %[[res]]71func.func @log2_nofold2_64() -> f64 {72 %c = arith.constant -1.0 : f6473 %r = math.log2 %c : f6474 return %r : f6475}76 77// CHECK-LABEL: @log2_fold_vec78// CHECK: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 1.000000e+00, 1.58{{[0-9]+}}, 2.000000e+00]> : vector<4xf32>79// CHECK: return %[[cst]]80func.func @log2_fold_vec() -> (vector<4xf32>) {81 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>82 %0 = math.log2 %v1 : vector<4xf32>83 return %0 : vector<4xf32>84}85 86// CHECK-LABEL: @powf_fold87// CHECK: %[[cst:.+]] = arith.constant 4.000000e+00 : f3288// CHECK: return %[[cst]]89func.func @powf_fold() -> f32 {90 %c = arith.constant 2.0 : f3291 %r = math.powf %c, %c : f3292 return %r : f3293}94 95// CHECK-LABEL: @powf_fold_vec96// CHECK: %[[cst:.+]] = arith.constant dense<[1.000000e+00, 4.000000e+00, 9.000000e+00, 1.600000e+01]> : vector<4xf32>97// CHECK: return %[[cst]]98func.func @powf_fold_vec() -> (vector<4xf32>) {99 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>100 %v2 = arith.constant dense<[2.0, 2.0, 2.0, 2.0]> : vector<4xf32>101 %0 = math.powf %v1, %v2 : vector<4xf32>102 return %0 : vector<4xf32>103}104 105// CHECK-LABEL: @sqrt_fold106// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f32107// CHECK: return %[[cst]]108func.func @sqrt_fold() -> f32 {109 %c = arith.constant 4.0 : f32110 %r = math.sqrt %c : f32111 return %r : f32112}113 114// CHECK-LABEL: @sqrt_fold_vec115// CHECK: %[[cst:.+]] = arith.constant dense<[1.000000e+00, 1.41{{[0-9]+}}, 1.73{{[0-9]+}}, 2.000000e+00]> : vector<4xf32>116// CHECK: return %[[cst]]117func.func @sqrt_fold_vec() -> (vector<4xf32>) {118 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>119 %0 = math.sqrt %v1 : vector<4xf32>120 return %0 : vector<4xf32>121}122 123// CHECK-LABEL: @abs_fold124// CHECK: %[[cst:.+]] = arith.constant 4.000000e+00 : f32125// CHECK: return %[[cst]]126func.func @abs_fold() -> f32 {127 %c = arith.constant -4.0 : f32128 %r = math.absf %c : f32129 return %r : f32130}131 132// CHECK-LABEL: @copysign_fold133// CHECK: %[[cst:.+]] = arith.constant -4.000000e+00 : f32134// CHECK: return %[[cst]]135func.func @copysign_fold() -> f32 {136 %c1 = arith.constant 4.0 : f32137 %c2 = arith.constant -9.0 : f32138 %r = math.copysign %c1, %c2 : f32139 return %r : f32140}141 142// CHECK-LABEL: @ctlz_fold1143// CHECK: %[[cst:.+]] = arith.constant 31 : i32144// CHECK: return %[[cst]]145func.func @ctlz_fold1() -> i32 {146 %c = arith.constant 1 : i32147 %r = math.ctlz %c : i32148 return %r : i32149}150 151// CHECK-LABEL: @ctlz_fold2152// CHECK: %[[cst:.+]] = arith.constant 7 : i8153// CHECK: return %[[cst]]154func.func @ctlz_fold2() -> i8 {155 %c = arith.constant 1 : i8156 %r = math.ctlz %c : i8157 return %r : i8158}159 160// CHECK-LABEL: @cttz_fold161// CHECK: %[[cst:.+]] = arith.constant 8 : i32162// CHECK: return %[[cst]]163func.func @cttz_fold() -> i32 {164 %c = arith.constant 256 : i32165 %r = math.cttz %c : i32166 return %r : i32167}168 169// CHECK-LABEL: @ctpop_fold170// CHECK: %[[cst:.+]] = arith.constant 16 : i32171// CHECK: return %[[cst]]172func.func @ctpop_fold() -> i32 {173 %c = arith.constant 0xFF0000FF : i32174 %r = math.ctpop %c : i32175 return %r : i32176}177 178// CHECK-LABEL: @log10_fold179// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f32180 // CHECK: return %[[cst]]181func.func @log10_fold() -> f32 {182 %c = arith.constant 100.0 : f32183 %r = math.log10 %c : f32184 return %r : f32185}186 187// CHECK-LABEL: @log10_fold_vec188// CHECK: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 1.000000e+00, 2.000000e+00, 2.30{{[0-9]+}}e+00]> : vector<4xf32>189// CHECK: return %[[cst]]190func.func @log10_fold_vec() -> (vector<4xf32>) {191 %v1 = arith.constant dense<[1.0, 10.0, 100.0, 200.0]> : vector<4xf32>192 %0 = math.log10 %v1 : vector<4xf32>193 return %0 : vector<4xf32>194}195 196// CHECK-LABEL: @log1p_fold197// CHECK: %[[cst:.+]] = arith.constant 2.8903718 : f32198 // CHECK: return %[[cst]]199func.func @log1p_fold() -> f32 {200 %c = arith.constant 17.0 : f32201 %r = math.log1p %c : f32202 return %r : f32203}204 205// CHECK-LABEL: @log1p_fold_vec206// CHECK: %[[cst:.+]] = arith.constant dense<[1.38{{[0-9]+}}, 1.79{{[0-9]+}}, 2.07{{[0-9]+}}, 2.48{{[0-9]+}}]> : vector<4xf32>207// CHECK: return %[[cst]]208func.func @log1p_fold_vec() -> (vector<4xf32>) {209 %v1 = arith.constant dense<[3.0, 5.0, 7.0, 11.0]> : vector<4xf32>210 %0 = math.log1p %v1 : vector<4xf32>211 return %0 : vector<4xf32>212}213 214// CHECK-LABEL: @log_fold215// CHECK: %[[cst:.+]] = arith.constant 0.693147182 : f32216 // CHECK: return %[[cst]]217func.func @log_fold() -> f32 {218 %c = arith.constant 2.0 : f32219 %r = math.log %c : f32220 return %r : f32221}222 223// CHECK-LABEL: @log_fold_vec224// CHECK: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 0.69{{[0-9]+}}, 1.09{{[0-9]+}}, 1.38{{[0-9]+}}]> : vector<4xf32225// CHECK: return %[[cst]]226func.func @log_fold_vec() -> (vector<4xf32>) {227 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>228 %0 = math.log %v1 : vector<4xf32>229 return %0 : vector<4xf32>230}231 232// CHECK-LABEL: @exp_fold233// CHECK-NEXT: %[[cst:.+]] = arith.constant 7.3890562 : f32234// CHECK-NEXT: return %[[cst]]235func.func @exp_fold() -> f32 {236 %c = arith.constant 2.0 : f32237 %r = math.exp %c : f32238 return %r : f32239}240 241// CHECK-LABEL: @exp_fold_vec242// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[2.71{{[0-9]+}}, 7.38{{[0-9]+}}, 20.08{{[0-9]+}}, 54.59{{[0-9]+}}]> : vector<4xf32>243// CHECK-NEXT: return %[[cst]]244func.func @exp_fold_vec() -> (vector<4xf32>) {245 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>246 %0 = math.exp %v1 : vector<4xf32>247 return %0 : vector<4xf32>248}249 250// CHECK-LABEL: @exp2_fold251// CHECK-NEXT: %[[cst:.+]] = arith.constant 4.000000e+00 : f32252// CHECK-NEXT: return %[[cst]]253func.func @exp2_fold() -> f32 {254 %c = arith.constant 2.0 : f32255 %r = math.exp2 %c : f32256 return %r : f32257}258 259// CHECK-LABEL: @exp2_fold_vec260// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[2.000000e+00, 4.000000e+00, 8.000000e+00, 1.600000e+01]> : vector<4xf32>261// CHECK-NEXT: return %[[cst]]262func.func @exp2_fold_vec() -> (vector<4xf32>) {263 %v1 = arith.constant dense<[1.0, 2.0, 3.0, 4.0]> : vector<4xf32>264 %0 = math.exp2 %v1 : vector<4xf32>265 return %0 : vector<4xf32>266}267 268// CHECK-LABEL: @expm1_fold269// CHECK-NEXT: %[[cst:.+]] = arith.constant 6.3890562 : f32270// CHECK-NEXT: return %[[cst]]271func.func @expm1_fold() -> f32 {272 %c = arith.constant 2.0 : f32273 %r = math.expm1 %c : f32274 return %r : f32275}276 277// CHECK-LABEL: @expm1_fold_vec278// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 1.71828{{[0-9]*}}, 0.000000e+00, 1.71828{{[0-9]*}}]> : vector<4xf32>279// CHECK-NEXT: return %[[cst]]280func.func @expm1_fold_vec() -> (vector<4xf32>) {281 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>282 %0 = math.expm1 %v1 : vector<4xf32>283 return %0 : vector<4xf32>284}285 286 287// CHECK-LABEL: @tan_fold288// CHECK-NEXT: %[[cst:.+]] = arith.constant 1.55740774 : f32289// CHECK-NEXT: return %[[cst]]290func.func @tan_fold() -> f32 {291 %c = arith.constant 1.0 : f32292 %r = math.tan %c : f32293 return %r : f32294}295 296// CHECK-LABEL: @tan_fold_vec297// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 1.55{{[0-9]+}}, 0.000000e+00, 1.55{{[0-9]+}}]> : vector<4xf32>298// CHECK-NEXT: return %[[cst]]299func.func @tan_fold_vec() -> (vector<4xf32>) {300 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>301 %0 = math.tan %v1 : vector<4xf32>302 return %0 : vector<4xf32>303}304 305// CHECK-LABEL: @tanh_fold306// CHECK-NEXT: %[[cst:.+]] = arith.constant 0.76{{[0-9]+}} : f32307// CHECK-NEXT: return %[[cst]]308func.func @tanh_fold() -> f32 {309 %c = arith.constant 1.0 : f32310 %r = math.tanh %c : f32311 return %r : f32312}313 314// CHECK-LABEL: @tanh_fold_vec315// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 0.76{{[0-9]+}}, 0.000000e+00, 0.76{{[0-9]+}}]> : vector<4xf32>316// CHECK-NEXT: return %[[cst]]317func.func @tanh_fold_vec() -> (vector<4xf32>) {318 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>319 %0 = math.tanh %v1 : vector<4xf32>320 return %0 : vector<4xf32>321}322 323// CHECK-LABEL: @atan_fold324// CHECK-NEXT: %[[cst:.+]] = arith.constant 0.78{{[0-9]+}} : f32325// CHECK-NEXT: return %[[cst]]326func.func @atan_fold() -> f32 {327 %c = arith.constant 1.0 : f32328 %r = math.atan %c : f32329 return %r : f32330}331 332// CHECK-LABEL: @atan_fold_vec333// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 0.78{{[0-9]+}}, 0.000000e+00, 0.78{{[0-9]+}}]> : vector<4xf32>334// CHECK-NEXT: return %[[cst]]335func.func @atan_fold_vec() -> (vector<4xf32>) {336 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>337 %0 = math.atan %v1 : vector<4xf32>338 return %0 : vector<4xf32>339}340 341// CHECK-LABEL: @atan2_fold342// CHECK-NEXT: %[[cst:.+]] = arith.constant 0.000000e+00 : f32343// CHECK-NEXT: return %[[cst]]344func.func @atan2_fold() -> f32 {345 %c1 = arith.constant 0.0 : f32346 %c2 = arith.constant 1.0 : f32347 %r = math.atan2 %c1, %c2 : f32348 return %r : f32349}350 351// CHECK-LABEL: @atan2_fold_vec352// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, 0.000000e+00, 0.46{{[0-9]+}}, 0.46{{[0-9]+}}]> : vector<4xf32>353// CHECK-NEXT: return %[[cst]]354func.func @atan2_fold_vec() -> (vector<4xf32>) {355 %v1 = arith.constant dense<[0.0, 0.0, 1.0, 1.0]> : vector<4xf32>356 %v2 = arith.constant dense<[1.0, 1.0, 2.0, 2.0]> : vector<4xf32>357 %0 = math.atan2 %v1, %v2 : vector<4xf32>358 return %0 : vector<4xf32>359}360 361// CHECK-LABEL: @cos_fold362// CHECK-NEXT: %[[cst:.+]] = arith.constant 0.54{{[0-9]+}} : f32363// CHECK-NEXT: return %[[cst]]364func.func @cos_fold() -> f32 {365 %c = arith.constant 1.0 : f32366 %r = math.cos %c : f32367 return %r : f32368}369 370// CHECK-LABEL: @cos_fold_vec371// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[1.000000e+00, 0.54{{[0-9]+}}, 1.000000e+00, 0.54{{[0-9]+}}]> : vector<4xf32>372// CHECK-NEXT: return %[[cst]]373func.func @cos_fold_vec() -> (vector<4xf32>) {374 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>375 %0 = math.cos %v1 : vector<4xf32>376 return %0 : vector<4xf32>377}378 379// CHECK-LABEL: @roundeven_fold380// CHECK-NEXT: %[[cst:.+]] = arith.constant 2.000000e+00 : f32381// CHECK-NEXT: return %[[cst]]382func.func @roundeven_fold() -> f32 {383 %c = arith.constant 1.5 : f32384 %r = math.roundeven %c : f32385 return %r : f32386}387 388// CHECK-LABEL: @roundeven_fold_vec389// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, -0.000000e+00, 2.000000e+00, -2.000000e+00]> : vector<4xf32>390// CHECK-NEXT: return %[[cst]]391func.func @roundeven_fold_vec() -> (vector<4xf32>) {392 %v1 = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32>393 %0 = math.roundeven %v1 : vector<4xf32>394 return %0 : vector<4xf32>395}396 397// CHECK-LABEL: @round_fold398// CHECK-NEXT: %[[cst:.+]] = arith.constant 2.000000e+00 : f32399// CHECK-NEXT: return %[[cst]]400func.func @round_fold() -> f32 {401 %c = arith.constant 1.5 : f32402 %r = math.round %c : f32403 return %r : f32404}405 406// CHECK-LABEL: @round_fold_vec407// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[1.000000e+00, -1.000000e+00, 2.000000e+00, -2.000000e+00]> : vector<4xf32>408// CHECK-NEXT: return %[[cst]]409func.func @round_fold_vec() -> (vector<4xf32>) {410 %v1 = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32>411 %0 = math.round %v1 : vector<4xf32>412 return %0 : vector<4xf32>413}414 415// CHECK-LABEL: @floor_fold416// CHECK: %[[cst:.+]] = arith.constant 0.000000e+00 : f32417// CHECK: return %[[cst]]418func.func @floor_fold() -> f32 {419 %c = arith.constant 0.3 : f32420 %r = math.floor %c : f32421 return %r : f32422}423 424// CHECK-LABEL: @floor_fold2425// CHECK: %[[cst:.+]] = arith.constant 2.000000e+00 : f32426// CHECK: return %[[cst]]427func.func @floor_fold2() -> f32 {428 %c = arith.constant 2.0 : f32429 %r = math.floor %c : f32430 return %r : f32431}432 433// CHECK-LABEL: @trunc_fold434// CHECK-NEXT: %[[cst:.+]] = arith.constant 1.000000e+00 : f32435// CHECK-NEXT: return %[[cst]]436func.func @trunc_fold() -> f32 {437 %c = arith.constant 1.1 : f32438 %r = math.trunc %c : f32439 return %r : f32440}441 442// CHECK-LABEL: @trunc_fold_vec443// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, -0.000000e+00, 1.000000e+00, -1.000000e+00]> : vector<4xf32>444// CHECK-NEXT: return %[[cst]]445func.func @trunc_fold_vec() -> (vector<4xf32>) {446 %v = arith.constant dense<[0.5, -0.5, 1.5, -1.5]> : vector<4xf32>447 %0 = math.trunc %v : vector<4xf32>448 return %0 : vector<4xf32>449}450 451// CHECK-LABEL: @sin_fold452// CHECK-NEXT: %[[cst:.+]] = arith.constant {{0.84[0-9]+|8.4[0-9]+e-01}} : f32453// CHECK-NEXT: return %[[cst]]454func.func @sin_fold() -> f32 {455 %c = arith.constant 1.0 : f32456 %r = math.sin %c : f32457 return %r : f32458}459 460// CHECK-LABEL: @sin_fold_vec461// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, {{0.84[0-9]+|8.4[0-9]+e-01}}, 0.000000e+00, {{0.84[0-9]+|8.4[0-9]+e-01}}]> : vector<4xf32>462// CHECK-NEXT: return %[[cst]]463func.func @sin_fold_vec() -> (vector<4xf32>) {464 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>465 %0 = math.sin %v1 : vector<4xf32>466 return %0 : vector<4xf32>467}468 469// CHECK-LABEL: @erf_fold470// CHECK-NEXT: %[[cst:.+]] = arith.constant {{0.84[0-9]+|8.4[0-9]+e-01}} : f32471// CHECK-NEXT: return %[[cst]]472func.func @erf_fold() -> f32 {473 %c = arith.constant 1.0 : f32474 %r = math.erf %c : f32475 return %r : f32476}477 478// CHECK-LABEL: @erf_fold_vec479// CHECK-NEXT: %[[cst:.+]] = arith.constant dense<[0.000000e+00, {{0.84[0-9]+|8.4[0-9]+e-01}}, 0.000000e+00, {{0.84[0-9]+|8.4[0-9]+e-01}}]> : vector<4xf32>480// CHECK-NEXT: return %[[cst]]481func.func @erf_fold_vec() -> (vector<4xf32>) {482 %v1 = arith.constant dense<[0.0, 1.0, 0.0, 1.0]> : vector<4xf32>483 %0 = math.erf %v1 : vector<4xf32>484 return %0 : vector<4xf32>485}486 487// CHECK-LABEL: @abs_poison488// CHECK: %[[P:.*]] = ub.poison : f32489// CHECK: return %[[P]]490func.func @abs_poison() -> f32 {491 %0 = ub.poison : f32492 %1 = math.absf %0 : f32493 return %1 : f32494}495 496// CHECK-LABEL: @isfinite_fold497// CHECK: %[[cst:.+]] = arith.constant true498// CHECK: return %[[cst]]499func.func @isfinite_fold() -> i1 {500 %c = arith.constant 2.0 : f32501 %r = math.isfinite %c : f32502 return %r : i1503}504 505// CHECK-LABEL: @isfinite_fold_vec506// CHECK: %[[cst:.+]] = arith.constant dense<true> : vector<4xi1>507// CHECK: return %[[cst]]508func.func @isfinite_fold_vec() -> (vector<4xi1>) {509 %v1 = arith.constant dense<2.0> : vector<4xf32>510 %0 = math.isfinite %v1 : vector<4xf32>511 return %0 : vector<4xi1>512}513 514// CHECK-LABEL: @isinf_fold515// CHECK: %[[cst:.+]] = arith.constant false516// CHECK: return %[[cst]]517func.func @isinf_fold() -> i1 {518 %c = arith.constant 2.0 : f32519 %r = math.isinf %c : f32520 return %r : i1521}522 523// CHECK-LABEL: @isinf_fold_vec524// CHECK: %[[cst:.+]] = arith.constant dense<false> : vector<4xi1>525// CHECK: return %[[cst]]526func.func @isinf_fold_vec() -> (vector<4xi1>) {527 %v1 = arith.constant dense<2.0> : vector<4xf32>528 %0 = math.isinf %v1 : vector<4xf32>529 return %0 : vector<4xi1>530}531 532// CHECK-LABEL: @isnan_fold533// CHECK: %[[cst:.+]] = arith.constant false534// CHECK: return %[[cst]]535func.func @isnan_fold() -> i1 {536 %c = arith.constant 2.0 : f32537 %r = math.isnan %c : f32538 return %r : i1539}540 541// CHECK-LABEL: @isnan_fold_vec542// CHECK: %[[cst:.+]] = arith.constant dense<false> : vector<4xi1>543// CHECK: return %[[cst]]544func.func @isnan_fold_vec() -> (vector<4xi1>) {545 %v1 = arith.constant dense<2.0> : vector<4xf32>546 %0 = math.isnan %v1 : vector<4xf32>547 return %0 : vector<4xi1>548}549 550// CHECK-LABEL: @isnormal_fold551// CHECK: %[[cst:.+]] = arith.constant true552// CHECK: return %[[cst]]553func.func @isnormal_fold() -> i1 {554 %c = arith.constant 2.0 : f32555 %r = math.isnormal %c : f32556 return %r : i1557}558 559// CHECK-LABEL: @isnormal_fold_vec560// CHECK: %[[cst:.+]] = arith.constant dense<true> : vector<4xi1>561// CHECK: return %[[cst]]562func.func @isnormal_fold_vec() -> (vector<4xi1>) {563 %v1 = arith.constant dense<2.0> : vector<4xf32>564 %0 = math.isnormal %v1 : vector<4xf32>565 return %0 : vector<4xi1>566}567