Mesa (master): aco: shorten disassembly for repeated instructions
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Aug 26 13:43:35 UTC 2020
Module: Mesa
Branch: master
Commit: 192b9f43039eee21288145e940502de5eca1a69b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=192b9f43039eee21288145e940502de5eca1a69b
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Wed Aug 5 14:59:01 2020 +0100
aco: shorten disassembly for repeated instructions
Future tests will do this.
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6212>
---
src/amd/compiler/aco_print_asm.cpp | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp
index d4b0e0edbcf..ce12aacf9e4 100644
--- a/src/amd/compiler/aco_print_asm.cpp
+++ b/src/amd/compiler/aco_print_asm.cpp
@@ -146,38 +146,52 @@ void print_asm(Program *program, std::vector<uint32_t>& binary,
binary[pos+1] = binary[pos+1] & 0xF803FFFF;
}
+ const int align_width = 60;
+ out << std::left << std::setw(align_width) << std::setfill(' ');
+
size_t l = LLVMDisasmInstruction(disasm, (uint8_t *) &binary[pos],
(exec_size - pos) * sizeof(uint32_t), pos * 4,
outline, sizeof(outline));
size_t new_pos;
- const int align_width = 60;
if (!l &&
((program->chip_class >= GFX9 && (binary[pos] & 0xffff8000) == 0xd1348000) || /* v_add_u32_e64 + clamp */
(program->chip_class >= GFX10 && (binary[pos] & 0xffff8000) == 0xd7038000) || /* v_add_u16_e64 + clamp */
(program->chip_class <= GFX9 && (binary[pos] & 0xffff8000) == 0xd1268000)) /* v_add_u16_e64 + clamp */) {
- out << std::left << std::setw(align_width) << std::setfill(' ') << "\tinteger addition + clamp";
+ out << "\tinteger addition + clamp";
bool has_literal = program->chip_class >= GFX10 &&
(((binary[pos+1] & 0x1ff) == 0xff) || (((binary[pos+1] >> 9) & 0x1ff) == 0xff));
new_pos = pos + 2 + has_literal;
} else if (program->chip_class >= GFX10 && l == 4 && ((binary[pos] & 0xfe0001ff) == 0x020000f9)) {
- out << std::left << std::setw(align_width) << std::setfill(' ') << "\tv_cndmask_b32 + sdwa";
+ out << "\tv_cndmask_b32 + sdwa";
new_pos = pos + 2;
} else if (!l) {
- out << std::left << std::setw(align_width) << std::setfill(' ') << "(invalid instruction)";
+ out << "(invalid instruction)";
new_pos = pos + 1;
invalid = true;
} else {
- out << std::left << std::setw(align_width) << std::setfill(' ') << outline;
+ out << outline;
assert(l % 4 == 0);
new_pos = pos + l / 4;
}
+ size_t size = new_pos - pos;
out << std::right;
out << " ;";
- for (; pos < new_pos; pos++)
- out << " " << std::setfill('0') << std::setw(8) << std::hex << binary[pos];
+ for (unsigned i = 0; i < size; i++)
+ out << " " << std::setfill('0') << std::setw(8) << std::hex << binary[pos + i];
out << std::endl;
+
+ size_t original_pos = pos;
+ pos += size;
+
+ unsigned repeat_count = 0;
+ while (pos + size <= exec_size && memcmp(&binary[pos], &binary[original_pos], size * 4) == 0) {
+ repeat_count++;
+ pos += size;
+ }
+ if (repeat_count)
+ out << std::left << std::setw(0) << std::dec << std::setfill(' ') << "\t(then repeated " << repeat_count << " times)" << std::endl;
}
out << std::setfill(' ') << std::setw(0) << std::dec;
assert(next_block == program->blocks.size());
More information about the mesa-commit
mailing list