aco: replace == GFX10 with >= GFX10 where it's needed
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 8 Jun 2020 16:45:35 +0000 (18:45 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 19 Jun 2020 06:18:39 +0000 (08:18 +0200)
Assume the GFX10.3 ISA is similar to GFX10 which is likely (except
possible minor changes and new instructions for raytracing).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5389>

src/amd/compiler/aco_assembler.cpp
src/amd/compiler/aco_lower_to_hw_instr.cpp
src/amd/compiler/aco_print_asm.cpp

index 3bdea63..c36e8c9 100644 (file)
@@ -21,7 +21,7 @@ struct asm_context {
          opcode = &instr_info.opcode_gfx7[0];
       else if (chip_class <= GFX9)
          opcode = &instr_info.opcode_gfx9[0];
-      else if (chip_class == GFX10)
+      else if (chip_class >= GFX10)
          opcode = &instr_info.opcode_gfx10[0];
    }
 
@@ -278,7 +278,7 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
           instr->opcode == aco_opcode::v_interp_p2_f16) {
          if (ctx.chip_class == GFX8 || ctx.chip_class == GFX9) {
             encoding = (0b110100 << 26);
-         } else if (ctx.chip_class == GFX10) {
+         } else if (ctx.chip_class >= GFX10) {
             encoding = (0b110101 << 26);
          } else {
             unreachable("Unknown chip_class.");
@@ -548,7 +548,7 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
          uint32_t encoding;
          if (ctx.chip_class <= GFX9) {
             encoding = (0b110100 << 26);
-         } else if (ctx.chip_class == GFX10) {
+         } else if (ctx.chip_class >= GFX10) {
             encoding = (0b110101 << 26);
          } else {
             unreachable("Unknown chip_class.");
@@ -586,7 +586,7 @@ void emit_instruction(asm_context& ctx, std::vector<uint32_t>& out, Instruction*
          uint32_t encoding;
          if (ctx.chip_class == GFX9) {
             encoding = (0b110100111 << 23);
-         } else if (ctx.chip_class == GFX10) {
+         } else if (ctx.chip_class >= GFX10) {
             encoding = (0b110011 << 26);
          } else {
             unreachable("Unknown chip_class.");
index 441e1b6..10ba9b8 100644 (file)
@@ -1832,7 +1832,7 @@ void lower_to_hw_instr(Program* program)
             {
                if (ctx.program->chip_class <= GFX7)
                   emit_gfx6_bpermute(program, instr, bld);
-               else if (ctx.program->chip_class == GFX10 && ctx.program->wave_size == 64)
+               else if (ctx.program->chip_class >= GFX10 && ctx.program->wave_size == 64)
                   emit_gfx10_wave64_bpermute(program, instr, bld);
                else
                   unreachable("Current hardware supports ds_bpermute, don't emit p_bpermute.");
index 0c69b8c..f2b924b 100644 (file)
@@ -134,7 +134,7 @@ void print_asm(Program *program, std::vector<uint32_t>& binary,
 
       /* mask out src2 on v_writelane_b32 */
       if (((program->chip_class == GFX8 || program->chip_class == GFX9) && (binary[pos] & 0xffff8000) == 0xd28a0000) ||
-          (program->chip_class == GFX10 && (binary[pos] & 0xffff8000) == 0xd7610000)) {
+          (program->chip_class >= GFX10 && (binary[pos] & 0xffff8000) == 0xd7610000)) {
          binary[pos+1] = binary[pos+1] & 0xF803FFFF;
       }
 
@@ -152,7 +152,7 @@ void print_asm(Program *program, std::vector<uint32_t>& binary,
          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)) {
+      } 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;
       } else if (!l) {