i965/vec4: Get rid of the type parameter from to/from_double
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 8 Mar 2017 02:32:17 +0000 (18:32 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 14 Mar 2017 14:36:40 +0000 (07:36 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/compiler/brw_vec4.h
src/intel/compiler/brw_vec4_nir.cpp

index a84048d8c6a7c6a874b90d488740218d4db0166a..d12405c22e1c7bc7a2fce5815a9db526cb737d88 100644 (file)
@@ -321,10 +321,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);
 
index 4e88b795049568452a5099f84f09ba84ca5f8d38..ca2e5dd05eb12d70800b2172b97bcfc6e0ca214c 100644 (file)
@@ -1170,14 +1170,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;
@@ -1188,7 +1187,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;
 
@@ -1198,12 +1197,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;
@@ -1301,27 +1299,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:
@@ -1968,8 +1960,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;