the cause should be one minor bug in prepare_cmp_insn.
the last mode parameter "pmode" of "prepare_cmp_insn" should match the mode of the first parameter "x", while during the recursive call of "prepare_cmp_insn", x is with mode of targetm.libgcc_cmp_return_mode () while pmode is assign to word_mode. generally this is OK, because default libgcc_cmp_return_mode hook always return word_mode, but AArch64 has a target private implementation which always return SImode, so there is a mismatch which cause a ICE later. this minor issue is hidding because nearly all other targets use default hook, and the compare is rarely invoked. Thanks gcc/ PR target/63442 * optabs.c (prepare_cmp_insn): Use target hook "libgcc_cmp_return_mode" instead of word_mode.
diff --git a/gcc/optabs.c b/gcc/optabs.c index d55a6bb..3073816 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4264,7 +4264,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size, y = const0_rtx; } - *pmode = word_mode; + *pmode = targetm.libgcc_cmp_return_mode (); prepare_cmp_insn (x, y, comparison, NULL_RTX, unsignedp, methods, ptest, pmode); }