diff options
author | Jason Ekstrand <[email protected]> | 2014-12-15 17:32:56 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:20:22 -0800 |
commit | 2c7da78805175f36879111306ac37c12d33bf65b (patch) | |
tree | 5fbfa3578dae242c5fa29cf46c647af351fda881 /src/mesa/drivers/dri | |
parent | 675ffdef3010400567a5f6f790f1f7bd2fede717 (diff) |
nir: Make load_const SSA-only
As it was, we weren't ever using load_const in a non-SSA way. This allows
us to substantially simplify the load_const instruction. If we ever need a
non-SSA constant load, we can do a load_const and an imov.
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 28 |
2 files changed, 3 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index e589c9646b5..ad3d9866d53 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -583,7 +583,6 @@ public: void nir_emit_alu(nir_alu_instr *instr); void nir_emit_intrinsic(nir_intrinsic_instr *instr); void nir_emit_texture(nir_tex_instr *instr); - void nir_emit_load_const(nir_load_const_instr *instr); void nir_emit_jump(nir_jump_instr *instr); fs_reg get_nir_src(nir_src src); fs_reg get_nir_alu_src(nir_alu_instr *instr, unsigned src); diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index c218b722f8d..4c08cfdb6ad 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -392,7 +392,9 @@ fs_visitor::nir_emit_instr(nir_instr *instr) break; case nir_instr_type_load_const: - nir_emit_load_const(nir_instr_as_load_const(instr)); + /* We can hit these, but we do nothing now and use them as + * immediates later. + */ break; case nir_instr_type_jump: @@ -1702,30 +1704,6 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr) } void -fs_visitor::nir_emit_load_const(nir_load_const_instr *instr) -{ - /* Bail on SSA constant loads. These are used for immediates. */ - if (instr->dest.is_ssa) - return; - - fs_reg dest = get_nir_dest(instr->dest); - dest.type = BRW_REGISTER_TYPE_UD; - if (instr->array_elems == 0) { - for (unsigned i = 0; i < instr->num_components; i++) { - emit(MOV(dest, fs_reg(instr->value.u[i]))); - dest.reg_offset++; - } - } else { - for (unsigned i = 0; i < instr->array_elems; i++) { - for (unsigned j = 0; j < instr->num_components; j++) { - emit(MOV(dest, fs_reg(instr->array[i].u[j]))); - dest.reg_offset++; - } - } - } -} - -void fs_visitor::nir_emit_jump(nir_jump_instr *instr) { switch (instr->type) { |