From 6a67e05a26eb5f58665bd6d063b9f389e7dd28a7 Mon Sep 17 00:00:00 2001 From: Aaron En Ye Shi Date: Wed, 12 May 2021 19:53:47 +0000 Subject: [PATCH] [HIP] Add __builtin_amdgcn_groupstaticsize Differential Revision: https://reviews.llvm.org/D102403 --- clang/include/clang/Basic/BuiltinsAMDGPU.def | 1 + clang/test/CodeGenOpenCL/builtins-amdgcn-ci.cl | 6 ++++++ clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl | 7 +++++++ clang/test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl | 8 ++++++++ clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl | 7 +++++++ 5 files changed, 29 insertions(+) diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def b/clang/include/clang/Basic/BuiltinsAMDGPU.def index 7dcbf9a..e3782fc 100644 --- a/clang/include/clang/Basic/BuiltinsAMDGPU.def +++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def @@ -65,6 +65,7 @@ BUILTIN(__builtin_amdgcn_ds_gws_sema_v, "vUi", "n") BUILTIN(__builtin_amdgcn_ds_gws_sema_br, "vUiUi", "n") BUILTIN(__builtin_amdgcn_ds_gws_sema_p, "vUi", "n") BUILTIN(__builtin_amdgcn_fence, "vUicC*", "n") +BUILTIN(__builtin_amdgcn_groupstaticsize, "Ui", "n") BUILTIN(__builtin_amdgcn_atomic_inc32, "UZiUZiD*UZiUicC*", "n") BUILTIN(__builtin_amdgcn_atomic_inc64, "UWiUWiD*UWiUicC*", "n") diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-ci.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn-ci.cl index 56da7ec..15ddd17 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn-ci.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-ci.cl @@ -62,3 +62,9 @@ int test_is_shared_global(const global int* ptr) { int test_is_private_global(const global int* ptr) { return __builtin_amdgcn_is_private(ptr); } + +// CHECK-LABEL: @test_groupstaticsize +// CHECK: call i32 @llvm.amdgcn.groupstaticsize() +void test_groupstaticsize(global uint* out) { + *out = __builtin_amdgcn_groupstaticsize(); +} diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl index a9bbaa9..3b21d41 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl @@ -30,3 +30,10 @@ void test_s_memtime(global ulong* out) { *out = __builtin_amdgcn_s_memtime(); } + +// CHECK-LABEL: @test_groupstaticsize +// CHECK: call i32 @llvm.amdgcn.groupstaticsize() +void test_groupstaticsize(global uint* out) +{ + *out = __builtin_amdgcn_groupstaticsize(); +} diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl index 420506e..3bc1811 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1010 -S -emit-llvm -o - %s | FileCheck %s #pragma OPENCL EXTENSION cl_khr_fp16 : enable +typedef unsigned int uint; typedef unsigned long ulong; // CHECK-LABEL: @test_fmed3_f16 @@ -18,3 +19,10 @@ void test_s_memtime(global ulong* out) { *out = __builtin_amdgcn_s_memtime(); } + +// CHECK-LABEL: @test_groupstaticsize +// CHECK: call i32 @llvm.amdgcn.groupstaticsize() +void test_groupstaticsize(global uint* out) +{ + *out = __builtin_amdgcn_groupstaticsize(); +} diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl index be59458..fe2c169 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl @@ -145,3 +145,10 @@ void test_perm(global uint* out, uint a, uint b, uint s) { *out = __builtin_amdgcn_perm(a, b, s); } + +// CHECK-LABEL: @test_groupstaticsize +// CHECK: call i32 @llvm.amdgcn.groupstaticsize() +void test_groupstaticsize(global uint* out) +{ + *out = __builtin_amdgcn_groupstaticsize(); +} -- 2.7.4