i965: Replace struct brw_compact_instruction with brw_compact_inst.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner 2014-06-13 16:16:28 -07:00 committed by Kenneth Graunke
parent eaf78e56af
commit 92233aee47
6 changed files with 24 additions and 61 deletions

View 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],

View 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,

View 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);

View 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); \
}

View 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

View 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))) {