From e5fc70b7992cd6a00a88806d466116fcc046be57 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 24 Jun 2019 23:34:06 +0000 Subject: [PATCH] AMDGPU: Fix missing declaration for mbcnt builtins git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364251 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/BuiltinsAMDGPU.def | 3 +++ test/CodeGenOpenCL/builtins-amdgcn.cl | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/clang/Basic/BuiltinsAMDGPU.def b/include/clang/Basic/BuiltinsAMDGPU.def index 49002f0f79..e882d3b87c 100644 --- a/include/clang/Basic/BuiltinsAMDGPU.def +++ b/include/clang/Basic/BuiltinsAMDGPU.def @@ -33,6 +33,9 @@ BUILTIN(__builtin_amdgcn_workitem_id_x, "Ui", "nc") BUILTIN(__builtin_amdgcn_workitem_id_y, "Ui", "nc") BUILTIN(__builtin_amdgcn_workitem_id_z, "Ui", "nc") +BUILTIN(__builtin_amdgcn_mbcnt_hi, "UiUiUi", "nc") +BUILTIN(__builtin_amdgcn_mbcnt_lo, "UiUiUi", "nc") + //===----------------------------------------------------------------------===// // Instruction builtins. //===----------------------------------------------------------------------===// diff --git a/test/CodeGenOpenCL/builtins-amdgcn.cl b/test/CodeGenOpenCL/builtins-amdgcn.cl index 3b710a81b1..e4c40d9226 100644 --- a/test/CodeGenOpenCL/builtins-amdgcn.cl +++ b/test/CodeGenOpenCL/builtins-amdgcn.cl @@ -578,6 +578,18 @@ kernel void test_gws_sema_p(uint id) { __builtin_amdgcn_ds_gws_sema_p(id); } +// CHECK-LABEL: @test_mbcnt_lo( +// CHECK: call i32 @llvm.amdgcn.mbcnt.lo(i32 %src0, i32 %src1) +kernel void test_mbcnt_lo(global uint* out, uint src0, uint src1) { + *out = __builtin_amdgcn_mbcnt_lo(src0, src1); +} + +// CHECK-LABEL: @test_mbcnt_hi( +// CHECK: call i32 @llvm.amdgcn.mbcnt.hi(i32 %src0, i32 %src1) +kernel void test_mbcnt_hi(global uint* out, uint src0, uint src1) { + *out = __builtin_amdgcn_mbcnt_hi(src0, src1); +} + // CHECK-DAG: [[$WI_RANGE]] = !{i32 0, i32 1024} // CHECK-DAG: attributes #[[$NOUNWIND_READONLY:[0-9]+]] = { nounwind readonly } // CHECK-DAG: attributes #[[$READ_EXEC_ATTRS]] = { convergent } -- 2.40.0