[Bug target/122867] thumb cbz/cbnz patterns cannot handle large branch ranges
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 27 15:05:38 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122867
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Richard Earnshaw
<rearnsha@gcc.gnu.org>:
https://gcc.gnu.org/g:63a0cb5b5908ba9e1db762ed26b69939ba5703b0
commit r13-9984-g63a0cb5b5908ba9e1db762ed26b69939ba5703b0
Author: Richard Earnshaw <rearnsha@arm.com>
Date: Tue Nov 25 15:47:05 2025 +0000
arm: handle long-range CBZ/CBNZ patterns [PR122867]
The CBN?Z instructions have a very small range (just 128 bytes
forwards). The compiler knows how to handle cases where we
exceed that, but only if the range remains within that which
a condition branch can support. When compiling some machine
generated code it is not too difficult to exceed this limit,
so arrange to fall back to a conditional branch over an
unconditional one in this extreme case.
gcc/ChangeLog:
PR target/122867
* config/arm/arm.cc (arm_print_operand): Use %- to
emit LOCAL_LABEL_PREFIX.
(arm_print_operand_punct_valid_p): Allow %- for punct
and make %_ valid for all compilation variants.
* config/arm/thumb2.md (*thumb2_cbz): Handle very
large branch ranges that exceed the limit of b<cond>.
(*thumb2_cbnz): Likewise.
gcc/testsuite/ChangeLog:
PR target/122867
* gcc.target/arm/cbz-range.c: New test.
(cherry picked from commit e97550a7d0e1a8b31a76b0877c0e90a0163da7ee)
More information about the Gcc-bugs
mailing list