[Mesa-dev] [PATCH 19/19] i965: Replace struct brw_compact_instruction with brw_compact_inst.
Matt Turner
mattst88 at gmail.com
Fri Jun 13 23:14:20 PDT 2014
---
src/mesa/drivers/dri/i965/brw_eu.c | 2 +-
src/mesa/drivers/dri/i965/brw_eu.h | 5 ++--
src/mesa/drivers/dri/i965/brw_eu_compact.c | 42 ++++++++++++-----------------
src/mesa/drivers/dri/i965/brw_inst.h | 6 ++---
src/mesa/drivers/dri/i965/brw_structs.h | 26 ------------------
src/mesa/drivers/dri/i965/test_eu_compact.c | 4 +--
6 files changed, 24 insertions(+), 61 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 1a962c4..9a013c7 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -244,7 +244,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],
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index eeb9223..7a6c339 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -413,9 +413,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,
diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
index 769056d..709acb5 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
@@ -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_saturate(brw, src) << 16) | /* 1b */
@@ -362,8 +360,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 */
@@ -387,9 +384,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_dst_da1_subreg_nr(brw, src) << 0) | /* 5b */
@@ -423,9 +419,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 = /* 12b */
@@ -445,9 +439,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;
@@ -494,12 +487,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 ||
@@ -557,7 +549,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)];
@@ -581,7 +573,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)];
@@ -597,7 +589,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)];
@@ -608,7 +600,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];
@@ -623,7 +615,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);
@@ -643,7 +635,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));
@@ -809,7 +801,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);
@@ -869,7 +861,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);
diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h
index 83a64fe..034f8db 100644
--- a/src/mesa/drivers/dri/i965/brw_inst.h
+++ b/src/mesa/drivers/dri/i965/brw_inst.h
@@ -681,16 +681,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); \
}
diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h
index fb5e2d3..aef17da 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -781,30 +781,4 @@ struct brw_urb_immediate {
unsigned end_of_thread:1;
};
-/* 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
diff --git a/src/mesa/drivers/dri/i965/test_eu_compact.c b/src/mesa/drivers/dri/i965/test_eu_compact.c
index 3ddd6f3..098d3ce 100644
--- a/src/mesa/drivers/dri/i965/test_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/test_eu_compact.c
@@ -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))) {
--
1.8.3.2
More information about the mesa-dev
mailing list