https://gcc.gnu.org/g:5a2d86939c735ca2e9aba68c534bffe763a8f7a6

commit r16-3145-g5a2d86939c735ca2e9aba68c534bffe763a8f7a6
Author: Richard Henderson <richard.hender...@linaro.org>
Date:   Mon Aug 4 21:47:57 2025 +1000

    aarch64: Disable TARGET_CMPBR with aarch64_track_speculation
    
    With -mtrack-speculation, CC_REGNUM must be used at every
    conditional branch.
    
    gcc:
            * config/aarch64/aarch64.h (TARGET_CMPBR): False when
            aarch64_track_speculation is true.

Diff:
---
 gcc/config/aarch64/aarch64.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 096c853af7ff..2b3610c86ed5 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -410,8 +410,9 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE ATTRIBUTE_UNUSED
 /* CSSC instructions are enabled through +cssc.  */
 #define TARGET_CSSC AARCH64_HAVE_ISA (CSSC)
 
-/* CB<cc> instructions are enabled through +cmpbr.  */
-#define TARGET_CMPBR AARCH64_HAVE_ISA (CMPBR)
+/* CB<cc> instructions are enabled through +cmpbr,
+   but are incompatible with -mtrack-speculation. */
+#define TARGET_CMPBR (AARCH64_HAVE_ISA (CMPBR) && !aarch64_track_speculation)
 
 /* Make sure this is always defined so we don't have to check for ifdefs
    but rather use normal ifs.  */

Reply via email to