aco: fix constant folding of SMRD instructions on GFX6
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 16 Jan 2020 13:04:49 +0000 (14:04 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 20 Jan 2020 16:24:55 +0000 (16:24 +0000)
SMRD instructions have an 8-bit dword offset on SI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3432>

src/amd/compiler/aco_optimizer.cpp

index 8c2514598f08b109f8094e66fe1c7f30f82f9832..7e05204d3b51e5b3c5d12d44d3f5618cbc596122 100644 (file)
@@ -817,7 +817,9 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
          Temp base;
          uint32_t offset;
          if (i == 1 && info.is_constant_or_literal() &&
-             (ctx.program->chip_class < GFX8 || info.val <= 0xFFFFF)) {
+             ((ctx.program->chip_class == GFX6 && info.val <= 0x3FF) ||
+              (ctx.program->chip_class == GFX7 && info.val <= 0xFFFFFFFF) ||
+              (ctx.program->chip_class >= GFX8 && info.val <= 0xFFFFF))) {
             instr->operands[i] = Operand(info.val);
             continue;
          } else if (i == 1 && parse_base_offset(ctx, instr.get(), i, &base, &offset) && base.regClass() == s1 && offset <= 0xFFFFF && ctx.program->chip_class >= GFX9) {