From 997ed8fc66555789e0e6dbb8fd9c8029af9a1e54 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 13 Jul 2023 16:37:11 +0100 Subject: [PATCH] ac/llvm: skip ballot zext for 32-bit dest with wave32-as-wave64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NGG lowering can ballots with a 32-bit destination even if the ballot bit size is 64. Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Reviewed-by: Marek Olšák Cc: mesa-stable Part-of: (cherry picked from commit 0cb26f31feb954e7a1c49d54930f83c002329c7d) --- .pick_status.json | 2 +- src/amd/llvm/ac_nir_to_llvm.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index a50fc8ae37c..9505d982709 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -499,7 +499,7 @@ "description": "ac/llvm: skip ballot zext for 32-bit dest with wave32-as-wave64", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 31198c66ce8..5353f6218f8 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -3442,8 +3442,10 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins switch (instr->intrinsic) { case nir_intrinsic_ballot: result = ac_build_ballot(&ctx->ac, get_src(ctx, instr->src[0])); - if (ctx->ac.ballot_mask_bits > ctx->ac.wave_size) - result = LLVMBuildZExt(ctx->ac.builder, result, ctx->ac.iN_ballotmask, ""); + if (instr->dest.ssa.bit_size > ctx->ac.wave_size) { + LLVMTypeRef dest_type = LLVMIntTypeInContext(ctx->ac.context, instr->dest.ssa.bit_size); + result = LLVMBuildZExt(ctx->ac.builder, result, dest_type, ""); + } break; case nir_intrinsic_read_invocation: result =