amd/common: Use correct writemask for shared memory stores.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 23 Jan 2019 21:44:05 +0000 (22:44 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 6 Feb 2019 21:35:49 +0000 (22:35 +0100)
The check was for 1 bit being set, which is clearly not what we want.

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_nir_to_llvm.c

index efd3e260af1a48154fc14b963cb498bd0307cdc2..6ba0ee74f11c4865debf08a79c4ae2786a230a21 100644 (file)
@@ -2107,7 +2107,7 @@ visit_store_var(struct ac_nir_context *ctx,
                int writemask = instr->const_index[0];
                LLVMValueRef address = get_src(ctx, instr->src[0]);
                LLVMValueRef val = get_src(ctx, instr->src[1]);
-               if (util_is_power_of_two_nonzero(writemask)) {
+               if (writemask == (1u << ac_get_llvm_num_components(val)) - 1) {
                        val = LLVMBuildBitCast(
                           ctx->ac.builder, val,
                           LLVMGetElementType(LLVMTypeOf(address)), "");