intel/compiler: Rearrange code to avoid future problems
authorMatt Turner <mattst88@gmail.com>
Wed, 12 Dec 2018 06:04:42 +0000 (22:04 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 10 Jan 2019 00:42:41 +0000 (16:42 -0800)
A follow on commit will move nr to the same union as the immediate
data, so we should assert these invariants before we overwrite the nr
field.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs_combine_constants.cpp

index e0c95d379b88a45044271ecc300bddf73e50a79e..7343f77bb45874c8efb621200dd6571918d23837 100644 (file)
@@ -294,13 +294,14 @@ fs_visitor::opt_combine_constants()
    for (int i = 0; i < table.len; i++) {
       foreach_list_typed(reg_link, link, link, table.imm[i].uses) {
          fs_reg *reg = link->reg;
+         assert((isnan(reg->f) && isnan(table.imm[i].val)) ||
+                fabsf(reg->f) == fabs(table.imm[i].val));
+
          reg->file = VGRF;
-         reg->nr = table.imm[i].nr;
          reg->offset = table.imm[i].subreg_offset;
          reg->stride = 0;
          reg->negate = signbit(reg->f) != signbit(table.imm[i].val);
-         assert((isnan(reg->f) && isnan(table.imm[i].val)) ||
-                fabsf(reg->f) == fabs(table.imm[i].val));
+         reg->nr = table.imm[i].nr;
       }
    }