aco: remove 64-bit SGPR ubfe/ibfe
authorRhys Perry <pendingchaos02@gmail.com>
Fri, 21 Aug 2020 12:07:35 +0000 (13:07 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 26 Aug 2020 13:46:23 +0000 (13:46 +0000)
ubfe/ibfe is always 32-bit.

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/6424>

src/amd/compiler/aco_instruction_selection.cpp

index 8ce4afc829cd72c9cc1c47be959df16bafff7571..2beb0251d8a04fcae781e74b0fa8ae3af70afd72 100644 (file)
@@ -2761,6 +2761,9 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
       Temp offset = get_alu_src(ctx, instr->src[1]);
       Temp bits = get_alu_src(ctx, instr->src[2]);
 
+      if (dst.bytes() != 4)
+         unreachable("Unsupported BFE bit size");
+
       if (dst.type() == RegType::sgpr) {
          Operand extract;
          nir_const_value* const_offset = nir_src_as_const_value(instr->src[1].src);
@@ -2778,34 +2781,11 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
             extract = bld.sop2(aco_opcode::s_or_b32, bld.def(s1), bld.def(s1, scc), offset, width);
          }
 
-         aco_opcode opcode;
-         if (dst.regClass() == s1) {
-            if (instr->op == nir_op_ubfe)
-               opcode = aco_opcode::s_bfe_u32;
-            else
-               opcode = aco_opcode::s_bfe_i32;
-         } else if (dst.regClass() == s2) {
-            if (instr->op == nir_op_ubfe)
-               opcode = aco_opcode::s_bfe_u64;
-            else
-               opcode = aco_opcode::s_bfe_i64;
-         } else {
-            unreachable("Unsupported BFE bit size");
-         }
-
+         aco_opcode opcode = instr->op == nir_op_ubfe ? aco_opcode::s_bfe_u32 : aco_opcode::s_bfe_i32;
          bld.sop2(opcode, Definition(dst), bld.def(s1, scc), base, extract);
 
       } else {
-         aco_opcode opcode;
-         if (dst.regClass() == v1) {
-            if (instr->op == nir_op_ubfe)
-               opcode = aco_opcode::v_bfe_u32;
-            else
-               opcode = aco_opcode::v_bfe_i32;
-         } else {
-            unreachable("Unsupported BFE bit size");
-         }
-
+         aco_opcode opcode = instr->op == nir_op_ubfe ? aco_opcode::v_bfe_u32 : aco_opcode::v_bfe_i32;
          emit_vop3a_instruction(ctx, instr, opcode, dst);
       }
       break;