[PATCH] D130016: [HLSL] Add __builtin_hlsl_create_handle

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 07:16:58 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfe13002bb37c: [HLSL] Add __builtin_hlsl_create_handle (authored by beanz).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130016/new/

https://reviews.llvm.org/D130016

Files:
  clang/include/clang/Basic/Builtins.def
  clang/test/CodeGenHLSL/builtins/create_handle.hlsl
  llvm/include/llvm/IR/IntrinsicsDirectX.td


Index: llvm/include/llvm/IR/IntrinsicsDirectX.td
===================================================================
--- llvm/include/llvm/IR/IntrinsicsDirectX.td
+++ llvm/include/llvm/IR/IntrinsicsDirectX.td
@@ -17,4 +17,6 @@
 def int_dx_thread_id_in_group : Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem, IntrWillReturn]>;
 def int_dx_flattened_thread_id_in_group : Intrinsic<[llvm_i32_ty], [], [IntrNoMem, IntrWillReturn]>;
 
+def int_dx_create_handle : ClangBuiltin<"__builtin_hlsl_create_handle">,
+    Intrinsic<[ llvm_ptr_ty ], [llvm_i8_ty], [IntrNoMem, IntrWillReturn]>;
 }
Index: clang/test/CodeGenHLSL/builtins/create_handle.hlsl
===================================================================
--- /dev/null
+++ clang/test/CodeGenHLSL/builtins/create_handle.hlsl
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
+
+void fn() {
+  (void)__builtin_hlsl_create_handle(0);
+}
+
+// CHECK: call ptr @llvm.dx.create.handle(i8 0)
Index: clang/include/clang/Basic/Builtins.def
===================================================================
--- clang/include/clang/Basic/Builtins.def
+++ clang/include/clang/Basic/Builtins.def
@@ -1700,6 +1700,7 @@
 
 // HLSL
 LANGBUILTIN(__builtin_hlsl_wave_active_count_bits, "Uib", "nc", HLSL_LANG)
+LANGBUILTIN(__builtin_hlsl_create_handle, "v*Uc", "nc", HLSL_LANG)
 
 // Builtins for XRay
 BUILTIN(__xray_customevent, "vcC*z", "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130016.448334.patch
Type: text/x-patch
Size: 1474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220728/86756593/attachment.bin>


More information about the cfe-commits mailing list