summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-08-25 13:26:50 -0700
committerEric Anholt <[email protected]>2016-08-25 17:24:11 -0700
commitb0b99a7952675eea4b28b86899082a475f459a77 (patch)
tree7ad4c6d1fddc9e181496e76f5299c4f90da3308e
parentb160708e0307ea0baa2c7891ad9760cdfd39b4bc (diff)
vc4: Add disassembly for constant MUL rotates
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu_disasm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qpu_disasm.c b/src/gallium/drivers/vc4/vc4_qpu_disasm.c
index c902d4fdac9..5294722722f 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_disasm.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_disasm.c
@@ -317,7 +317,7 @@ print_alu_dst(uint64_t inst, bool is_mul)
}
static void
-print_alu_src(uint64_t inst, uint32_t mux)
+print_alu_src(uint64_t inst, uint32_t mux, bool is_mul)
{
bool is_a = mux != QPU_MUX_B;
const char *file = is_a ? "a" : "b";
@@ -325,12 +325,14 @@ print_alu_src(uint64_t inst, uint32_t mux)
QPU_GET_FIELD(inst, QPU_RADDR_A) :
QPU_GET_FIELD(inst, QPU_RADDR_B));
uint32_t unpack = QPU_GET_FIELD(inst, QPU_UNPACK);
+ bool has_si = QPU_GET_FIELD(inst, QPU_SIG) == QPU_SIG_SMALL_IMM;
+ uint32_t si = QPU_GET_FIELD(inst, QPU_SMALL_IMM);
- if (mux <= QPU_MUX_R5)
+ if (mux <= QPU_MUX_R5) {
fprintf(stderr, "r%d", mux);
- else if (!is_a &&
- QPU_GET_FIELD(inst, QPU_SIG) == QPU_SIG_SMALL_IMM) {
- uint32_t si = QPU_GET_FIELD(inst, QPU_SMALL_IMM);
+ if (has_si && is_mul && si >= QPU_SMALL_IMM_MUL_ROT + 1)
+ fprintf(stderr, "+%d", si - QPU_SMALL_IMM_MUL_ROT);
+ } else if (!is_a && has_si) {
if (si <= 15)
fprintf(stderr, "%d", si);
else if (si <= 31)
@@ -380,12 +382,12 @@ print_add_op(uint64_t inst)
print_alu_dst(inst, false);
fprintf(stderr, ", ");
- print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_A));
+ print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_A), false);
if (!is_mov) {
fprintf(stderr, ", ");
- print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_B));
+ print_alu_src(inst, QPU_GET_FIELD(inst, QPU_ADD_B), false);
}
}
@@ -414,11 +416,11 @@ print_mul_op(uint64_t inst)
print_alu_dst(inst, true);
fprintf(stderr, ", ");
- print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_A));
+ print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_A), true);
if (!is_mov) {
fprintf(stderr, ", ");
- print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_B));
+ print_alu_src(inst, QPU_GET_FIELD(inst, QPU_MUL_B), true);
}
}