[clang] [Clang][AMDGPU] Accept builtins in lambda declarations (PR #135027)
Juan Manuel Martinez CaamaƱo via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 07:14:43 PDT 2025
================
@@ -0,0 +1,24 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -std=c++20 -triple amdgcn -target-cpu tahiti -fsyntax-only -fcuda-is-device -verify=expected -o - %s
+// RUN: %clang_cc1 -std=c++20 -triple amdgcn -target-cpu gfx950 -fsyntax-only -fcuda-is-device -o - %s
+
+#define __device__ __attribute__((device))
+#define __shared__ __attribute__((shared))
+
+struct S {
+ static constexpr auto make_buffer_rsrc_lambda = [](void *p, short stride, int num, int flags) {
+ return __builtin_amdgcn_make_buffer_rsrc(p, stride, num, flags);
+ };
+
+ static constexpr auto global_load_lds_lambda = [](void* src, __shared__ void *dst) {
+ __builtin_amdgcn_global_load_lds(src, dst, 16, 0, 0); // expected-error{{invalid size value}} expected-note{{size must be 1, 2, or 4}}
+ };
+};
+
----------------
jmmartinez wrote:
Add a test where we assign a value to a global outside a struct.
https://github.com/llvm/llvm-project/pull/135027
More information about the cfe-commits
mailing list