https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121385
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Both can match:
(jump_insn 297 296 298 35 (set (pc)
(if_then_else (lt (reg:DI 170 [ _94 ])
(const_int 0 [0]))
(label_ref 303)
(pc))) "../../../comb/libgcc/libgcc2.c":366:12 discrim 1 29
{aarch64_cbltdi}
(expr_list:REG_DEAD (reg:DI 170 [ _94 ])
(int_list:REG_BR_PROB 4 (nil)))
-> 303)
But aarch64_tbzltdi1 has a clobber against CC.
So if we are seeing how many clobbers needs to be added we match against
aarch64_tbzltdi1 but since there was no clobbers on the aarch64_cbltdi pattern,
it is rejected.
One way of fixing this is move the aarch64_cbltdi patterns in front of
aarch64_tbzltdi1 .
Or easier disable aarch64_tbzltdi1 if TARGET_CMPBR like:
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index a4ae6859da0..7c87b091f6b 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -839,7 +839,7 @@ (define_insn "*aarch64_tbz<optab><mode>1"
(label_ref (match_operand 1))
(pc)))
(clobber (reg:CC CC_REGNUM))]
- "!aarch64_track_speculation"
+ "!aarch64_track_speculation && !TARGET_CMPBR"
{
if (get_attr_length (insn) == 8)
{