https://gcc.gnu.org/g:fcf48a6dbb706b7c831452662b337ba5756975e1

commit r17-6640-gfcf48a6dbb706b7c831452662b337ba5756975e1
Author: Andrew Stubbs <[email protected]>
Date:   Mon Nov 23 17:29:12 2026 +0000

    amdgcn: fix vector one_cmpl*_exec insns
    
    The vector one_cmpl insn were using the define_subst to implement the 
"_exec"
    variants, but define_subst does not do anything to the splitters, leaving 
them
    broken.  This patch adds the "_exec" variants explicitly, as has been 
already
    done elsewhere in the machine description.
    
    gcc/ChangeLog:
    
            * config/gcn/gcn-valu.md (one_cmpl<mode>2<exec>): Rename ...
            (one_cmpl<mode>2): ... to this.
            (one_cmpl<mode>2_exec): New insn and split.

Diff:
---
 gcc/config/gcn/gcn-valu.md | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gcc/config/gcn/gcn-valu.md b/gcc/config/gcn/gcn-valu.md
index 7b1ce8e66a9d..f5b9ef8cfda4 100644
--- a/gcc/config/gcn/gcn-valu.md
+++ b/gcc/config/gcn/gcn-valu.md
@@ -2987,7 +2987,7 @@
     DONE;
   })
 
-(define_insn_and_split "one_cmpl<mode>2<exec>"
+(define_insn_and_split "one_cmpl<mode>2"
   [(set (match_operand:V_DI 0 "register_operand"  "=   v")
         (not:V_DI
           (match_operand:V_DI 1 "gcn_alu_operand" "vSvDB")))]
@@ -3004,6 +3004,43 @@
   }
   [(set_attr "type" "mult")])
 
+; This can't use the <exec> substitution: define_subst does not apply to the
+; split part of a define_insn_and_split.
+(define_insn_and_split "one_cmpl<mode>2_exec"
+  [(set (match_operand:V_DI 0 "register_operand"                "=   v")
+       (vec_merge:V_DI
+         (not:V_DI
+           (match_operand:V_DI 1 "gcn_alu_operand"              "vSvDB"))
+         (match_operand:V_DI 2 "gcn_register_or_unspec_operand" "   U0")
+         (match_operand:DI 3 "gcn_exec_reg_operand"             "    e")))]
+  ""
+  "#"
+  "reload_completed"
+  [(const_int 0)]
+  {
+    rtx out_lo = gcn_operand_part (<MODE>mode, operands[0], 0);
+    rtx out_hi = gcn_operand_part (<MODE>mode, operands[0], 1);
+    rtx in_lo = gcn_operand_part (<MODE>mode, operands[1], 0);
+    rtx in_hi = gcn_operand_part (<MODE>mode, operands[1], 1);
+    rtx exec = operands[3];
+
+    rtx old_lo, old_hi;
+    if (GET_CODE (operands[2]) == UNSPEC)
+      {
+       old_lo = old_hi = gcn_gen_undef (<VnSI>mode);
+      }
+    else
+      {
+       old_lo = gcn_operand_part (<MODE>mode, operands[2], 0);
+       old_hi = gcn_operand_part (<MODE>mode, operands[2], 1);
+      }
+
+    emit_insn (gen_one_cmpl<vnsi>2_exec (out_lo, in_lo, old_lo, exec));
+    emit_insn (gen_one_cmpl<vnsi>2_exec (out_hi, in_hi, old_hi, exec));
+    DONE;
+  }
+  [(set_attr "type" "mult")])
+
 (define_expand "abs<mode>2"
   [(set (match_operand:V_INT 0 "register_operand")
         (abs:V_INT (match_operand:V_INT 1 "register_operand")))]

Reply via email to