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

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 08:04:19 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())
----------------
bharadwajy wrote:

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

Changed.

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


More information about the llvm-commits mailing list