On Wed, Mar 08, 2017 at 02:51:29PM -0800, Jason Ekstrand wrote: > --- > src/mesa/drivers/dri/i965/brw_vec4.h | 6 ++---- > src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 33 > ++++++++++++------------------ > 2 files changed, 15 insertions(+), 24 deletions(-)
Reviewed-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h > b/src/mesa/drivers/dri/i965/brw_vec4.h > index 29b203a..8a58512 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4.h > +++ b/src/mesa/drivers/dri/i965/brw_vec4.h > @@ -322,10 +322,8 @@ public: > > bool optimize_predicate(nir_alu_instr *instr, enum brw_predicate > *predicate); > > - void emit_conversion_from_double(dst_reg dst, src_reg src, bool saturate, > - brw_reg_type single_type); > - void emit_conversion_to_double(dst_reg dst, src_reg src, bool saturate, > - brw_reg_type single_type); > + void emit_conversion_from_double(dst_reg dst, src_reg src, bool saturate); > + void emit_conversion_to_double(dst_reg dst, src_reg src, bool saturate); > > src_reg setup_imm_df(double v); > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > index a7f048a..b88bce8 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp > @@ -1171,14 +1171,13 @@ emit_find_msb_using_lzd(const vec4_builder &bld, > > void > vec4_visitor::emit_conversion_from_double(dst_reg dst, src_reg src, > - bool saturate, > - brw_reg_type single_type) > + bool saturate) > { > /* BDW PRM vol 15 - workarounds: > * DF->f format conversion for Align16 has wrong emask calculation when > * source is immediate. > */ > - if (devinfo->gen == 8 && single_type == BRW_REGISTER_TYPE_F && > + if (devinfo->gen == 8 && dst.type == BRW_REGISTER_TYPE_F && > src.file == BRW_IMMEDIATE_VALUE) { > vec4_instruction *inst = emit(MOV(dst, brw_imm_f(src.df))); > inst->saturate = saturate; > @@ -1189,7 +1188,7 @@ vec4_visitor::emit_conversion_from_double(dst_reg dst, > src_reg src, > emit(MOV(temp, src)); > > dst_reg temp2 = dst_reg(this, glsl_type::dvec4_type); > - temp2 = retype(temp2, single_type); > + temp2 = retype(temp2, dst.type); > emit(VEC4_OPCODE_FROM_DOUBLE, temp2, src_reg(temp)) > ->size_written = 2 * REG_SIZE; > > @@ -1199,12 +1198,11 @@ vec4_visitor::emit_conversion_from_double(dst_reg > dst, src_reg src, > > void > vec4_visitor::emit_conversion_to_double(dst_reg dst, src_reg src, > - bool saturate, > - brw_reg_type single_type) > + bool saturate) > { > dst_reg tmp_dst = dst_reg(src_reg(this, glsl_type::dvec4_type)); > - src_reg tmp_src = retype(src_reg(this, glsl_type::vec4_type), > single_type); > - emit(MOV(dst_reg(tmp_src), retype(src, single_type))); > + src_reg tmp_src = retype(src_reg(this, glsl_type::vec4_type), src.type); > + emit(MOV(dst_reg(tmp_src), src)); > emit(VEC4_OPCODE_TO_DOUBLE, tmp_dst, tmp_src); > vec4_instruction *inst = emit(MOV(dst, src_reg(tmp_dst))); > inst->saturate = saturate; > @@ -1302,27 +1300,21 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) > break; > > case nir_op_d2f: > - emit_conversion_from_double(dst, op[0], instr->dest.saturate, > - BRW_REGISTER_TYPE_F); > + emit_conversion_from_double(dst, op[0], instr->dest.saturate); > break; > > case nir_op_f2d: > - emit_conversion_to_double(dst, op[0], instr->dest.saturate, > - BRW_REGISTER_TYPE_F); > + emit_conversion_to_double(dst, op[0], instr->dest.saturate); > break; > > case nir_op_d2i: > case nir_op_d2u: > - emit_conversion_from_double(dst, op[0], instr->dest.saturate, > - instr->op == nir_op_d2i ? > BRW_REGISTER_TYPE_D : > - > BRW_REGISTER_TYPE_UD); > + emit_conversion_from_double(dst, op[0], instr->dest.saturate); > break; > > case nir_op_i2d: > case nir_op_u2d: > - emit_conversion_to_double(dst, op[0], instr->dest.saturate, > - instr->op == nir_op_i2d ? > BRW_REGISTER_TYPE_D : > - > BRW_REGISTER_TYPE_UD); > + emit_conversion_to_double(dst, op[0], instr->dest.saturate); > break; > > case nir_op_iadd: > @@ -1969,8 +1961,9 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) > inst->predicate = BRW_PREDICATE_NORMAL; > > /* Now convert the result from float to double */ > - emit_conversion_to_double(dst, src_reg(tmp), instr->dest.saturate, > - BRW_REGISTER_TYPE_F); > + emit_conversion_to_double(dst, retype(src_reg(tmp), > + BRW_REGISTER_TYPE_F), > + instr->dest.saturate); > } > break; > > -- > 2.5.0.400.gff86faf > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev