diff mbox series

[v1,7/9] aarch64: Disable the anchors

Message ID DBBPR83MB061315B3D1EADCCC4173B11DF8922@DBBPR83MB0613.EURPRD83.prod.outlook.com
State New
Headers show
Series SMALL code model fixes, optimization fixes, LTO and minimal C++ enablement | expand

Commit Message

Evgeny Karpov Sept. 2, 2024, 1:11 p.m. UTC
The anchors have been disabled as they use symbol + offset, which is
not applicable for COFF AArch64.

gcc/ChangeLog:

	* config/aarch64/aarch64.cc (TARGET_MIN_ANCHOR_OFFSET):
	Keep default TARGET_MAX_ANCHOR_OFFSET for PECOFF target.
	(TARGET_MAX_ANCHOR_OFFSET): Likewise.
---
 gcc/config/aarch64/aarch64.cc | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andrew Pinski Sept. 2, 2024, 6:55 p.m. UTC | #1
On Mon, Sep 2, 2024 at 6:12 AM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
> The anchors have been disabled as they use symbol + offset, which is
> not applicable for COFF AArch64.

This does not make sense to me at all. Anchors are a small
optimization to group together some static decls so that you could
reuse an anchor point.
Could you expand on this and why you think disabling is correct?
It is so you could do:
        adrp    x0, .LANCHOR0
        add     x2, x0, :lo12:.LANCHOR0
        ldr     w1, [x0, #:lo12:.LANCHOR0]
        ldr     w0, [x2, 4]

Rather than:
        adrp    x1, t
        adrp    x0, t1
        ldr     w1, [x1, #:lo12:t]
        ldr     w0, [x0, #:lo12:t1]
        add     w0, w1, w0

Notice how there is only one adrp in the anchor case.
Could you expand on why the section anchors don't work for pe-coff?

Thanks,
Andrew

>
> gcc/ChangeLog:
>
>         * config/aarch64/aarch64.cc (TARGET_MIN_ANCHOR_OFFSET):
>         Keep default TARGET_MAX_ANCHOR_OFFSET for PECOFF target.
>         (TARGET_MAX_ANCHOR_OFFSET): Likewise.
> ---
>  gcc/config/aarch64/aarch64.cc | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 1d88814f28d..eea9ac02df0 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -30961,11 +30961,13 @@ aarch64_libgcc_floating_mode_supported_p
>  #undef TARGET_MIN_ANCHOR_OFFSET
>  #define TARGET_MIN_ANCHOR_OFFSET -256
>
> +#if !TARGET_PECOFF
>  /* Limit the maximum anchor offset to 4k-1, since that's the limit for a
>     byte offset; we can do much more for larger data types, but have no way
>     to determine the size of the access.  We assume accesses are aligned.  */
>  #undef TARGET_MAX_ANCHOR_OFFSET
>  #define TARGET_MAX_ANCHOR_OFFSET 4095
> +#endif
>
>  #undef TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT
>  #define TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT \
> --
> 2.34.1
>
Evgeny Karpov Sept. 4, 2024, 12:27 p.m. UTC | #2
Monday, September 2, 2024
Andrew Pinski <pinskia@gmail.com> wrote:

> Could you expand on this and why you think disabling is correct?
> It is so you could do:
>         adrp    x0, .LANCHOR0
>         add     x2, x0, :lo12:.LANCHOR0
>         ldr     w1, [x0, #:lo12:.LANCHOR0]
>         ldr     w0, [x2, 4]
>
> Rather than:
>         adrp    x1, t
>         adrp    x0, t1
>         ldr     w1, [x1, #:lo12:t]
>         ldr     w0, [x0, #:lo12:t1]
>         add     w0, w1, w0
>
> Notice how there is only one adrp in the anchor case.
> Could you expand on why the section anchors don't work for pe-coff?

The same explanation applies to addr/ldr when an anchor is used with
an offset.
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662213.html

Regards,
Evgeny
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 1d88814f28d..eea9ac02df0 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -30961,11 +30961,13 @@  aarch64_libgcc_floating_mode_supported_p
 #undef TARGET_MIN_ANCHOR_OFFSET
 #define TARGET_MIN_ANCHOR_OFFSET -256
 
+#if !TARGET_PECOFF
 /* Limit the maximum anchor offset to 4k-1, since that's the limit for a
    byte offset; we can do much more for larger data types, but have no way
    to determine the size of the access.  We assume accesses are aligned.  */
 #undef TARGET_MAX_ANCHOR_OFFSET
 #define TARGET_MAX_ANCHOR_OFFSET 4095
+#endif
 
 #undef TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT
 #define TARGET_VECTORIZE_PREFERRED_DIV_AS_SHIFTS_OVER_MULT \