The ASRD instruction on SVE performs an arithmetic shift right by an immediate
for divide. This patch enables ASRD when dividing vectors using the GNU C
division operator.

For example:

int32x4_t
foo (int32x4_t x)
{
        return x / 4;
}

svint32_t
bar (svint32_t x)
{
        return x / 4;
}

currently generates a DIV, but can be done using ASRD.

The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
OK for GCC16?

Signed-off-by: Soumya AR <[email protected]>

gcc/ChangeLog:

        * expmed.cc (expand_divmod): Expand to sdiv_pow2 optab for vectors.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/sve/sve-asrd-2.c: New test.

Attachment: 0001-aarch64-Use-SVE-ASRD-with-vector-division-using-divi.patch
Description: 0001-aarch64-Use-SVE-ASRD-with-vector-division-using-divi.patch

Reply via email to