[Mesa-dev] [PATCH 19/25] i965: Switch to using the logical register types

Matt Turner mattst88 at gmail.com
Fri Aug 4 17:31:51 UTC 2017


---
 src/intel/compiler/brw_eu_compact.c | 27 ++++++++++++++++-----------
 src/intel/compiler/brw_eu_emit.c    | 13 +++----------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/src/intel/compiler/brw_eu_compact.c b/src/intel/compiler/brw_eu_compact.c
index 743ee9519c..7674aa8b85 100644
--- a/src/intel/compiler/brw_eu_compact.c
+++ b/src/intel/compiler/brw_eu_compact.c
@@ -995,10 +995,11 @@ precompact(const struct gen_device_info *devinfo, brw_inst inst)
        !(devinfo->is_haswell &&
          brw_inst_opcode(devinfo, &inst) == BRW_OPCODE_DIM) &&
        !(devinfo->gen >= 8 &&
-         (brw_inst_src0_reg_hw_type(devinfo, &inst) == GEN8_HW_IMM_TYPE_DF ||
-          brw_inst_src0_reg_hw_type(devinfo, &inst) == GEN8_HW_IMM_TYPE_UQ ||
-          brw_inst_src0_reg_hw_type(devinfo, &inst) == GEN8_HW_IMM_TYPE_Q))) {
-      brw_inst_set_src1_reg_hw_type(devinfo, &inst, BRW_HW_REG_TYPE_UD);
+         (brw_inst_src0_type(devinfo, &inst) == BRW_REGISTER_TYPE_DF ||
+          brw_inst_src0_type(devinfo, &inst) == BRW_REGISTER_TYPE_UQ ||
+          brw_inst_src0_type(devinfo, &inst) == BRW_REGISTER_TYPE_Q))) {
+      enum brw_reg_file file = brw_inst_src0_reg_file(devinfo, &inst);
+      brw_inst_set_src1_file_type(devinfo, &inst, file, BRW_REGISTER_TYPE_UD);
    }
 
    /* Compacted instructions only have 12-bits (plus 1 for the other 20)
@@ -1013,10 +1014,11 @@ precompact(const struct gen_device_info *devinfo, brw_inst inst)
     * If we see a 0.0:F, change the type to VF so that it can be compacted.
     */
    if (brw_inst_imm_ud(devinfo, &inst) == 0x0 &&
-       brw_inst_src0_reg_hw_type(devinfo, &inst) == BRW_HW_REG_TYPE_F &&
-       brw_inst_dst_reg_hw_type(devinfo, &inst) == BRW_HW_REG_TYPE_F &&
+       brw_inst_src0_type(devinfo, &inst) == BRW_REGISTER_TYPE_F &&
+       brw_inst_dst_type(devinfo, &inst) == BRW_REGISTER_TYPE_F &&
        brw_inst_dst_hstride(devinfo, &inst) == BRW_HORIZONTAL_STRIDE_1) {
-      brw_inst_set_src0_reg_hw_type(devinfo, &inst, BRW_HW_IMM_TYPE_VF);
+      enum brw_reg_file file = brw_inst_src0_reg_file(devinfo, &inst);
+      brw_inst_set_src0_file_type(devinfo, &inst, file, BRW_REGISTER_TYPE_VF);
    }
 
    /* There are no mappings for dst:d | i:d, so if the immediate is suitable
@@ -1024,10 +1026,13 @@ precompact(const struct gen_device_info *devinfo, brw_inst inst)
     */
    if (is_compactable_immediate(brw_inst_imm_ud(devinfo, &inst)) &&
        brw_inst_cond_modifier(devinfo, &inst) == BRW_CONDITIONAL_NONE &&
-       brw_inst_src0_reg_hw_type(devinfo, &inst) == BRW_HW_REG_TYPE_D &&
-       brw_inst_dst_reg_hw_type(devinfo, &inst) == BRW_HW_REG_TYPE_D) {
-      brw_inst_set_src0_reg_hw_type(devinfo, &inst, BRW_HW_REG_TYPE_UD);
-      brw_inst_set_dst_reg_hw_type(devinfo, &inst, BRW_HW_REG_TYPE_UD);
+       brw_inst_src0_type(devinfo, &inst) == BRW_REGISTER_TYPE_D &&
+       brw_inst_dst_type(devinfo, &inst) == BRW_REGISTER_TYPE_D) {
+      enum brw_reg_file src_file = brw_inst_src0_reg_file(devinfo, &inst);
+      enum brw_reg_file dst_file = brw_inst_dst_reg_file(devinfo, &inst);
+
+      brw_inst_set_src0_file_type(devinfo, &inst, src_file, BRW_REGISTER_TYPE_UD);
+      brw_inst_set_dst_file_type(devinfo, &inst, dst_file, BRW_REGISTER_TYPE_UD);
    }
 
    return inst;
diff --git a/src/intel/compiler/brw_eu_emit.c b/src/intel/compiler/brw_eu_emit.c
index 064e4a0387..8c952e7da2 100644
--- a/src/intel/compiler/brw_eu_emit.c
+++ b/src/intel/compiler/brw_eu_emit.c
@@ -96,10 +96,7 @@ brw_set_dest(struct brw_codegen *p, brw_inst *inst, struct brw_reg dest)
 
    gen7_convert_mrf_to_grf(p, &dest);
 
-   brw_inst_set_dst_reg_file(devinfo, inst, dest.file);
-   brw_inst_set_dst_reg_hw_type(devinfo, inst,
-                                brw_reg_type_to_hw_type(devinfo, dest.file,
-                                                        dest.type));
+   brw_inst_set_dst_file_type(devinfo, inst, dest.file, dest.type);
    brw_inst_set_dst_address_mode(devinfo, inst, dest.address_mode);
 
    if (dest.address_mode == BRW_ADDRESS_DIRECT) {
@@ -263,9 +260,7 @@ brw_set_src0(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    validate_reg(devinfo, inst, reg);
 
-   brw_inst_set_src0_reg_file(devinfo, inst, reg.file);
-   brw_inst_set_src0_reg_hw_type(devinfo, inst,
-                                 brw_reg_type_to_hw_type(devinfo, reg.file, reg.type));
+   brw_inst_set_src0_file_type(devinfo, inst, reg.file, reg.type);
    brw_inst_set_src0_abs(devinfo, inst, reg.abs);
    brw_inst_set_src0_negate(devinfo, inst, reg.negate);
    brw_inst_set_src0_address_mode(devinfo, inst, reg.address_mode);
@@ -370,9 +365,7 @@ brw_set_src1(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    validate_reg(devinfo, inst, reg);
 
-   brw_inst_set_src1_reg_file(devinfo, inst, reg.file);
-   brw_inst_set_src1_reg_hw_type(devinfo, inst,
-                                 brw_reg_type_to_hw_type(devinfo, reg.file, reg.type));
+   brw_inst_set_src1_file_type(devinfo, inst, reg.file, reg.type);
    brw_inst_set_src1_abs(devinfo, inst, reg.abs);
    brw_inst_set_src1_negate(devinfo, inst, reg.negate);
 
-- 
2.13.0



More information about the mesa-dev mailing list