From 47c9dea6ac63d70d261029588d618dd82527d992 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 13 Jul 2023 14:46:49 +0100 Subject: [PATCH] ac/llvm: fix wave32 ac_build_mbcnt_add with 64-bit mask MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Reviewed-by: Marek Olšák Cc: mesa-stable Part-of: --- src/amd/llvm/ac_llvm_build.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 5ef1d28..08960c2 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -2752,6 +2752,9 @@ LLVMValueRef ac_build_mbcnt_add(struct ac_llvm_context *ctx, LLVMValueRef mask, LLVMValueRef val; if (ctx->wave_size == 32) { + if (LLVMTypeOf(mask) == ctx->i64) + mask = LLVMBuildTrunc(ctx->builder, mask, ctx->i32, ""); + val = ac_build_intrinsic(ctx, "llvm.amdgcn.mbcnt.lo", ctx->i32, (LLVMValueRef[]){mask, add}, 2, 0); } else { -- 2.7.4