> On 7 May 2025, at 12:27, Karl Meakin <karl.mea...@arm.com> wrote:
>
> The `far_branch` attribute only ever takes the values 0 or 1, so make it
> a `no/yes` valued string attribute instead.
>
> gcc/ChangeLog:
>
> * config/aarch64/aarch64.md (far_branch): replace 0/1 with
> no/yes.
> (aarch64_bcond): handle rename.
> (aarch64_cb<optab><mode>1): likewise.
> (*cb<optab><mode>1): likewise.
> (@aarch64_tb<optab><ALLI:mode><GPI:mode>): likewise.
Ok (with fixed Changelog entries).
Thanks,
Kyrill
> ---
> gcc/config/aarch64/aarch64.md | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index ca5bd96a754..256df0dcc04 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -561,9 +561,7 @@ (define_attr "enabled" "no,yes"
> ;; Attribute that specifies whether we are dealing with a branch to a
> ;; label that is far away, i.e. further away than the maximum/minimum
> ;; representable in a signed 21-bits number.
> -;; 0 :=: no
> -;; 1 :=: yes
> -(define_attr "far_branch" "" (const_int 0))
> +(define_attr "far_branch" "no,yes" (const_string "no"))
>
> ;; Attribute that specifies whether the alternative uses MOVPRFX.
> (define_attr "movprfx" "no,yes" (const_string "no"))
> @@ -791,8 +789,8 @@ (define_insn "aarch64_bcond"
> (const_int BRANCH_LEN_N_1Mib))
> (lt (minus (match_dup 2) (pc))
> (const_int BRANCH_LEN_P_1Mib)))
> - (const_int 0)
> - (const_int 1)))]
> + (const_string "no")
> + (const_string "yes")))]
> )
>
> ;; For a 24-bit immediate CST we can optimize the compare for equality
> @@ -858,8 +856,8 @@ (define_insn "aarch64_cb<optab><mode>1"
> (const_int BRANCH_LEN_N_1Mib))
> (lt (minus (match_dup 2) (pc))
> (const_int BRANCH_LEN_P_1Mib)))
> - (const_int 0)
> - (const_int 1)))]
> + (const_string "no")
> + (const_string "yes")))]
> )
>
> ;; For an LT/GE comparison against zero, emit `TBZ`/`TBNZ`
> @@ -874,7 +872,7 @@ (define_insn "*cb<optab><mode>1"
> {
> if (get_attr_length (insn) == 8)
> {
> - if (get_attr_far_branch (insn) == 1)
> + if (get_attr_far_branch (insn) == FAR_BRANCH_YES)
> return aarch64_gen_far_branch (operands, 1, "Ltb",
> "<inv_tb>\\t%<w>0, <sizem1>, ");
> else
> @@ -903,8 +901,8 @@ (define_insn "*cb<optab><mode>1"
> (const_int BRANCH_LEN_N_1Mib))
> (lt (minus (match_dup 1) (pc))
> (const_int BRANCH_LEN_P_1Mib)))
> - (const_int 0)
> - (const_int 1)))]
> + (const_string "no")
> + (const_string "yes")))]
> )
>
> ;; -------------------------------------------------------------------
> @@ -968,8 +966,8 @@ (define_insn "@aarch64_tb<optab><ALLI:mode><GPI:mode>"
> (const_int BRANCH_LEN_N_1Mib))
> (lt (minus (match_dup 2) (pc))
> (const_int BRANCH_LEN_P_1Mib)))
> - (const_int 0)
> - (const_int 1)))]
> + (const_string "no")
> + (const_string "yes")))]
>
> )
>
> --
> 2.45.2
>