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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |middle-end
             Target|aarch64-linux-gnu           |aarch64*-* arm*-*
            Summary|[10/11/12 Regression] ICE:  |ICE: 'asm' clobber conflict
                   |'asm' clobber conflict with |with output operand with CC
                   |output operand              |output and "CC" clobber
   Target Milestone|10.4                        |---

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is not a regression as the CC mode output was not supported before GCC 10.
It was added with r10-4658.

I don't know why it was not rejected in GCC 9 though.

Note you can reproduce the ICE with just:
int test_ccge(long nr, long t) {
  int x;
  asm("cmp %1,%1"
      : "=@ccge"(x)
      : "r"(nr), "r"(t)
      : "cc");
  return x;
}

Which is closer to legal still.  Removing the cc clobber fixes the issue.
Note you should be able to produce the ICE on arm too (arm and aarch64 share
some backend code and this is one case it shares).

We do have some code which does check for the conflict but it does not use the
adjusted values but the original tree ones:
  /* Third pass checks for easy conflicts.  */
  /* ??? Why are we doing this on trees instead of rtx.  */

  bool clobber_conflict_found = 0;
  for (i = 0; i < noutputs; ++i)
    if (tree_conflicts_with_clobbers_p (output_tvec[i], &clobbered_regs,
locus))
        clobber_conflict_found = 1;
  for (i = 0; i < ninputs - ninout; ++i)
    if (tree_conflicts_with_clobbers_p (input_tvec[i], &clobbered_regs, locus))
        clobber_conflict_found = 1;

Reply via email to