[clang] [llvm] Add step builtins and step HLSL function to DirectX and SPIR-V backend (PR #106471)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 6 15:55:16 PDT 2024
================
@@ -320,6 +321,28 @@ static Value *expandPowIntrinsic(CallInst *Orig) {
return Exp2Call;
}
+static Value *expandStepIntrinsic(CallInst *Orig) {
+
+ Value *X = Orig->getOperand(0);
+ Value *Y = Orig->getOperand(1);
+ Type *Ty = X->getType();
+ IRBuilder<> Builder(Orig);
+
+ Constant *one = ConstantFP::get(Ty->getScalarType(), 1.0);
+ Constant *zero = ConstantFP::get(Ty->getScalarType(), 0.0);
+ Value *cond = Builder.CreateFCmpOLT(Y, X);
----------------
bogner wrote:
Style nit: Variables should start with capital letters (One, Zero, Cond)
https://github.com/llvm/llvm-project/pull/106471
More information about the cfe-commits
mailing list