i965: Replace struct brw_compact_instruction with brw_compact_inst.
authorMatt Turner <mattst88@gmail.com>
Fri, 13 Jun 2014 23:16:28 +0000 (16:16 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 26 Jun 2014 18:46:17 +0000 (11:46 -0700)
Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_eu.c
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_compact.c
src/mesa/drivers/dri/i965/brw_inst.h
src/mesa/drivers/dri/i965/brw_structs.h
src/mesa/drivers/dri/i965/test_eu_compact.c

index 5a92cd72e435e8fff3c8ba98fe5d4210593be44a..7894d64ffbca6cbf25f0cf66ac8e29131dd9561f 100644 (file)
@@ -246,7 +246,7 @@ brw_disassemble(struct brw_context *brw,
       fprintf(out, "0x%08x: ", offset);
 
       if (compacted) {
-        struct brw_compact_instruction *compacted = (void *)insn;
+         brw_compact_inst *compacted = (void *)insn;
         if (dump_hex) {
            fprintf(out, "0x%08x 0x%08x                       ",
                    ((uint32_t *)insn)[1],
index 23a23896cc26fae77afb3e95cdc817aee4e7627e..e06d832933ee77d662fdb12c208c4cedb0af5355 100644 (file)
@@ -411,9 +411,8 @@ void brw_init_compaction_tables(struct brw_context *brw);
 void brw_compact_instructions(struct brw_compile *p, int start_offset,
                               int num_annotations, struct annotation *annotation);
 void brw_uncompact_instruction(struct brw_context *brw, brw_inst *dst,
-                              struct brw_compact_instruction *src);
-bool brw_try_compact_instruction(struct brw_compile *p,
-                                 struct brw_compact_instruction *dst,
+                               brw_compact_inst *src);
+bool brw_try_compact_instruction(struct brw_compile *p, brw_compact_inst *dst,
                                  brw_inst *src);
 
 void brw_debug_compact_uncompact(struct brw_context *brw, brw_inst *orig,
index 9b7ac9f3868c3b61816ffd737b83b31eb6ae3622..69621dd4e5eeeb92f28f4c759b759f1b91bf30c1 100644 (file)
@@ -327,9 +327,7 @@ static const uint16_t *subreg_table;
 static const uint16_t *src_index_table;
 
 static bool
-set_control_index(struct brw_context *brw,
-                  struct brw_compact_instruction *dst,
-                  brw_inst *src)
+set_control_index(struct brw_context *brw, brw_compact_inst *dst, brw_inst *src)
 {
    uint32_t uncompacted =                  /* 17b/SNB; 19b/IVB+ */
       (brw_inst_bits(src, 31, 31) << 16) | /* 1b */
@@ -352,8 +350,7 @@ set_control_index(struct brw_context *brw,
 }
 
 static bool
-set_datatype_index(struct brw_context *brw,
-                   struct brw_compact_instruction *dst,
+set_datatype_index(struct brw_context *brw, brw_compact_inst *dst,
                    brw_inst *src)
 {
    uint32_t uncompacted =                  /* 18b */
@@ -371,9 +368,8 @@ set_datatype_index(struct brw_context *brw,
 }
 
 static bool
-set_subreg_index(struct brw_context *brw,
-                 struct brw_compact_instruction *dst,
-                 brw_inst *src, bool is_immediate)
+set_subreg_index(struct brw_context *brw, brw_compact_inst *dst, brw_inst *src,
+                 bool is_immediate)
 {
    uint16_t uncompacted =                 /* 15b */
       (brw_inst_bits(src, 52, 48) << 0) | /*  5b */
@@ -407,9 +403,7 @@ get_src_index(uint16_t uncompacted,
 }
 
 static bool
-set_src0_index(struct brw_context *brw,
-               struct brw_compact_instruction *dst,
-               brw_inst *src)
+set_src0_index(struct brw_context *brw, brw_compact_inst *dst, brw_inst *src)
 {
    uint16_t compacted;
    uint16_t uncompacted = brw_inst_bits(src, 88, 77); /* 12b */
@@ -423,9 +417,8 @@ set_src0_index(struct brw_context *brw,
 }
 
 static bool
-set_src1_index(struct brw_context *brw,
-               struct brw_compact_instruction *dst,
-               brw_inst *src, bool is_immediate)
+set_src1_index(struct brw_context *brw, brw_compact_inst *dst, brw_inst *src,
+               bool is_immediate)
 {
    uint16_t compacted;
 
@@ -466,12 +459,11 @@ is_compactable_immediate(unsigned imm)
  * brw_compact_instructions().
  */
 bool
-brw_try_compact_instruction(struct brw_compile *p,
-                            struct brw_compact_instruction *dst,
+brw_try_compact_instruction(struct brw_compile *p, brw_compact_inst *dst,
                             brw_inst *src)
 {
    struct brw_context *brw = p->brw;
-   struct brw_compact_instruction temp;
+   brw_compact_inst temp;
 
    if (brw_inst_opcode(brw, src) == BRW_OPCODE_IF ||
        brw_inst_opcode(brw, src) == BRW_OPCODE_ELSE ||
@@ -529,7 +521,7 @@ brw_try_compact_instruction(struct brw_compile *p,
 
 static void
 set_uncompacted_control(struct brw_context *brw, brw_inst *dst,
-                        struct brw_compact_instruction *src)
+                        brw_compact_inst *src)
 {
    uint32_t uncompacted =
       control_index_table[brw_compact_inst_control_index(src)];
@@ -543,7 +535,7 @@ set_uncompacted_control(struct brw_context *brw, brw_inst *dst,
 
 static void
 set_uncompacted_datatype(struct brw_context *brw, brw_inst *dst,
-                         struct brw_compact_instruction *src)
+                         brw_compact_inst *src)
 {
    uint32_t uncompacted = datatype_table[brw_compact_inst_datatype_index(src)];
 
@@ -553,7 +545,7 @@ set_uncompacted_datatype(struct brw_context *brw, brw_inst *dst,
 
 static void
 set_uncompacted_subreg(struct brw_context *brw, brw_inst *dst,
-                       struct brw_compact_instruction *src)
+                       brw_compact_inst *src)
 {
    uint16_t uncompacted = subreg_table[brw_compact_inst_subreg_index(src)];
 
@@ -564,7 +556,7 @@ set_uncompacted_subreg(struct brw_context *brw, brw_inst *dst,
 
 static void
 set_uncompacted_src0(struct brw_context *brw, brw_inst *dst,
-                     struct brw_compact_instruction *src)
+                     brw_compact_inst *src)
 {
    uint32_t compacted = brw_compact_inst_src0_index(src);
    uint16_t uncompacted = src_index_table[compacted];
@@ -574,7 +566,7 @@ set_uncompacted_src0(struct brw_context *brw, brw_inst *dst,
 
 static void
 set_uncompacted_src1(struct brw_context *brw, brw_inst *dst,
-                     struct brw_compact_instruction *src, bool is_immediate)
+                     brw_compact_inst *src, bool is_immediate)
 {
    if (is_immediate) {
       signed high5 = brw_compact_inst_src1_index(src);
@@ -589,7 +581,7 @@ set_uncompacted_src1(struct brw_context *brw, brw_inst *dst,
 
 void
 brw_uncompact_instruction(struct brw_context *brw, brw_inst *dst,
-                          struct brw_compact_instruction *src)
+                          brw_compact_inst *src)
 {
    memset(dst, 0, sizeof(*dst));
 
@@ -755,7 +747,7 @@ brw_compact_instructions(struct brw_compile *p, int start_offset,
               brw_inst_opcode(brw, src) == BRW_OPCODE_SENDC) &&
              brw_inst_eot(brw, src) &&
              (offset & 8) != 0) {
-            struct brw_compact_instruction *align = store + offset;
+            brw_compact_inst *align = store + offset;
             memset(align, 0, sizeof(*align));
             brw_compact_inst_set_opcode(align, BRW_OPCODE_NOP);
             brw_compact_inst_set_cmpt_control(align, true);
@@ -815,7 +807,7 @@ brw_compact_instructions(struct brw_compile *p, int start_offset,
     * compile passes) parses correctly.
     */
    if (p->next_insn_offset & 8) {
-      struct brw_compact_instruction *align = store + offset;
+      brw_compact_inst *align = store + offset;
       memset(align, 0, sizeof(*align));
       brw_compact_inst_set_opcode(align, BRW_OPCODE_NOP);
       brw_compact_inst_set_cmpt_control(align, true);
index 7c0cfaaed4fe070770aad0cc95d16359c22c3c9b..ac00fd4ee1fb682a927e43f5cad1af0569953dda 100644 (file)
@@ -728,16 +728,14 @@ brw_compact_inst_set_bits(brw_compact_inst *inst, unsigned high, unsigned low,
 
 #define F(name, high, low)                                      \
 static inline void                                              \
-brw_compact_inst_set_##name(struct brw_compact_instruction *insn, unsigned v) \
+brw_compact_inst_set_##name(brw_compact_inst *inst, unsigned v) \
 {                                                               \
-   brw_compact_inst *inst = (brw_compact_inst *)insn;           \
    brw_compact_inst_set_bits(inst, high, low, v);               \
 }                                                               \
                                                                 \
 static inline unsigned                                          \
-brw_compact_inst_##name(struct brw_compact_instruction *insn)   \
+brw_compact_inst_##name(brw_compact_inst *inst)                 \
 {                                                               \
-   brw_compact_inst *inst = (brw_compact_inst *)insn;           \
    return brw_compact_inst_bits(inst, high, low);               \
 }
 
index 586c2e61a9e6d67ab90294af06a4379644f97857..620962e27f6572df49b70c429308bce564269185 100644 (file)
@@ -766,30 +766,4 @@ struct gen7_sf_clip_viewport {
    float pad1[4];
 };
 
-/* Instruction format for the execution units:
- */
-
-struct brw_compact_instruction {
-   struct {
-      unsigned opcode:7;          /*  0- 6 */
-      unsigned debug_control:1;   /*  7- 7 */
-      unsigned control_index:5;   /*  8-12 */
-      unsigned data_type_index:5; /* 13-17 */
-      unsigned sub_reg_index:5;   /* 18-22 */
-      unsigned acc_wr_control:1;  /* 23-23 */
-      unsigned conditionalmod:4;  /* 24-27 */
-      unsigned flag_subreg_nr:1;     /* 28-28 */
-      unsigned cmpt_ctrl:1;       /* 29-29 */
-      unsigned src0_index:2;      /* 30-31 */
-   } dw0;
-
-   struct {
-      unsigned src0_index:3;  /* 32-24 */
-      unsigned src1_index:5;  /* 35-39 */
-      unsigned dst_reg_nr:8;  /* 40-47 */
-      unsigned src0_reg_nr:8; /* 48-55 */
-      unsigned src1_reg_nr:8; /* 56-63 */
-   } dw1;
-};
-
 #endif
index 046a3351c0e0136f9e21ec5aacea70e430971693..b7737c758e6acb4318819d550668dabb6095be95 100644 (file)
@@ -33,7 +33,7 @@ test_compact_instruction(struct brw_compile *p, brw_inst src)
 {
    struct brw_context *brw = p->brw;
 
-   struct brw_compact_instruction dst;
+   brw_compact_inst dst;
    memset(&dst, 0xd0, sizeof(dst));
 
    if (brw_try_compact_instruction(p, &dst, &src)) {
@@ -45,7 +45,7 @@ test_compact_instruction(struct brw_compile *p, brw_inst src)
         return false;
       }
    } else {
-      struct brw_compact_instruction unchanged;
+      brw_compact_inst unchanged;
       memset(&unchanged, 0xd0, sizeof(unchanged));
       /* It's not supposed to change dst unless it compacted. */
       if (memcmp(&unchanged, &dst, sizeof(dst))) {