i965: Switch to using the logical register types
authorMatt Turner <mattst88@gmail.com>
Thu, 27 Jul 2017 00:59:10 +0000 (17:59 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 21 Aug 2017 21:05:23 +0000 (14:05 -0700)
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
src/intel/compiler/brw_eu_compact.c
src/intel/compiler/brw_eu_emit.c

index 743ee9519c19631d26ad6faa2617e01651c794a4..7674aa8b855ddb53f9c240ab0cd85e46ddebf5e5 100644 (file)
@@ -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;
index 064e4a03876afd7ee2357519fe75343e95288d03..8c952e7da265c3bf2963871e0d56ac1a534ea163 100644 (file)
@@ -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);