]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Remove cc clobber from *aarch64_tbz<LTGE><ALLI>1
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 7 Aug 2025 04:51:02 +0000 (04:51 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 11 Aug 2025 23:25:09 +0000 (23:25 +0000)
commit976bad6ea48346b0dc31e68b035daa9569724fb5
tree3cfacda7a3037faa099693e63431be73d2276077
parent5a2d86939c735ca2e9aba68c534bffe763a8f7a6
aarch64: Remove cc clobber from *aarch64_tbz<LTGE><ALLI>1

There is a conflict between aarch64_tbzltdi1 and aarch64_cbltdi
with respect to pnum_clobbers, resulting in a recog failure:

0xa1fffe fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1640
0x81340e patch_jump_insn
        ../../gcc/cfgrtl.cc:1303
0xc0eafe redirect_branch_edge
        ../../gcc/cfgrtl.cc:1330
0xc0f372 cfg_layout_redirect_edge_and_branch
        ../../gcc/cfgrtl.cc:4736
0xbfb6b9 redirect_edge_and_branch(edge_def*, basic_block_def*)
        ../../gcc/cfghooks.cc:391
0x1fa9310 try_forward_edges
        ../../gcc/cfgcleanup.cc:561
0x1fa9310 try_optimize_cfg
        ../../gcc/cfgcleanup.cc:2931
0x1fa9310 cleanup_cfg(int)
        ../../gcc/cfgcleanup.cc:3143
0x1fe11e8 rest_of_handle_cse
        ../../gcc/cse.cc:7591
0x1fe11e8 execute
        ../../gcc/cse.cc:7622

The simplest solution is to remove the clobber from aarch64_tbz.
This removes the possibility of expansion via TST+B.cond, which
will merely fall back to TBNZ+B on shorter branches.

gcc:
PR target/121385
* config/aarch64/aarch64.md (*aarch64_tbz<LTGE><ALLI>1): Remove
cc clobber and expansion via TST+Bcond.

gcc/testsuite:
PR target/121385
* gcc.target/aarch64/cmpbr-1.c: New.
gcc/config/aarch64/aarch64.md
gcc/testsuite/gcc.target/aarch64/cmpbr-1.c [new file with mode: 0644]