From 4c24c8239a5da7fc09ee43155e66f5d71c68ccba Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 25 Aug 2020 10:15:27 -0700 Subject: [PATCH] panfrost: Fix remaining release-build warnings. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 6 +++--- src/panfrost/bifrost/bi_print.c | 2 +- src/panfrost/bifrost/bi_schedule.c | 2 +- src/panfrost/bifrost/disassemble.c | 3 +-- src/panfrost/lib/gen_pack.py | 3 +-- src/panfrost/midgard/midgard_compile.c | 6 +++--- src/panfrost/midgard/midgard_emit.c | 4 ++-- src/panfrost/midgard/midgard_ra.c | 4 ++-- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index d4a61a2671b..2c30017d9e2 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -1476,7 +1476,7 @@ bi_pack_add_tex_compact(bi_clause *clause, bi_instruction *ins, bi_registers *re static unsigned bi_pack_add_select(bi_instruction *ins, bi_registers *regs) { - unsigned size = nir_alu_type_get_type_size(ins->src_types[0]); + ASSERTED unsigned size = nir_alu_type_get_type_size(ins->src_types[0]); assert(size == 16); unsigned swiz = (ins->swizzle[0][0] | (ins->swizzle[1][0] << 1)); @@ -1591,7 +1591,7 @@ static unsigned bi_pack_add_cmp(bi_instruction *ins, bi_registers *regs) { nir_alu_type Tl = ins->src_types[0]; - nir_alu_type Tr = ins->src_types[1]; + ASSERTED nir_alu_type Tr = ins->src_types[1]; nir_alu_type Bl = nir_alu_type_get_base_type(Tl); if (Bl == nir_type_uint || Bl == nir_type_int) { @@ -1827,7 +1827,7 @@ bi_pack_constants(bi_context *ctx, bi_clause *clause, { /* After these two, are we done? Determines tag */ bool done = clause->constant_count <= (index + 2); - bool only = clause->constant_count <= (index + 1); + ASSERTED bool only = clause->constant_count <= (index + 1); /* Is the constant we're packing for a branch? */ bool branches = clause->branch_constant && done; diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c index 7b231c39b65..dcb22df0571 100644 --- a/src/panfrost/bifrost/bi_print.c +++ b/src/panfrost/bifrost/bi_print.c @@ -285,7 +285,7 @@ bi_print_instruction(bi_instruction *ins, FILE *fp) fprintf(fp, "%s", bi_round_mode_name(ins->roundmode)); fprintf(fp, " "); - bool succ = bi_print_dest_index(fp, ins, ins->dest); + ASSERTED bool succ = bi_print_dest_index(fp, ins, ins->dest); assert(succ); if (ins->dest_offset) diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 248d9d80a9e..066d3458608 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -188,7 +188,7 @@ bi_schedule(bi_context *ctx) /* Check for scheduling restrictions */ bool can_fma = props & BI_SCHED_FMA; - bool can_add = props & BI_SCHED_ADD; + ASSERTED bool can_add = props & BI_SCHED_ADD; can_fma &= !bi_ambiguous_abs(ins); can_fma &= !bi_icmp(ins); diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c index 7169df85108..20a047ec4b5 100644 --- a/src/panfrost/bifrost/disassemble.c +++ b/src/panfrost/bifrost/disassemble.c @@ -342,8 +342,7 @@ static uint64_t get_const(uint64_t *consts, struct bifrost_regs srcs) imm = consts[5]; break; default: - assert(0); - break; + unreachable("bad imm"); } return imm | low_bits; } diff --git a/src/panfrost/lib/gen_pack.py b/src/panfrost/lib/gen_pack.py index 3fdef5c981e..cf3e0feee22 100644 --- a/src/panfrost/lib/gen_pack.py +++ b/src/panfrost/lib/gen_pack.py @@ -68,9 +68,8 @@ __gen_uint(uint64_t v, uint32_t start, uint32_t end) static inline uint32_t __gen_sint(int32_t v, uint32_t start, uint32_t end) { - const int width = end - start + 1; - #ifndef NDEBUG + const int width = end - start + 1; if (width < 64) { const int64_t max = (1ll << (width - 1)) - 1; const int64_t min = -(1ll << (width - 1)); diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 2ffdee3f162..7ab8cd46c1c 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -858,8 +858,8 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr) /* Should we swap arguments? */ bool flip_src12 = false; - unsigned src_bitsize = nir_src_bit_size(instr->src[0].src); - unsigned dst_bitsize = nir_dest_bit_size(*dest); + ASSERTED unsigned src_bitsize = nir_src_bit_size(instr->src[0].src); + ASSERTED unsigned dst_bitsize = nir_dest_bit_size(*dest); enum midgard_roundmode roundmode = MIDGARD_RTE; @@ -1836,7 +1836,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) else if (combined) rt = MIDGARD_ZS_RT; else - assert(0); + unreachable("bad rt"); unsigned reg_z = ~0, reg_s = ~0; if (combined) { diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c index 77f2e3b7bf2..2ad48c8ea74 100644 --- a/src/panfrost/midgard/midgard_emit.c +++ b/src/panfrost/midgard/midgard_emit.c @@ -240,7 +240,7 @@ mir_pack_swizzle(unsigned mask, unsigned *swizzle, for (unsigned c = (dest_up ? 4 : 0); c < (dest_up ? 8 : 4); ++c) { unsigned v = swizzle[c]; - bool t_upper = v > 3; + ASSERTED bool t_upper = v > 3; /* Ensure we're doing something sane */ @@ -419,7 +419,7 @@ mir_pack_ldst_mask(midgard_instruction *ins) for (unsigned i = 0; i < 4; ++i) { /* Make sure we're duplicated */ bool u = (ins->mask & (1 << (2*i + 0))) != 0; - bool v = (ins->mask & (1 << (2*i + 1))) != 0; + ASSERTED bool v = (ins->mask & (1 << (2*i + 1))) != 0; assert(u == v); packed |= (u << i); diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c index bb95d385429..c2b5c0701ac 100644 --- a/src/panfrost/midgard/midgard_ra.c +++ b/src/panfrost/midgard/midgard_ra.c @@ -116,7 +116,7 @@ set_class(unsigned *classes, unsigned node, unsigned class) /* Special register classes impose special constraints on who can read their * values, so check that */ -static bool +static bool ASSERTED check_read_class(unsigned *classes, unsigned tag, unsigned node) { /* Non-nodes are implicitly ok */ @@ -137,7 +137,7 @@ check_read_class(unsigned *classes, unsigned tag, unsigned node) } } -static bool +static bool ASSERTED check_write_class(unsigned *classes, unsigned tag, unsigned node) { /* Non-nodes are implicitly ok */ -- 2.30.2