[llvm] [DXIL] Add sign intrinsic part 2 (PR #101988)
Tim Gymnich via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 06:20:18 PDT 2024
================
@@ -293,6 +295,36 @@ static bool expandClampIntrinsic(CallInst *Orig, Intrinsic::ID ClampIntrinsic) {
return true;
}
+static bool expandSignIntrinsic(CallInst *Orig) {
+ IRBuilder<> Builder(Orig->getParent());
+ Value *X = Orig->getOperand(0);
+ Type *Ty = X->getType();
+ Type *ScalarTy = Ty->getScalarType();
+ Type *RetTy = Orig->getType();
+ Constant *Zero = Constant::getNullValue(Ty);
+ Builder.SetInsertPoint(Orig);
----------------
tgymnich wrote:
We can either add `usign` builtins/intrinsics all the way down from hlsl to dxil and spirv. Or just add a high level builtin to hlsl.
I don't like the idea of having an intrinsic for `select(x == 0, 0, 1)`.
I wonder from a consistency point of view if it is even necessary to have a `usign` builtin since `abs` also only seems to offer the signed variants in `hlsl_intrinsics.h`.
https://github.com/llvm/llvm-project/pull/101988
More information about the llvm-commits
mailing list