[clang] [llvm] [HLSL] Implement support for HLSL intrinsic - saturate (PR #104619)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 17 14:59:50 PDT 2024


================
@@ -362,6 +364,34 @@ static bool expandClampIntrinsic(CallInst *Orig, Intrinsic::ID ClampIntrinsic) {
   return true;
 }
 
+static bool expandSaturateIntrinsic(CallInst *SaturateCall) {
+  FunctionType *FT = SaturateCall->getFunctionType();
+  Type *FTRetTy = FT->getReturnType();
+  assert(FTRetTy == FT->getParamType(0) &&
----------------
farzonl wrote:

It looks like you are trying to do scalarization via this pass, but we haven't been doing that thus far. I wanted to take care of scalarization in a different pass because doing it here means we have to do it for each intrinsic which I want to avoid. My feeling is scalarization should be uniform across all intrinsics unless there are special cases like `dot2`, `dot3`, `dot4`.

https://github.com/llvm/llvm-project/pull/104619


More information about the cfe-commits mailing list