https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120292

            Bug ID: 120292
           Summary: amdgcn: Infinite recursion in vec_cmpu<mode>di_exec
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rsandifo at gcc dot gnu.org
  Target Milestone: ---
            Target: amdgcn*-*-*

The following pattern is infinitely recursive.  It looks like it should be
calling "vec_cmp..." rather than "vec_cmpu...":

(define_expand "vec_cmpu<mode>di_exec"
  [(match_operand:DI 0 "register_operand")
   (match_operator 1 "gcn_compare_operator"
     [(match_operand:V_INT_noQI 2 "gcn_alu_operand")
      (match_operand:V_INT_noQI 3 "gcn_vop3_operand")])
   (match_operand:DI 4 "gcn_exec_reg_operand")]
  ""
  {
    /* Unsigned comparisons use the same patterns as signed comparisons,
       except that they use unsigned operators (e.g. LTU vs LT).
       The '%E1' directive then does the Right Thing.  */
    emit_insn (gen_vec_cmpu<mode>di_exec (operands[0], operands[1],
                                          operands[2], operands[3],
                                          operands[4]));
    DONE;
  })

This causes a build of amdgcn-amdhsa to fail with --enable-werror:

.../gcc/config/gcn/gcn-valu.md: In function ‘rtx_def*
gen_vec_cmpuv32sidi_exec(rtx, rtx, rtx, rtx, rtx)’:
.../gcc/config/gcn/gcn-valu.md:3815:1: error: infinite recursion detected
[-Werror=infinite-recursion]
 3815 |     emit_insn (gen_<expander><mode><vnsi>2_exec (sitmp1, operands[2],
      | ^   ~~~~~~~~~~~~~~~~~~~~
.../gcc/config/gcn/gcn-valu.md:3798:15: note: recursive call
 3798 |     emit_insn (gen_vec_cmpu<mode>di_exec (operands[0], operands[1],
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3799 |                                           operands[2], operands[3],
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~
 3800 |                                           operands[4]));
      |                                           ~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Reply via email to