[Mesa-dev] [PATCH 19/23] intel/eu: Fix up various type conversions in brw_eu.c that are illegal C++.

Francisco Jerez currojerez at riseup.net
Tue Jun 12 02:26:11 UTC 2018


---
 src/intel/compiler/brw_eu.c               | 12 ++++++------
 src/intel/compiler/brw_eu.h               |  6 +++---
 src/intel/compiler/brw_vec4_generator.cpp |  2 +-
 src/intel/compiler/test_eu_compact.cpp    |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/intel/compiler/brw_eu.c b/src/intel/compiler/brw_eu.c
index 6ef0a6a577c..80f05240b42 100644
--- a/src/intel/compiler/brw_eu.c
+++ b/src/intel/compiler/brw_eu.c
@@ -39,7 +39,7 @@
 
 /* Returns a conditional modifier that negates the condition. */
 enum brw_conditional_mod
-brw_negate_cmod(uint32_t cmod)
+brw_negate_cmod(enum brw_conditional_mod cmod)
 {
    switch (cmod) {
    case BRW_CONDITIONAL_Z:
@@ -55,7 +55,7 @@ brw_negate_cmod(uint32_t cmod)
    case BRW_CONDITIONAL_LE:
       return BRW_CONDITIONAL_G;
    default:
-      return ~0;
+      unreachable("Can't negate this cmod");
    }
 }
 
@@ -63,7 +63,7 @@ brw_negate_cmod(uint32_t cmod)
  * src1 in e.g. CMP.
  */
 enum brw_conditional_mod
-brw_swap_cmod(uint32_t cmod)
+brw_swap_cmod(enum brw_conditional_mod cmod)
 {
    switch (cmod) {
    case BRW_CONDITIONAL_Z:
@@ -150,7 +150,7 @@ brw_set_default_exec_size(struct brw_codegen *p, unsigned value)
    p->current->exec_size = value;
 }
 
-void brw_set_default_predicate_control( struct brw_codegen *p, unsigned pc )
+void brw_set_default_predicate_control(struct brw_codegen *p, enum brw_predicate pc)
 {
    p->current->predicate = pc;
 }
@@ -356,14 +356,14 @@ brw_disassemble(const struct gen_device_info *devinfo,
    bool dump_hex = (INTEL_DEBUG & DEBUG_HEX) != 0;
 
    for (int offset = start; offset < end;) {
-      const brw_inst *insn = assembly + offset;
+      const brw_inst *insn = (const brw_inst *)((char *)assembly + offset);
       brw_inst uncompacted;
       bool compacted = brw_inst_cmpt_control(devinfo, insn);
       if (0)
          fprintf(out, "0x%08x: ", offset);
 
       if (compacted) {
-         brw_compact_inst *compacted = (void *)insn;
+         brw_compact_inst *compacted = (brw_compact_inst *)insn;
 	 if (dump_hex) {
 	    fprintf(out, "0x%08x 0x%08x                       ",
 		    ((uint32_t *)insn)[1],
diff --git a/src/intel/compiler/brw_eu.h b/src/intel/compiler/brw_eu.h
index 7ffd3c30665..0fc32ef0750 100644
--- a/src/intel/compiler/brw_eu.h
+++ b/src/intel/compiler/brw_eu.h
@@ -150,7 +150,7 @@ void brw_inst_set_group(const struct gen_device_info *devinfo,
                         brw_inst *inst, unsigned group);
 void brw_set_default_group(struct brw_codegen *p, unsigned group);
 void brw_set_default_compression_control(struct brw_codegen *p, enum brw_compression c);
-void brw_set_default_predicate_control( struct brw_codegen *p, unsigned pc );
+void brw_set_default_predicate_control(struct brw_codegen *p, enum brw_predicate pc);
 void brw_set_default_predicate_inverse(struct brw_codegen *p, bool predicate_inverse);
 void brw_set_default_flag_reg(struct brw_codegen *p, int reg, int subreg);
 void brw_set_default_acc_write_control(struct brw_codegen *p, unsigned value);
@@ -686,8 +686,8 @@ brw_set_desc(struct brw_codegen *p, brw_inst *insn, unsigned desc)
 
 void brw_set_uip_jip(struct brw_codegen *p, int start_offset);
 
-enum brw_conditional_mod brw_negate_cmod(uint32_t cmod);
-enum brw_conditional_mod brw_swap_cmod(uint32_t cmod);
+enum brw_conditional_mod brw_negate_cmod(enum brw_conditional_mod cmod);
+enum brw_conditional_mod brw_swap_cmod(enum brw_conditional_mod cmod);
 
 /* brw_eu_compact.c */
 void brw_init_compaction_tables(const struct gen_device_info *devinfo);
diff --git a/src/intel/compiler/brw_vec4_generator.cpp b/src/intel/compiler/brw_vec4_generator.cpp
index d506b675776..8e08391fd5f 100644
--- a/src/intel/compiler/brw_vec4_generator.cpp
+++ b/src/intel/compiler/brw_vec4_generator.cpp
@@ -1192,7 +1192,7 @@ generate_scratch_write(struct brw_codegen *p,
    /* If the instruction is predicated, we'll predicate the send, not
     * the header setup.
     */
-   brw_set_default_predicate_control(p, false);
+   brw_set_default_predicate_control(p, BRW_PREDICATE_NONE);
 
    gen6_resolve_implied_move(p, &header, inst->base_mrf);
 
diff --git a/src/intel/compiler/test_eu_compact.cpp b/src/intel/compiler/test_eu_compact.cpp
index f6924abd368..702762c194a 100644
--- a/src/intel/compiler/test_eu_compact.cpp
+++ b/src/intel/compiler/test_eu_compact.cpp
@@ -243,7 +243,7 @@ gen_f0_0_MOV_GRF_GRF(struct brw_codegen *p)
    struct brw_reg g2 = brw_vec8_grf(2, 0);
 
    brw_push_insn_state(p);
-   brw_set_default_predicate_control(p, true);
+   brw_set_default_predicate_control(p, BRW_PREDICATE_NORMAL);
    brw_MOV(p, g0, g2);
    brw_pop_insn_state(p);
 }
@@ -259,7 +259,7 @@ gen_f0_1_MOV_GRF_GRF(struct brw_codegen *p)
    struct brw_reg g2 = brw_vec8_grf(2, 0);
 
    brw_push_insn_state(p);
-   brw_set_default_predicate_control(p, true);
+   brw_set_default_predicate_control(p, BRW_PREDICATE_NORMAL);
    brw_inst *mov = brw_MOV(p, g0, g2);
    brw_inst_set_flag_subreg_nr(p->devinfo, mov, 1);
    brw_pop_insn_state(p);
-- 
2.16.1



More information about the mesa-dev mailing list