[llvm] [DXIL] Add sign intrinsic part 2 (PR #101988)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 11:47:30 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);
----------------
farzonl wrote:
i'm not opposed to doing a high level operation for unsigned `sign` cases, however for reference this is what DXC does: https://github.com/microsoft/DirectXShaderCompiler/blob/0e7591a6ee94c8c8eb0d536ce7815fd56a776451/lib/HLSL/HLOperationLower.cpp#L2703C1-L2714C2
https://github.com/llvm/llvm-project/pull/101988
More information about the llvm-commits
mailing list