Mesa (master): ilo: derive 3-src instructions from the opcode table

Chia-I Wu olv at kemper.freedesktop.org
Sat Sep 13 16:31:54 UTC 2014


Module: Mesa
Branch: master
Commit: 5341001b94f94844fc23db931fb7d9357beb18e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5341001b94f94844fc23db931fb7d9357beb18e5

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Sep 13 23:10:42 2014 +0800

ilo: derive 3-src instructions from the opcode table

One less switch statement to maintain.

Signed-off-by: Chia-I Wu <olvaffe at gmail.com>

---

 src/gallium/drivers/ilo/shader/toy_compiler_disasm.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
index fffa8bf..7c1c32e 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
+++ b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
@@ -498,19 +498,12 @@ disasm_inst_decode(struct disasm_inst *inst,
 
    disasm_inst_decode_dw0_gen6(inst, dw[0]);
 
-   switch (inst->opcode) {
-   case GEN7_OPCODE_CSEL:
-   case GEN7_OPCODE_BFE:
-   case GEN7_OPCODE_BFI2:
-   case GEN6_OPCODE_MAD:
-   case GEN6_OPCODE_LRP:
+   if (disasm_opcode_table[inst->opcode].src_count == 3) {
       disasm_inst_decode_3src_dw1_gen6(inst, dw[1]);
       disasm_inst_decode_3src_dw2_dw3_gen6(inst, dw[2], dw[3]);
-      break;
-   default:
+   } else {
       disasm_inst_decode_dw1_gen6(inst, dw[1]);
       disasm_inst_decode_dw2_dw3_gen6(inst, dw[2], dw[3]);
-      break;
    }
 }
 




More information about the mesa-commit mailing list