intel/eu/gen12: Add sanity-check asserts to brw_inst_bits() and brw_inst_set_bits().
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 9 Nov 2018 22:13:35 +0000 (14:13 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 11 Oct 2019 19:24:16 +0000 (12:24 -0700)
These caught a few bugs during the development of this series.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_inst.h

index 624cbe020ca370af8459b7f4ab007557862f962b..5a1e5cfba725bfe8f56fdb3f1c9f719db6ba4f95 100644 (file)
@@ -1161,6 +1161,7 @@ BRW_IA16_ADDR_IMM(send_dst,    -1, -1,  62,  56,  52)
 static inline uint64_t
 brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low)
 {
+   assert(high >= low);
    /* We assume the field doesn't cross 64-bit boundaries. */
    const unsigned word = high / 64;
    assert(word == low / 64);
@@ -1181,6 +1182,7 @@ brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low)
 static inline void
 brw_inst_set_bits(brw_inst *inst, unsigned high, unsigned low, uint64_t value)
 {
+   assert(high >= low);
    const unsigned word = high / 64;
    assert(word == low / 64);