Skip to content

Commit

Permalink
[CIR][NFC] Replace ternary ops after lowering prepare to select ops (#…
Browse files Browse the repository at this point in the history
…800)

This PR refactors the LoweringPrepare pass and replaces various ternary
ops generated by LoweringPrepare with semantically equivalent select
ops.
  • Loading branch information
Lancern authored Aug 22, 2024
1 parent 5847da6 commit c207843
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 187 deletions.
75 changes: 11 additions & 64 deletions clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,17 +310,7 @@ static void canonicalizeIntrinsicThreeWayCmp(CIRBaseBuilderTy &builder,
loc, mlir::cir::IntAttr::get(input.getType(), yield));
auto eqToTest =
builder.createCompare(loc, mlir::cir::CmpOpKind::eq, input, testValue);
return builder
.create<mlir::cir::TernaryOp>(
loc, eqToTest,
[&](OpBuilder &, Location) {
builder.create<mlir::cir::YieldOp>(loc,
mlir::ValueRange{yieldValue});
},
[&](OpBuilder &, Location) {
builder.create<mlir::cir::YieldOp>(loc, mlir::ValueRange{input});
})
->getResult(0);
return builder.createSelect(loc, eqToTest, yieldValue, input);
};

if (cmpInfo.getLt() != -1)
Expand Down Expand Up @@ -460,32 +450,7 @@ static mlir::Value lowerComplexToScalarCast(MLIRContext &ctx, CastOp op) {
builder.createCast(op.getLoc(), elemToBoolKind, srcImag, boolTy);

// srcRealToBool || srcImagToBool
return builder
.create<mlir::cir::TernaryOp>(
op.getLoc(), srcRealToBool,
[&](mlir::OpBuilder &, mlir::Location) {
builder.createYield(op.getLoc(),
builder.getTrue(op.getLoc()).getResult());
},
[&](mlir::OpBuilder &, mlir::Location) {
auto inner =
builder
.create<mlir::cir::TernaryOp>(
op.getLoc(), srcImagToBool,
[&](mlir::OpBuilder &, mlir::Location) {
builder.createYield(
op.getLoc(),
builder.getTrue(op.getLoc()).getResult());
},
[&](mlir::OpBuilder &, mlir::Location) {
builder.createYield(
op.getLoc(),
builder.getFalse(op.getLoc()).getResult());
})
.getResult();
builder.createYield(op.getLoc(), inner);
})
.getResult();
return builder.createLogicalOr(op.getLoc(), srcRealToBool, srcImagToBool);
}

static mlir::Value lowerComplexToComplexCast(MLIRContext &ctx, CastOp op) {
Expand Down Expand Up @@ -652,26 +617,17 @@ static mlir::Value lowerComplexMul(LoweringPreparePass &pass,
// NaN. If so, emit a library call to compute the multiplication instead.
// We check a value against NaN by comparing the value against itself.
auto resultRealIsNaN = builder.createIsNaN(loc, resultReal);
auto resultImagIsNaN = builder.createIsNaN(loc, resultImag);
auto resultRealAndImagAreNaN =
builder.createLogicalAnd(loc, resultRealIsNaN, resultImagIsNaN);
return builder
.create<mlir::cir::TernaryOp>(
loc, resultRealIsNaN,
loc, resultRealAndImagAreNaN,
[&](mlir::OpBuilder &, mlir::Location) {
auto resultImagIsNaN = builder.createIsNaN(loc, resultImag);
auto inner =
builder
.create<mlir::cir::TernaryOp>(
loc, resultImagIsNaN,
[&](mlir::OpBuilder &, mlir::Location) {
auto libCallResult = buildComplexBinOpLibCall(
pass, builder, &getComplexMulLibCallName, loc, ty,
lhsReal, lhsImag, rhsReal, rhsImag);
builder.createYield(loc, libCallResult);
},
[&](mlir::OpBuilder &, mlir::Location) {
builder.createYield(loc, algebraicResult);
})
.getResult();
builder.createYield(loc, inner);
auto libCallResult = buildComplexBinOpLibCall(
pass, builder, &getComplexMulLibCallName, loc, ty, lhsReal,
lhsImag, rhsReal, rhsImag);
builder.createYield(loc, libCallResult);
},
[&](mlir::OpBuilder &, mlir::Location) {
builder.createYield(loc, algebraicResult);
Expand Down Expand Up @@ -877,16 +833,7 @@ void LoweringPreparePass::lowerThreeWayCmpOp(CmpThreeWayOp op) {
};
auto buildSelect = [&](mlir::Value condition, mlir::Value trueResult,
mlir::Value falseResult) -> mlir::Value {
return builder
.create<mlir::cir::TernaryOp>(
loc, condition,
[&](OpBuilder &, Location) {
builder.create<mlir::cir::YieldOp>(loc, trueResult);
},
[&](OpBuilder &, Location) {
builder.create<mlir::cir::YieldOp>(loc, falseResult);
})
.getResult();
return builder.createSelect(loc, condition, trueResult, falseResult);
};

mlir::Value transformedResult;
Expand Down
55 changes: 22 additions & 33 deletions clang/test/CIR/CodeGen/complex-arithmetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,12 @@ void mul() {
// CIR-FULL-NEXT: %[[#F:]] = cir.binop(add, %[[#C]], %[[#D]]) : !cir.double
// CIR-FULL-NEXT: %[[#RES:]] = cir.complex.create %[[#E]], %[[#F]] : !cir.double -> !cir.complex<!cir.double>
// CIR-FULL-NEXT: %[[#COND:]] = cir.cmp(ne, %[[#E]], %[[#E]]) : !cir.double, !cir.bool
// CIR-FULL-NEXT: %{{.+}} = cir.ternary(%[[#COND]], true {
// CIR-FULL-NEXT: %[[#COND2:]] = cir.cmp(ne, %[[#F]], %[[#F]]) : !cir.double, !cir.bool
// CIR-FULL-NEXT: %[[#INNER:]] = cir.ternary(%[[#COND2]], true {
// CIR-FULL-NEXT: %[[#RES2:]] = cir.call @__muldc3(%[[#LHSR]], %[[#LHSI]], %[[#RHSR]], %[[#RHSI]]) : (!cir.double, !cir.double, !cir.double, !cir.double) -> !cir.complex<!cir.double>
// CIR-FULL-NEXT: cir.yield %[[#RES2]] : !cir.complex<!cir.double>
// CIR-FULL-NEXT: }, false {
// CIR-FULL-NEXT: cir.yield %[[#RES]] : !cir.complex<!cir.double>
// CIR-FULL-NEXT: }) : (!cir.bool) -> !cir.complex<!cir.double>
// CIR-FULL-NEXT: cir.yield %[[#INNER]] : !cir.complex<!cir.double>
// CIR-FULL-NEXT: %[[#COND2:]] = cir.cmp(ne, %[[#F]], %[[#F]]) : !cir.double, !cir.bool
// CIR-FULL-NEXT: %[[#G:]] = cir.const #false
// CIR-FULL-NEXT: %[[#H:]] = cir.select if %[[#COND]] then %[[#COND2]] else %[[#G]] : (!cir.bool, !cir.bool, !cir.bool) -> !cir.bool
// CIR-FULL-NEXT: %{{.+}} = cir.ternary(%[[#H]], true {
// CIR-FULL-NEXT: %[[#RES2:]] = cir.call @__muldc3(%[[#LHSR]], %[[#LHSI]], %[[#RHSR]], %[[#RHSI]]) : (!cir.double, !cir.double, !cir.double, !cir.double) -> !cir.complex<!cir.double>
// CIR-FULL-NEXT: cir.yield %[[#RES2]] : !cir.complex<!cir.double>
// CIR-FULL-NEXT: }, false {
// CIR-FULL-NEXT: cir.yield %[[#RES]] : !cir.complex<!cir.double>
// CIR-FULL-NEXT: }) : (!cir.bool) -> !cir.complex<!cir.double>
Expand Down Expand Up @@ -306,30 +303,22 @@ void mul() {
// LLVM-FULL-NEXT: %[[#F:]] = fadd double %[[#C]], %[[#D]]
// LLVM-FULL-NEXT: %[[#G:]] = insertvalue { double, double } undef, double %[[#E]], 0
// LLVM-FULL-NEXT: %[[#RES:]] = insertvalue { double, double } %[[#G]], double %[[#F]], 1
// LLVM-FULL-NEXT: %[[#COND:]] = fcmp une double %[[#E]], %[[#E]]
// LLVM-FULL-NEXT: br i1 %[[#COND]], label %[[#LA:]], label %[[#LB:]]
// LLVM-FULL: [[#LA]]:
// LLVM-FULL-NEXT: %[[#H:]] = fcmp une double %[[#F]], %[[#F]]
// LLVM-FULL-NEXT: br i1 %[[#H]], label %[[#LC:]], label %[[#LD:]]
// LLVM-FULL: [[#LC]]:
// LLVM-FULL-NEXT: %[[#RES2:]] = call { double, double } @__muldc3(double %[[#LHSR]], double %[[#LHSI]], double %[[#RHSR]], double %[[#RHSI]])
// LLVM-FULL-NEXT: br label %[[#LE:]]
// LLVM-FULL: [[#LD]]:
// LLVM-FULL-NEXT: br label %[[#LE]]
// LLVM-FULL: [[#LE]]:
// LLVM-FULL-NEXT: %[[#RES3:]] = phi { double, double } [ %[[#RES]], %[[#LD]] ], [ %[[#RES2]], %[[#LC]] ]
// LLVM-FULL-NEXT: br label %[[#LF:]]
// LLVM-FULL: [[#LF]]:
// LLVM-FULL-NEXT: br label %[[#LG:]]
// LLVM-FULL: [[#LB]]:
// LLVM-FULL-NEXT: br label %[[#LG]]
// LLVM-FULL: [[#LG]]:
// LLVM-FULL-NEXT: %26 = phi { double, double } [ %[[#RES]], %[[#LB]] ], [ %[[#RES3]], %[[#LF]] ]

// LLVM-FULL: %[[#LHSR:]] = extractvalue { i32, i32 } %28, 0
// LLVM-FULL-NEXT: %[[#LHSI:]] = extractvalue { i32, i32 } %28, 1
// LLVM-FULL-NEXT: %[[#RHSR:]] = extractvalue { i32, i32 } %29, 0
// LLVM-FULL-NEXT: %[[#RHSI:]] = extractvalue { i32, i32 } %29, 1
// LLVM-FULL-NEXT: %[[#H:]] = fcmp une double %[[#E]], %[[#E]]
// LLVM-FULL-NEXT: %[[#COND:]] = zext i1 %[[#H]] to i8
// LLVM-FULL-NEXT: %[[#I:]] = fcmp une double %[[#F]], %[[#F]]
// LLVM-FULL-NEXT: %[[#COND2:]] = zext i1 %[[#I]] to i8
// LLVM-FULL-NEXT: %[[#J:]] = and i8 %[[#COND]], %[[#COND2]]
// LLVM-FULL-NEXT: %[[#COND3:]] = trunc i8 %[[#J]] to i1
// LLVM-FULL: {{.+}}:
// LLVM-FULL-NEXT: %{{.+}} = call { double, double } @__muldc3(double %[[#LHSR]], double %[[#LHSI]], double %[[#RHSR]], double %[[#RHSI]])
// LLVM-FULL-NEXT: br label %{{.+}}
// LLVM-FULL: {{.+}}:
// LLVM-FULL-NEXT: br label %{{.+}}

// LLVM-FULL: %[[#LHSR:]] = extractvalue { i32, i32 } %{{.+}}, 0
// LLVM-FULL-NEXT: %[[#LHSI:]] = extractvalue { i32, i32 } %{{.+}}, 1
// LLVM-FULL-NEXT: %[[#RHSR:]] = extractvalue { i32, i32 } %{{.+}}, 0
// LLVM-FULL-NEXT: %[[#RHSI:]] = extractvalue { i32, i32 } %{{.+}}, 1
// LLVM-FULL-NEXT: %[[#A:]] = mul i32 %[[#LHSR]], %[[#RHSR]]
// LLVM-FULL-NEXT: %[[#B:]] = mul i32 %[[#LHSI]], %[[#RHSI]]
// LLVM-FULL-NEXT: %[[#C:]] = mul i32 %[[#LHSR]], %[[#RHSI]]
Expand Down
70 changes: 10 additions & 60 deletions clang/test/CIR/CodeGen/complex-cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,83 +173,33 @@ void complex_to_bool() {
// CIR-AFTER-NEXT: %[[#IMAG:]] = cir.complex.imag %{{.+}} : !cir.complex<!cir.double> -> !cir.double
// CIR-AFTER-NEXT: %[[#RB:]] = cir.cast(float_to_bool, %[[#REAL]] : !cir.double), !cir.bool
// CIR-AFTER-NEXT: %[[#IB:]] = cir.cast(float_to_bool, %[[#IMAG]] : !cir.double), !cir.bool
// CIR-AFTER-NEXT: %{{.+}} = cir.ternary(%[[#RB]], true {
// CIR-AFTER-NEXT: %[[#A:]] = cir.const #true
// CIR-AFTER-NEXT: cir.yield %[[#A]] : !cir.bool
// CIR-AFTER-NEXT: }, false {
// CIR-AFTER-NEXT: %[[#B:]] = cir.ternary(%[[#IB]], true {
// CIR-AFTER-NEXT: %[[#C:]] = cir.const #true
// CIR-AFTER-NEXT: cir.yield %[[#C]] : !cir.bool
// CIR-AFTER-NEXT: }, false {
// CIR-AFTER-NEXT: %[[#D:]] = cir.const #false
// CIR-AFTER-NEXT: cir.yield %[[#D]] : !cir.bool
// CIR-AFTER-NEXT: }) : (!cir.bool) -> !cir.bool
// CIR-AFTER-NEXT: cir.yield %[[#B]] : !cir.bool
// CIR-AFTER-NEXT: }) : (!cir.bool) -> !cir.bool
// CIR-AFTER-NEXT: %[[#A:]] = cir.const #true
// CIR-AFTER-NEXT: %{{.+}} = cir.select if %[[#RB]] then %[[#A]] else %[[#IB]] : (!cir.bool, !cir.bool, !cir.bool) -> !cir.bool

// LLVM: %[[#REAL:]] = extractvalue { double, double } %{{.+}}, 0
// LLVM-NEXT: %[[#IMAG:]] = extractvalue { double, double } %{{.+}}, 1
// LLVM-NEXT: %[[#RB:]] = fcmp une double %[[#REAL]], 0.000000e+00
// LLVM-NEXT: %[[#RB2:]] = zext i1 %[[#RB]] to i8
// LLVM-NEXT: %[[#IB:]] = fcmp une double %[[#IMAG]], 0.000000e+00
// LLVM-NEXT: br i1 %[[#RB]], label %[[#LABEL_RB:]], label %[[#LABEL_RB_NOT:]]
// LLVM: [[#LABEL_RB]]:
// LLVM-NEXT: br label %[[#LABEL_EXIT:]]
// LLVM: [[#LABEL_RB_NOT]]:
// LLVM-NEXT: br i1 %[[#IB]], label %[[#LABEL_IB:]], label %[[#LABEL_IB_NOT:]]
// LLVM: [[#LABEL_IB]]:
// LLVM-NEXT: br label %[[#LABEL_A:]]
// LLVM: [[#LABEL_IB_NOT]]:
// LLVM-NEXT: br label %[[#LABEL_A]]
// LLVM: [[#LABEL_A]]:
// LLVM-NEXT: %[[#A:]] = phi i8 [ 0, %[[#LABEL_IB_NOT]] ], [ 1, %[[#LABEL_IB]] ]
// LLVM-NEXT: br label %[[#LABEL_B:]]
// LLVM: [[#LABEL_B]]:
// LLVM-NEXT: br label %[[#LABEL_EXIT]]
// LLVM: [[#LABEL_EXIT]]:
// LLVM-NEXT: %{{.+}} = phi i8 [ %[[#A]], %[[#LABEL_B]] ], [ 1, %[[#LABEL_RB]] ]
// LLVM-NEXT: br label %{{.+}}
// LLVM-NEXT: %[[#IB2:]] = zext i1 %[[#IB]] to i8
// LLVM-NEXT: %{{.+}} = or i8 %[[#RB2]], %[[#IB2]]

// CIR-BEFORE: %{{.+}} = cir.cast(int_complex_to_bool, %{{.+}} : !cir.complex<!s32i>), !cir.bool

// CIR-AFTER: %[[#REAL:]] = cir.complex.real %{{.+}} : !cir.complex<!s32i> -> !s32i
// CIR-AFTER-NEXT: %[[#IMAG:]] = cir.complex.imag %{{.+}} : !cir.complex<!s32i> -> !s32i
// CIR-AFTER-NEXT: %[[#RB:]] = cir.cast(int_to_bool, %[[#REAL]] : !s32i), !cir.bool
// CIR-AFTER-NEXT: %[[#IB:]] = cir.cast(int_to_bool, %[[#IMAG]] : !s32i), !cir.bool
// CIR-AFTER-NEXT: %{{.+}} = cir.ternary(%[[#RB]], true {
// CIR-AFTER-NEXT: %[[#A:]] = cir.const #true
// CIR-AFTER-NEXT: cir.yield %[[#A]] : !cir.bool
// CIR-AFTER-NEXT: }, false {
// CIR-AFTER-NEXT: %[[#B:]] = cir.ternary(%[[#IB]], true {
// CIR-AFTER-NEXT: %[[#C:]] = cir.const #true
// CIR-AFTER-NEXT: cir.yield %[[#C]] : !cir.bool
// CIR-AFTER-NEXT: }, false {
// CIR-AFTER-NEXT: %[[#D:]] = cir.const #false
// CIR-AFTER-NEXT: cir.yield %[[#D]] : !cir.bool
// CIR-AFTER-NEXT: }) : (!cir.bool) -> !cir.bool
// CIR-AFTER-NEXT: cir.yield %[[#B]] : !cir.bool
// CIR-AFTER-NEXT: }) : (!cir.bool) -> !cir.bool
// CIR-AFTER-NEXT: %[[#A:]] = cir.const #true
// CIR-AFTER-NEXT: %{{.+}} = cir.select if %[[#RB]] then %[[#A]] else %[[#IB]] : (!cir.bool, !cir.bool, !cir.bool) -> !cir.bool

// LLVM: %[[#REAL:]] = extractvalue { i32, i32 } %{{.+}}, 0
// LLVM-NEXT: %[[#IMAG:]] = extractvalue { i32, i32 } %{{.+}}, 1
// LLVM-NEXT: %[[#RB:]] = icmp ne i32 %[[#REAL]], 0
// LLVM-NEXT: %[[#RB2:]] = zext i1 %[[#RB]] to i8
// LLVM-NEXT: %[[#IB:]] = icmp ne i32 %[[#IMAG]], 0
// LLVM-NEXT: br i1 %[[#RB]], label %[[#LABEL_RB:]], label %[[#LABEL_RB_NOT:]]
// LLVM: [[#LABEL_RB]]:
// LLVM-NEXT: br label %[[#LABEL_EXIT:]]
// LLVM: [[#LABEL_RB_NOT]]:
// LLVM-NEXT: br i1 %[[#IB]], label %[[#LABEL_IB:]], label %[[#LABEL_IB_NOT:]]
// LLVM: [[#LABEL_IB]]:
// LLVM-NEXT: br label %[[#LABEL_A:]]
// LLVM: [[#LABEL_IB_NOT]]:
// LLVM-NEXT: br label %[[#LABEL_A]]
// LLVM: [[#LABEL_A]]:
// LLVM-NEXT: %[[#A:]] = phi i8 [ 0, %[[#LABEL_IB_NOT]] ], [ 1, %[[#LABEL_IB]] ]
// LLVM-NEXT: br label %[[#LABEL_B:]]
// LLVM: [[#LABEL_B]]:
// LLVM-NEXT: br label %[[#LABEL_EXIT]]
// LLVM: [[#LABEL_EXIT]]:
// LLVM-NEXT: %{{.+}} = phi i8 [ %[[#A]], %[[#LABEL_B]] ], [ 1, %[[#LABEL_RB]] ]
// LLVM-NEXT: br label %{{.+}}
// LLVM-NEXT: %[[#IB2:]] = zext i1 %[[#IB]] to i8
// LLVM-NEXT: %{{.+}} = or i8 %[[#RB2]], %[[#IB2]]

// CHECK: }

Expand Down
36 changes: 6 additions & 30 deletions clang/test/CIR/CodeGen/three-way-comparison.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,15 @@ auto three_way_strong(int x, int y) {
// NONCANONICAL-AFTER-NEXT: %[[#NEGONE:]] = cir.const #cir.int<-1> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#ONE:]] = cir.const #cir.int<1> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#CMP_TO_NEGONE:]] = cir.cmp(eq, %[[#CMP3WAY_RESULT]], %[[#NEGONE]]) : !s8i, !cir.bool
// NONCANONICAL-AFTER-NEXT: %[[#A:]] = cir.ternary(%[[#CMP_TO_NEGONE]], true {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#ONE]] : !s8i
// NONCANONICAL-AFTER-NEXT: }, false {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#CMP3WAY_RESULT]] : !s8i
// NONCANONICAL-AFTER-NEXT: }) : (!cir.bool) -> !s8i
// NONCANONICAL-AFTER-NEXT: %[[#A:]] = cir.select if %[[#CMP_TO_NEGONE]] then %[[#ONE]] else %[[#CMP3WAY_RESULT]] : (!cir.bool, !s8i, !s8i) -> !s8i
// NONCANONICAL-AFTER-NEXT: %[[#ZERO:]] = cir.const #cir.int<0> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#TWO:]] = cir.const #cir.int<2> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#CMP_TO_ZERO:]] = cir.cmp(eq, %[[#A]], %[[#ZERO]]) : !s8i, !cir.bool
// NONCANONICAL-AFTER-NEXT: %[[#B:]] = cir.ternary(%[[#CMP_TO_ZERO]], true {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#TWO]] : !s8i
// NONCANONICAL-AFTER-NEXT: }, false {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#A]] : !s8i
// NONCANONICAL-AFTER-NEXT: }) : (!cir.bool) -> !s8i
// NONCANONICAL-AFTER-NEXT: %[[#B:]] = cir.select if %[[#CMP_TO_ZERO]] then %[[#TWO]] else %[[#A]] : (!cir.bool, !s8i, !s8i) -> !s8i
// NONCANONICAL-AFTER-NEXT: %[[#ONE2:]] = cir.const #cir.int<1> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#THREE:]] = cir.const #cir.int<3> : !s8i
// NONCANONICAL-AFTER-NEXT: %[[#CMP_TO_ONE:]] = cir.cmp(eq, %[[#B]], %[[#ONE2]]) : !s8i, !cir.bool
// NONCANONICAL-AFTER-NEXT: %{{.+}} = cir.ternary(%[[#CMP_TO_ONE]], true {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#THREE]] : !s8i
// NONCANONICAL-AFTER-NEXT: }, false {
// NONCANONICAL-AFTER-NEXT: cir.yield %[[#B]] : !s8i
// NONCANONICAL-AFTER-NEXT: }) : (!cir.bool) -> !s8i
// NONCANONICAL-AFTER-NEXT: %{{.+}} = cir.select if %[[#CMP_TO_ONE]] then %[[#THREE]] else %[[#B]] : (!cir.bool, !s8i, !s8i) -> !s8i
// NONCANONICAL-AFTER: }

auto three_way_weak(float x, float y) {
Expand All @@ -74,19 +62,7 @@ auto three_way_weak(float x, float y) {
// AFTER-NEXT: %[[#CMP_LT:]] = cir.cmp(lt, %[[#LHS]], %[[#RHS]]) : !cir.float, !cir.bool
// AFTER-NEXT: %[[#CMP_EQ:]] = cir.cmp(eq, %[[#LHS]], %[[#RHS]]) : !cir.float, !cir.bool
// AFTER-NEXT: %[[#CMP_GT:]] = cir.cmp(gt, %[[#LHS]], %[[#RHS]]) : !cir.float, !cir.bool
// AFTER-NEXT: %[[#CMP_EQ_RES:]] = cir.ternary(%[[#CMP_EQ]], true {
// AFTER-NEXT: cir.yield %[[#EQ]] : !s8i
// AFTER-NEXT: }, false {
// AFTER-NEXT: cir.yield %[[#UNORDERED]] : !s8i
// AFTER-NEXT: }) : (!cir.bool) -> !s8i
// AFTER-NEXT: %[[#CMP_GT_RES:]] = cir.ternary(%[[#CMP_GT]], true {
// AFTER-NEXT: cir.yield %[[#GT]] : !s8i
// AFTER-NEXT: }, false {
// AFTER-NEXT: cir.yield %[[#CMP_EQ_RES]] : !s8i
// AFTER-NEXT: }) : (!cir.bool) -> !s8i
// AFTER-NEXT: %{{.+}} = cir.ternary(%[[#CMP_LT]], true {
// AFTER-NEXT: cir.yield %[[#LT]] : !s8i
// AFTER-NEXT: }, false {
// AFTER-NEXT: cir.yield %[[#CMP_GT_RES]] : !s8i
// AFTER-NEXT: }) : (!cir.bool) -> !s8i
// AFTER-NEXT: %[[#CMP_EQ_RES:]] = cir.select if %[[#CMP_EQ]] then %[[#EQ]] else %[[#UNORDERED]] : (!cir.bool, !s8i, !s8i) -> !s8i
// AFTER-NEXT: %[[#CMP_GT_RES:]] = cir.select if %[[#CMP_GT]] then %[[#GT]] else %[[#CMP_EQ_RES]] : (!cir.bool, !s8i, !s8i) -> !s8i
// AFTER-NEXT: %{{.+}} = cir.select if %[[#CMP_LT]] then %[[#LT]] else %[[#CMP_GT_RES]] : (!cir.bool, !s8i, !s8i) -> !s8i
// AFTER: }

0 comments on commit c207843

Please sign in to comment.