[Mesa-dev] [PATCH 18/22] i965/vec4: adapt setup_imm_df() to allow inserting instructions before another one
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Thu Jan 5 13:07:38 UTC 2017
Add a new setup_imm_df() that alows the insertion of the instructions
before another one. This will be used in the lowering passes for DF
instructions.
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
src/mesa/drivers/dri/i965/brw_vec4.h | 2 ++
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 21 +++++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 29b203a..01b928e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -328,6 +328,8 @@ public:
brw_reg_type single_type);
src_reg setup_imm_df(double v);
+ src_reg setup_imm_df(double v, struct bblock_t *block,
+ vec4_instruction *inst);
vec4_instruction *shuffle_64bit_data(dst_reg dst, src_reg src,
bool for_write,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
index 98e023a..d52f9fa 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
@@ -1203,6 +1203,12 @@ vec4_visitor::emit_conversion_to_double(dst_reg dst, src_reg src,
src_reg
vec4_visitor::setup_imm_df(double v)
{
+ return setup_imm_df(v, NULL, NULL);
+}
+
+src_reg
+vec4_visitor::setup_imm_df(double v, struct bblock_t *block, brw::vec4_instruction *inst)
+{
assert(devinfo->gen >= 7);
if (devinfo->gen >= 8)
@@ -1238,10 +1244,17 @@ vec4_visitor::setup_imm_df(double v)
const dst_reg tmp =
retype(dst_reg(VGRF, alloc.allocate(2)), BRW_REGISTER_TYPE_UD);
for (int n = 0; n < 2; n++) {
- emit(MOV(writemask(offset(tmp, 8, n), WRITEMASK_X), brw_imm_ud(di.i1)))
- ->force_writemask_all = true;
- emit(MOV(writemask(offset(tmp, 8, n), WRITEMASK_Y), brw_imm_ud(di.i2)))
- ->force_writemask_all = true;
+ if (block) {
+ emit_before(block, inst, MOV(writemask(offset(tmp, 8, n), WRITEMASK_X), brw_imm_ud(di.i1)))
+ ->force_writemask_all = true;
+ emit_before(block, inst, MOV(writemask(offset(tmp, 8, n), WRITEMASK_Y), brw_imm_ud(di.i2)))
+ ->force_writemask_all = true;
+ } else {
+ emit(MOV(writemask(offset(tmp, 8, n), WRITEMASK_X), brw_imm_ud(di.i1)))
+ ->force_writemask_all = true;
+ emit(MOV(writemask(offset(tmp, 8, n), WRITEMASK_Y), brw_imm_ud(di.i2)))
+ ->force_writemask_all = true;
+ }
}
return swizzle(src_reg(retype(tmp, BRW_REGISTER_TYPE_DF)), BRW_SWIZZLE_XXXX);
--
2.9.3
More information about the mesa-dev
mailing list