[clang] [HLSL] Implement the `lit` intrinsic (PR #134171)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 3 16:43:44 PDT 2025


================
@@ -280,6 +280,22 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); }
 _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
 _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp)
 
+//===----------------------------------------------------------------------===//
+// lit builtins overloads
+//===----------------------------------------------------------------------===//
+
+template <typename T>
+constexpr __detail::enable_if_t<__detail::is_arithmetic<T>::Value &&
+                                    (__detail::is_same<double, T>::value ||
----------------
farzonl wrote:

> If we have to do templates can we instead do template type specializations. That should be more exclusive and then your catch all template would be the cast to float case.

Hmm on second thought maybe that prevents the is arithmetic stuff.

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


More information about the cfe-commits mailing list