From 453f4f23ad9c444e1725516da400af7a8a6da1a5 Mon Sep 17 00:00:00 2001 From: Samuel Iglesias Gonsalvez Date: Thu, 24 Apr 2014 10:02:35 +0200 Subject: [PATCH 1/2] i965: Support instruction compaction on Gen < 6 Gen < 6 also supports instruction compaction. The i965 and ILK docs seem to be missing the compaction tables, but the GM45 docs do contain them. It seems likely that they're identical. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77742 Signed-off-by: Samuel Iglesias Gonsalvez --- src/mesa/drivers/dri/i965/brw_eu_compact.c | 154 ++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c index 3004843..1d453f3 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c @@ -40,6 +40,146 @@ #include "brw_context.h" #include "brw_eu.h" +static const uint32_t gen4_control_index_table[32] = { + 0b00000000000000000, + 0b01000000000000000, + 0b00110000000000000, + 0b00000000000000010, + 0b00100000000000000, + 0b00010000000000000, + 0b01000000000100000, + 0b01000000100000000, + 0b01010000000100000, + 0b00000000100000010, + 0b11000000000000000, + 0b00001000100000010, + 0b01001000100000000, + 0b00000000100000000, + 0b11000000000100000, + 0b00001000100000000, + 0b10110000000000000, + 0b11010000000100000, + 0b00110000100000000, + 0b00100000100000000, + 0b01000000000001000, + 0b01000000000000100, + 0b00111100000000000, + 0b00101011000000000, + 0b00110000000000010, + 0b00010000100000000, + 0b01000000000100100, + 0b01000000000101000, + 0b00110000000000110, + 0b00000000000001010, + 0b01010000000101000, + 0b01010000000100100 +}; + +static const uint32_t gen4_datatype_table[32] = { + 0b001000000000100001, + 0b001011010110101101, + 0b001000001000110001, + 0b001111011110111101, + 0b001011010110101100, + 0b001000000110101101, + 0b001000000000100000, + 0b010100010110110001, + 0b001100011000101101, + 0b001000000000100010, + 0b001000001000110110, + 0b010000001000110001, + 0b001000001000110010, + 0b011000001000110010, + 0b001111011110111100, + 0b001000000100101000, + 0b010100011000110001, + 0b001010010100101001, + 0b001000001000101001, + 0b010000001000110110, + 0b101000001000110001, + 0b001011011000101101, + 0b001000000100001001, + 0b001011011000101100, + 0b110100011000110001, + 0b001000001110111101, + 0b110000001000110001, + 0b011000000100101010, + 0b101000001000101001, + 0b001011010110001100, + 0b001000000110100001, + 0b001010010100001000 +}; + +static const uint16_t gen4_subreg_table[32] = { + 0b000000000000000, + 0b000000010000000, + 0b000001000000000, + 0b000100000000000, + 0b000000000100000, + 0b100000000000000, + 0b000000000010000, + 0b001100000000000, + 0b001010000000000, + 0b000000100000000, + 0b001000000000000, + 0b000000000001000, + 0b000000001000000, + 0b000000000000001, + 0b000010000000000, + 0b000000010100000, + 0b000000000000111, + 0b000001000100000, + 0b011000000000000, + 0b000000110000000, + 0b000000000000010, + 0b000000000000100, + 0b000000001100000, + 0b000100000000010, + 0b001110011000110, + 0b001110100001000, + 0b000110011000110, + 0b000001000011000, + 0b000110010000100, + 0b001100000000110, + 0b000000010000110, + 0b000001000110000 +}; + +static const uint16_t gen4_src_index_table[32] = { + 0b000000000000, + 0b010001101000, + 0b010110001000, + 0b011010010000, + 0b001101001000, + 0b010110001010, + 0b010101110000, + 0b011001111000, + 0b001000101000, + 0b000000101000, + 0b010001010000, + 0b111101101100, + 0b010110001100, + 0b010001101100, + 0b011010010100, + 0b010001001100, + 0b001100101000, + 0b000000000010, + 0b111101001100, + 0b011001101000, + 0b010101001000, + 0b000000000100, + 0b000000101100, + 0b010001101010, + 0b000000111000, + 0b010101011000, + 0b000100100000, + 0b010110000000, + 0b010000000100, + 0b010000111000, + 0b000101100000, + 0b111101110100 +}; + static const uint32_t gen6_control_index_table[32] = { 0b00000000000000000, 0b01000000000000000, @@ -633,6 +773,10 @@ update_uip_jip(struct brw_instruction *insn, int this_old_ip, void brw_init_compaction_tables(struct brw_context *brw) { + assert(gen4_control_index_table[ARRAY_SIZE(gen4_control_index_table) - 1] != 0); + assert(gen4_datatype_table[ARRAY_SIZE(gen4_datatype_table) - 1] != 0); + assert(gen4_subreg_table[ARRAY_SIZE(gen4_subreg_table) - 1] != 0); + assert(gen4_src_index_table[ARRAY_SIZE(gen4_src_index_table) - 1] != 0); assert(gen6_control_index_table[ARRAY_SIZE(gen6_control_index_table) - 1] != 0); assert(gen6_datatype_table[ARRAY_SIZE(gen6_datatype_table) - 1] != 0); assert(gen6_subreg_table[ARRAY_SIZE(gen6_subreg_table) - 1] != 0); @@ -655,6 +799,13 @@ brw_init_compaction_tables(struct brw_context *brw) subreg_table = gen6_subreg_table; src_index_table = gen6_src_index_table; break; + case 5: + case 4: + control_index_table = gen4_control_index_table; + datatype_table = gen4_datatype_table; + subreg_table = gen4_subreg_table; + src_index_table = gen4_src_index_table; + break; default: return; } @@ -674,9 +825,6 @@ brw_compact_instructions(struct brw_compile *p) */ int old_ip[p->next_insn_offset / 8]; - if (brw->gen < 6) - return; - int src_offset; int offset = 0; int compacted_count = 0; -- 1.9.2