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

Author: Chia-I Wu <olva...@gmail.com>
Date:   Sat Feb 14 02:18:55 2015 +0800

ilo: cleanup ISA DW0 decoding

Add disasm_inst_decode_dw0_opcode_gen6() to decode the opcode.  Simplify
branch_ctrl/acc_wr_ctrl decoding.

---

 .../drivers/ilo/shader/toy_compiler_disasm.c       |   26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c 
b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
index 1434736..76b2699 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
+++ b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
@@ -184,7 +184,7 @@ static const struct {
 };
 
 static void
-disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, uint32_t dw0)
+disasm_inst_decode_dw0_opcode_gen6(struct disasm_inst *inst, uint32_t dw0)
 {
    ILO_DEV_ASSERT(inst->dev, 6, 8);
 
@@ -218,6 +218,14 @@ disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, 
uint32_t dw0)
    default:
       break;
    }
+}
+
+static void
+disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, uint32_t dw0)
+{
+   ILO_DEV_ASSERT(inst->dev, 6, 8);
+
+   disasm_inst_decode_dw0_opcode_gen6(inst, dw0);
 
    inst->access_mode = GEN_EXTRACT(dw0, GEN6_INST_ACCESSMODE);
 
@@ -250,19 +258,17 @@ disasm_inst_decode_dw0_gen6(struct disasm_inst *inst, 
uint32_t dw0)
       break;
    }
 
-   if (ilo_dev_gen(inst->dev) >= ILO_GEN(8)) {
-      switch (inst->opcode) {
-      case GEN6_OPCODE_IF:
-      case GEN6_OPCODE_ELSE:
-      case GEN8_OPCODE_GOTO:
+   switch (inst->opcode) {
+   case GEN6_OPCODE_IF:
+   case GEN6_OPCODE_ELSE:
+   case GEN8_OPCODE_GOTO:
+      if (ilo_dev_gen(inst->dev) >= ILO_GEN(8)) {
          inst->branch_ctrl = (bool) (dw0 & GEN8_INST_BRANCHCTRL);
          break;
-      default:
-         inst->acc_wr_ctrl = (bool) (dw0 & GEN6_INST_ACCWRCTRL);
-         break;
       }
-   } else {
+   default:
       inst->acc_wr_ctrl = (bool) (dw0 & GEN6_INST_ACCWRCTRL);
+      break;
    }
 
    inst->cmpt_ctrl = (bool) (dw0 & GEN6_INST_CMPTCTRL);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to