ilo: derive 3-src instructions from the opcode table
authorChia-I Wu <olvaffe@gmail.com>
Sat, 13 Sep 2014 15:10:42 +0000 (23:10 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Sat, 13 Sep 2014 16:30:33 +0000 (00:30 +0800)
One less switch statement to maintain.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/shader/toy_compiler_disasm.c

index fffa8bfdc03d7e22e03de76e12375ada43fc46cd..7c1c32e98e46d7c8d33daf8468145037e377cb28 100644 (file)
@@ -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;
    }
 }