Mesa (master): aco: remove 64-bit SGPR ubfe/ibfe

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 26 13:57:10 UTC 2020


Module: Mesa
Branch: master
Commit: 454bc595d184da6f9567b6a3451c87616ddb6e79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=454bc595d184da6f9567b6a3451c87616ddb6e79

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri Aug 21 13:07:35 2020 +0100

aco: remove 64-bit SGPR ubfe/ibfe

ubfe/ibfe is always 32-bit.

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

---

 src/amd/compiler/aco_instruction_selection.cpp | 30 +++++---------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 8ce4afc829c..2beb0251d8a 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -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;



More information about the mesa-commit mailing list