Mesa (master): amd: Fix warnings around variable sizes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 23 10:57:33 UTC 2021


Module: Mesa
Branch: master
Commit: 1351fcf3c3d71332a220e08c7785c2dd15419c8d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1351fcf3c3d71332a220e08c7785c2dd15419c8d

Author: James Park <jpark37 at lagfreegames.com>
Date:   Thu Apr 22 13:09:20 2021 -0700

amd: Fix warnings around variable sizes

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6162>

---

 src/amd/common/ac_nir_lower_tess_io_to_mem.c   | 2 +-
 src/amd/compiler/aco_instruction_selection.cpp | 2 +-
 src/amd/llvm/ac_llvm_build.c                   | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/amd/common/ac_nir_lower_tess_io_to_mem.c b/src/amd/common/ac_nir_lower_tess_io_to_mem.c
index 50c4786a03b..e9cd737e6ee 100644
--- a/src/amd/common/ac_nir_lower_tess_io_to_mem.c
+++ b/src/amd/common/ac_nir_lower_tess_io_to_mem.c
@@ -167,7 +167,7 @@ match_mask(nir_intrinsic_instr *intrin,
        intrin->intrinsic != nir_intrinsic_store_per_vertex_output)
       slot -= VARYING_SLOT_PATCH0;
 
-   return (1UL << slot) & mask;
+   return (UINT64_C(1) << slot) & mask;
 }
 
 static bool
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index c30795f79fd..2f9847157ee 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -10228,7 +10228,7 @@ static void export_vs_varying(isel_context *ctx, int slot, bool is_pos, int *nex
    int offset = (ctx->stage.has(SWStage::TES) && !ctx->stage.has(SWStage::GS))
                 ? ctx->program->info->tes.outinfo.vs_output_param_offset[slot]
                 : ctx->program->info->vs.outinfo.vs_output_param_offset[slot];
-   uint64_t mask = ctx->outputs.mask[slot];
+   unsigned mask = ctx->outputs.mask[slot];
    if (!is_pos && !mask)
       return;
    if (!is_pos && offset == AC_EXP_PARAM_UNDEFINED)
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index f9934dc4161..c1aebfe3ed3 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -1413,11 +1413,11 @@ static LLVMValueRef ac_ufN_to_float(struct ac_llvm_context *ctx, LLVMValueRef sr
    LLVMValueRef result;
 
    tmp = LLVMBuildICmp(ctx->builder, LLVMIntUGE, src,
-                       LLVMConstInt(ctx->i32, ((1 << exp_bits) - 1) << mant_bits, false), "");
+                       LLVMConstInt(ctx->i32, ((1ULL << exp_bits) - 1) << mant_bits, false), "");
    result = LLVMBuildSelect(ctx->builder, tmp, naninf, normal, "");
 
-   tmp = LLVMBuildICmp(ctx->builder, LLVMIntUGE, src, LLVMConstInt(ctx->i32, 1 << mant_bits, false),
-                       "");
+   tmp = LLVMBuildICmp(ctx->builder, LLVMIntUGE, src,
+                       LLVMConstInt(ctx->i32, 1ULL << mant_bits, false), "");
    result = LLVMBuildSelect(ctx->builder, tmp, result, denormal, "");
 
    tmp = LLVMBuildICmp(ctx->builder, LLVMIntNE, src, ctx->i32_0, "");



More information about the mesa-commit mailing list