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

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 11:49:25 PDT 2024


================
@@ -18666,6 +18666,15 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
         /*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getRsqrtIntrinsic(),
         ArrayRef<Value *>{Op0}, nullptr, "hlsl.rsqrt");
   }
+  case Builtin::BI__builtin_hlsl_elementwise_saturate: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    if (!E->getArg(0)->getType()->hasFloatingRepresentation())
----------------
farzonl wrote:

you already handle this case in `clang/lib/Sema/SemaHLSL.cpp` this should just be an assert.

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


More information about the cfe-commits mailing list