================ @@ -18695,6 +18695,48 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: { CGM.getHLSLRuntime().getSaturateIntrinsic(), ArrayRef<Value *>{Op0}, nullptr, "hlsl.saturate"); } + case Builtin::BI__builtin_hlsl_select: { + Value *OpCond = EmitScalarExpr(E->getArg(0)); + Value *OpTrue = EmitScalarExpr(E->getArg(1)); + Value *OpFalse = EmitScalarExpr(E->getArg(2)); + llvm::Type *TCond = OpCond->getType(); + + // if cond is a bool emit a select instruction + if (TCond->isIntegerTy(1)) ---------------- farzonl wrote:
NIT: Stylistically in `EmitHLSLBuiltinExpr` we have been checking error cases upfront and ending the case statements with a return. If it isn't a ton of trouble change this to ```cpp if (!TCond->isIntegerTy(1)) llvm_unreachable("Select requires a bool or vector of bools as its first operand."); ... return Result; ``` https://github.com/llvm/llvm-project/pull/107129 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits