i965: Reverse file/type arguments to register type functions
authorMatt Turner <mattst88@gmail.com>
Thu, 27 Jul 2017 00:03:12 +0000 (17:03 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 21 Aug 2017 21:05:23 +0000 (14:05 -0700)
I think of the initial arguments as "state" and the last as the actual
subject.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
src/intel/compiler/brw_disasm.c
src/intel/compiler/brw_eu_emit.c
src/intel/compiler/brw_eu_validate.c
src/intel/compiler/brw_reg.h

index 6da70605174790069dce48169509cb81e2be3eca..aafea693fc6edcbe30779047337804dc598bf503 100644 (file)
@@ -839,7 +839,7 @@ src_da1(FILE *file,
    if (err == -1)
       return 0;
    if (sub_reg_num) {
-      unsigned elem_size = brw_hw_reg_type_to_size(devinfo, type, _reg_file);
+      unsigned elem_size = brw_hw_reg_type_to_size(devinfo, _reg_file, type);
       format(file, ".%d", sub_reg_num / elem_size);   /* use formal style like spec */
    }
    src_align1_region(file, _vert_stride, _width, _horiz_stride);
@@ -928,7 +928,7 @@ src_da16(FILE *file,
       return 0;
    if (_subreg_nr) {
       unsigned elem_size =
-         brw_hw_reg_type_to_size(devinfo, _reg_type, _reg_file);
+         brw_hw_reg_type_to_size(devinfo, _reg_file, _reg_type);
 
       /* bit4 for subreg number byte addressing. Make this same meaning as
          in da1 case, so output looks consistent. */
index 69ebf6345c34e819d512aaedf977f9a9acf7a17e..12e9d332a1f1eb5c3f8b9995ccc1d493777384cf 100644 (file)
@@ -91,7 +91,8 @@ gen7_convert_mrf_to_grf(struct brw_codegen *p, struct brw_reg *reg)
  */
 unsigned
 brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
-                        enum brw_reg_type type, enum brw_reg_file file)
+                        enum brw_reg_file file,
+                        enum brw_reg_type type)
 {
    if (file == BRW_IMMEDIATE_VALUE) {
       static const enum hw_imm_type hw_types[] = {
@@ -141,7 +142,8 @@ brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
  */
 unsigned
 brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
-                        unsigned type, enum brw_reg_file file)
+                        enum brw_reg_file file,
+                        unsigned type)
 {
    if (file == BRW_IMMEDIATE_VALUE) {
       static const int hw_sizes[] = {
@@ -198,8 +200,8 @@ brw_set_dest(struct brw_codegen *p, brw_inst *inst, struct brw_reg dest)
 
    brw_inst_set_dst_reg_file(devinfo, inst, dest.file);
    brw_inst_set_dst_reg_type(devinfo, inst,
-                             brw_reg_type_to_hw_type(devinfo, dest.type,
-                                                     dest.file));
+                             brw_reg_type_to_hw_type(devinfo, dest.file,
+                                                     dest.type));
    brw_inst_set_dst_address_mode(devinfo, inst, dest.address_mode);
 
    if (dest.address_mode == BRW_ADDRESS_DIRECT) {
@@ -365,7 +367,7 @@ brw_set_src0(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    brw_inst_set_src0_reg_file(devinfo, inst, reg.file);
    brw_inst_set_src0_reg_type(devinfo, inst,
-                              brw_reg_type_to_hw_type(devinfo, reg.type, reg.file));
+                              brw_reg_type_to_hw_type(devinfo, 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);
@@ -472,7 +474,7 @@ brw_set_src1(struct brw_codegen *p, brw_inst *inst, struct brw_reg reg)
 
    brw_inst_set_src1_reg_file(devinfo, inst, reg.file);
    brw_inst_set_src1_reg_type(devinfo, inst,
-                              brw_reg_type_to_hw_type(devinfo, reg.type, reg.file));
+                              brw_reg_type_to_hw_type(devinfo, reg.file, reg.type));
    brw_inst_set_src1_abs(devinfo, inst, reg.abs);
    brw_inst_set_src1_negate(devinfo, inst, reg.negate);
 
index 54e0a2e62ec9f862c9ab738e91a9f999c7e70054..cacf962904fafcb9b548946c51253551b66bea7d 100644 (file)
@@ -459,7 +459,7 @@ general_restrictions_based_on_operand_types(const struct gen_device_info *devinf
 
    unsigned exec_type = execution_type(devinfo, inst);
    unsigned exec_type_size =
-      brw_hw_reg_type_to_size(devinfo, exec_type, BRW_GENERAL_REGISTER_FILE);
+      brw_hw_reg_type_to_size(devinfo, BRW_GENERAL_REGISTER_FILE, exec_type);
    unsigned dst_type_size = brw_element_size(devinfo, inst, dst);
 
    /* On IVB/BYT, region parameters and execution size for DF are in terms of
index c2c3aae4d0097a19588bdf4e085474b0199e83fc..4e59d75dc2132ac9f10e6c8f9a27f1bb55e34c81 100644 (file)
@@ -231,14 +231,14 @@ enum PACKED brw_reg_type {
 };
 
 unsigned brw_reg_type_to_hw_type(const struct gen_device_info *devinfo,
-                                 enum brw_reg_type type, enum brw_reg_file file);
+                                 enum brw_reg_file file, enum brw_reg_type type);
 
 #define brw_element_size(devinfo, inst, operand)                             \
    brw_hw_reg_type_to_size(devinfo,                                          \
-                           brw_inst_ ## operand ## _reg_type(devinfo, inst), \
-                           brw_inst_ ## operand ## _reg_file(devinfo, inst))
+                           brw_inst_ ## operand ## _reg_file(devinfo, inst), \
+                           brw_inst_ ## operand ## _reg_type(devinfo, inst))
 unsigned brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
-                                 unsigned type, enum brw_reg_file file);
+                                 enum brw_reg_file file, unsigned type);
 
 const char *brw_reg_type_letters(unsigned brw_reg_type);
 uint32_t brw_swizzle_immediate(enum brw_reg_type type, uint32_t x, unsigned swz);