[clang] [HLSL] add extra scalar vector overloads for clamp (PR #129939)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 14 11:02:16 PDT 2025


================
@@ -0,0 +1,63 @@
+//===--- hlsl_compat_overloads.h - Additional HLSL overload definitions for
+// intrinsics --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _HLSL_COMPAT_OVERLOADS_H_
+#define _HLSl_COMPAT_OVERLOADS_H_
+
+namespace hlsl {
+
+// Note: Functions in this file are sorted alphabetically, then grouped by base
+// element type, and the element types are sorted by size, then singed integer,
+// unsigned integer and floating point. Keeping this ordering consistent will
+// help keep this file manageable as it grows.
+
+//===----------------------------------------------------------------------===//
+// clamp builtins overloads
+//===----------------------------------------------------------------------===//
+
+template <typename T, typename R, typename U, uint N>
----------------
spall wrote:

I can apply _HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)  if I call clamp instead of __builtin_hlsl_elementwise_clamp in the templates.

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


More information about the cfe-commits mailing list