Thanks Richard. I had a WIP patch to fix some of these issues but you
beat me to it, and I'll defer to your patch since you have more
experience with GCC.
I would ask, have you checked that the generated assembly in
`gcc/testsuite/gcc.target/aarch64/cmpbr.c` hasn't changed?
Thanks,
Karl Meakin
On 04/08/2025 22:18, Richard Henderson wrote:
I have written patches for FEAT_CMPBR support in QEMU, and wanted to
test them out with gcc. The easiest way, seemed to be bootstrapping
gcc with cmpbr enabled. The attempt failed on stage1 libgcc.
My bug report is target/121385. Pinski did some analyis, which was
very helpful, and guides most of this patch set.
Pinski filed a second PR, target/121388, vs bid_binarydecimal.c. I
think that might now be in hiding rather than actually being fixed,
since I did nothing that should have affected changing the sense of
the branch during cfglayout. I suspect we need to accept a symmetric
range of constants for all comparisons, expand those that don't fit
to cmp+bcond.
While we could have post-reload splitting, I'm not sure how split works
with shorten_branches, so we might have to retain cmp+bcond all the way
through to output. If that's true, and we assume that performant cpus
will fuse cmp+bcond anyway, it might not be worth bothering to split.
My bootstrap under emulation is still going, 8 hours in. In hindsight
I should have used a bigger machine, but laziness used the one with
the chroot already set up.
This passes native bootstrap and make check on a neoverse-n1, so I
don't seem to have broken anything obvious.
r~
Richard Henderson (8):
aarch64: Drop label format argument from aarch64_gen_far_branch
aarch64: Fix spelling of BRANCH_LEN_N_1KiB
aarch64: Drop cbranch<SHORT>4 expander
aarch64: Disable TARGET_CMPBR with aarch64_track_speculation
aarch64: Use aarch64_gen_compare_zero_and_branch in aarch64_restore_za
aarch64: Add cc clobber to compare-and-branch patterns
aarch64: Consider TARGET_CMPBR in rtx costs
aarch64: Use cc when CB/CBB/CBH is out-of-range
gcc/config/aarch64/aarch64-protos.h | 5 +-
gcc/config/aarch64/aarch64.h | 5 +-
gcc/config/aarch64/aarch64-sme.md | 3 +-
gcc/config/aarch64/aarch64.cc | 22 +++++--
gcc/config/aarch64/aarch64.md | 94 ++++++++++++++---------------
5 files changed, 74 insertions(+), 55 deletions(-)