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

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 17 14:49:29 PDT 2024


================
@@ -325,6 +325,16 @@ def Abs :  DXILOp<6, unary> {
   let attributes = [Attributes<DXIL1_0, [ReadNone]>];
 }
 
+def Saturate :  DXILOp<7, unary> {
+  let Doc = "Clamps a single or double precision floating point value to [0.0f...1.0f].";
+  let LLVMIntrinsic = int_dx_saturate;
+  let arguments = [overloadTy];
+  let result = overloadTy;
+  let overloads = [Overloads<DXIL1_0, [halfTy, floatTy, doubleTy]>];
----------------
farzonl wrote:

I was a little suprised by `double` but yeah dxc generate `double @dx.op.unary.f64(i32 7, double %5)`

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


More information about the llvm-commits mailing list