[clang] [llvm] [HLSL] Adding HLSL `clip` function. (PR #114588)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 14:19:21 PST 2024


================
@@ -89,6 +89,7 @@ let TargetPrefix = "spv" in {
   def int_spv_sign : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i32_ty>], [llvm_any_ty], [IntrNoMem]>;
   def int_spv_radians : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
   def int_spv_group_memory_barrier_with_group_sync : DefaultAttrsIntrinsic<[], [], []>;
+  def int_spv_clip : Intrinsic<[], [], []>;
----------------
joaosaffran wrote:

The signature for this intrinsic is different in DX and SPIRV by design. As discussed here: https://github.com/llvm/llvm-project/pull/114588#discussion_r1828324074, `SPIRVInstructionSelector.cpp` doesn't support creating new basic blocks. So after discussing with @farzonl, we came to a conclusion that, in order to not introduce new patterns to intrisic creations, we are handling most of the codegen and `CGBuiltin.cpp`. As a consequence, the codegen requires those intrinsic to have different signatures.

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


More information about the cfe-commits mailing list