[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 10:06:10 PDT 2024


================
@@ -0,0 +1,84 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature
+ // REQUIRES: amdgpu-registered-target
+ // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu verde -emit-llvm -o - %s | FileCheck %s
+ // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu tonga -emit-llvm -o - %s | FileCheck %s
+ // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1100 -emit-llvm -o - %s | FileCheck %s
+
+typedef struct AA_ty {
+  int x;
+  __amdgcn_buffer_rsrc_t r;
+} AA;
+
+AA getAA(void *p);
+__amdgcn_buffer_rsrc_t getBufferImpl(void *p);
+void consumeBuffer(__amdgcn_buffer_rsrc_t);
+
+// CHECK-LABEL: define {{[^@]+}}@getBuffer
----------------
shiltian wrote:

As I mentioned in the previous outdated comment, `update_cc_test_checks.py` doesn't check return type even with `--function-signature`. However, the `ret` instruction at the end of the function can be used to verify the return type. In this case, it has `ret ptr addrspace(8) [[CALL]]` so the return type is `ptr addrspace(8)`.

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


More information about the cfe-commits mailing list