================ @@ -18695,6 +18695,50 @@ 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)) + return Builder.CreateSelect(OpCond, OpTrue, OpFalse, "hlsl.select"); + + // if cond is a vector of bools lower to a shufflevector + // todo check if that true and false are vectors ---------------- coopp wrote:
There are some 'todo' comments here. Are these just for your own bookkeeping while working on this? Or are they stil something you need to do? The code below looks like you addressed them. I could be missing something. 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