[clang] [llvm] [AMDGPU] Add a new builtin type for image descriptor rsrc (PR #160258)

Rana Pratap Reddy via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 12:22:19 PDT 2025


================
@@ -0,0 +1,21 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 -triple amdgcn -Wno-unused-value %s
+
+void foo() {
+  int n = 1;
+  __amdgpu_image_rsrc_t v = 0;            // expected-error {{cannot initialize a variable of type '__amdgpu_image_rsrc_t' with an rvalue of type 'int'}}
+  static_cast<__amdgpu_image_rsrc_t>(n); // expected-error {{static_cast from 'int' to '__amdgpu_image_rsrc_t' is not allowed}}
+  reinterpret_cast<__amdgpu_image_rsrc_t>(n); // expected-error {{reinterpret_cast from 'int' to '__amdgpu_image_rsrc_t' is not allowed}}
+  (void)(v + v); // expected-error {{invalid operands}}
+  int x(v);      // expected-error {{cannot initialize a variable of type 'int' with an lvalue of type '__amdgpu_image_rsrc_t'}}
+  __amdgpu_image_rsrc_t k;
----------------
ranapratap55 wrote:

updated the tests.

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


More information about the llvm-commits mailing list