aco: improve clamped integer addition disassembly workaround
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 27 Apr 2020 20:16:15 +0000 (21:16 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 23:16:55 +0000 (23:16 +0000)
Make it work with 16-bit and GFX10.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4772>

src/amd/compiler/aco_print_asm.cpp

index e2dbc5bd8b6119331e42c2f8c4df268e26c6a5e4..1c152e5b73eacf0301e5cf02321f119bc80474f1 100644 (file)
@@ -137,9 +137,14 @@ void print_asm(Program *program, std::vector<uint32_t>& binary,
 
       size_t new_pos;
       const int align_width = 60;
-      if (!l && program->chip_class == GFX9 && ((binary[pos] & 0xffff8000) == 0xd1348000)) { /* not actually an invalid instruction */
-         out << std::left << std::setw(align_width) << std::setfill(' ') << "\tv_add_u32_e64 + clamp";
-         new_pos = pos + 2;
+      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";
+         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";
          new_pos = pos + 2;