https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125941

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org

--- Comment #1 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Which particular part are you referring to?

the testcase is

#include <arm_sve.h>

#define VECT_CSTN { -1, t (), 0, -1, 0, f (), 0, 0, 0, -1, 0, -1, 0, -1, 0, -1
}

int __attribute__ ((noipa))
t ()
{
  return -1;
}

int __attribute__ ((noipa))
f ()
{
  return 0;
}

svbool_t __attribute__ ((noipa))
func_init4 ()
{
  svbool_t temp = VECT_CSTN;
  return temp;
}

so it's trying to create a boolean vector from a data-vector. Without SVE2p1
the only
way to create this is through memory or another operation like compare. with
SVE2p1 it can use a PMOV.

But if you're referring to the register preservations:

    str    z8, [sp, #2, mul vl]
    str    z9, [sp, #3, mul vl]
    str    z10, [sp, #4, mul vl]
    str    z11, [sp, #5, mul vl]
    str    p15, [sp, #11, mul vl]
    str    p5, [sp, #1, mul vl]
    str    p6, [sp, #2, mul vl]
    str    p7, [sp, #3, mul vl]
    str    p8, [sp, #4, mul vl]
    str    p9, [sp, #5, mul vl]
    str    p10, [sp, #6, mul vl]
    str    p11, [sp, #7, mul vl]
    str    p12, [sp, #8, mul vl]
    str    p13, [sp, #9, mul vl]
    str    p14, [sp, #10, mul vl]
    str    z12, [sp, #6, mul vl]
    str    z13, [sp, #7, mul vl]
    str    z14, [sp, #8, mul vl]
    str    z15, [sp, #9, mul vl]
    str    z16, [sp, #10, mul vl]
    str    z17, [sp, #11, mul vl]
    str    z18, [sp, #12, mul vl]
    str    z19, [sp, #13, mul vl]
    str    z20, [sp, #14, mul vl]
    str    z21, [sp, #15, mul vl]
    str    p4, [sp]
    str    z22, [sp, #16, mul vl]
    str    z23, [sp, #17, mul vl]

This has to do with the PCS of the functions

func_init4 returns an svbool_t so it's calling convention is aarch64_pcs_sve.

but t and f do not use an SVE type, so their calling convention is the base
pcs.

that means that to call t and f it has to preserve the state of the sve pcs
and restore it.  This is what's causing the saves.  If you make t and f use the
sve PCS you'll notice they go away

https://godbolt.org/z/G8xcaxrjs

The extra compares is because the element types of an svbool_t are booleans so
they need to be converted to a C boolean first.

So if the ticket is about the spills then that's not an issue. if it's about
adding
PMOV support, then yes :)

Reply via email to