diff options
author | Vadim Girlin <[email protected]> | 2013-05-02 10:36:18 +0400 |
---|---|---|
committer | Vadim Girlin <[email protected]> | 2013-05-03 16:53:42 +0400 |
commit | 48ba5712f579717a702b6768efde301b5dfc867a (patch) | |
tree | 532477aeb8807eefc7dec006f943f203d7a2f81b /src/gallium/drivers/r600 | |
parent | c49b6d7f27319c423ab06ab62be46ee9628f5986 (diff) |
r600g/sb: silence warnings with gcc 4.8
Signed-off-by: Vadim Girlin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_ra_init.cpp | 25 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_sched.cpp | 4 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_ra_init.cpp b/src/gallium/drivers/r600/sb/sb_ra_init.cpp index 99ff6ff3ff5..03b8efde4c1 100644 --- a/src/gallium/drivers/r600/sb/sb_ra_init.cpp +++ b/src/gallium/drivers/r600/sb/sb_ra_init.cpp @@ -75,7 +75,7 @@ public: void set(unsigned index, unsigned val); - sel_chan find_free_bit(unsigned start); + sel_chan find_free_bit(); sel_chan find_free_chans(unsigned mask); sel_chan find_free_array(unsigned size, unsigned mask); @@ -148,24 +148,21 @@ void regbits::set(unsigned index, unsigned val) { } // free register for ra means the bit is set -sel_chan regbits::find_free_bit(unsigned start) { - unsigned elt = start >> bt_index_shift; - unsigned bit = start & bt_index_mask; - - unsigned end = start < MAX_GPR - num_temps ? MAX_GPR - num_temps : MAX_GPR; +sel_chan regbits::find_free_bit() { + unsigned elt = 0; + unsigned bit = 0; - while (elt < end && !dta[elt]) { + while (elt < size && !dta[elt]) ++elt; - bit = 0; - } - if (elt >= end) + if (elt >= size) return 0; - // FIXME this seems broken when not starting from 0 + bit = __builtin_ctz(dta[elt]) + (elt << bt_index_shift); + + assert(bit < MAX_GPR - num_temps); - bit += __builtin_ctz(dta[elt]); - return ((elt << bt_index_shift) | bit) + 1; + return bit + 1; } // find free gpr component to use as indirectly addressable array @@ -482,7 +479,7 @@ void ra_init::color(value* v) { unsigned mask = 1 << v->pin_gpr.chan(); c = rb.find_free_chans(mask) + v->pin_gpr.chan(); } else { - c = rb.find_free_bit(0); + c = rb.find_free_bit(); } assert(c && c.sel() < 128 - ctx.alu_temp_gprs && "color failed"); diff --git a/src/gallium/drivers/r600/sb/sb_sched.cpp b/src/gallium/drivers/r600/sb/sb_sched.cpp index d7c17952a4a..b21b342578d 100644 --- a/src/gallium/drivers/r600/sb/sb_sched.cpp +++ b/src/gallium/drivers/r600/sb/sb_sched.cpp @@ -542,6 +542,10 @@ bool alu_group_tracker::try_reserve(alu_node* n) { assert(first_slot != ~0 && last_slot != ~0); + // silence "array subscript is above array bounds" with gcc 4.8 + if (last_slot >= 5) + abort(); + int i = first_nf; alu_node *a = slots[i]; bool backtrack = false; |