Since the machine-independent widening multiply logic was improved
PR113560, ARM's wmul-[567].c fail.  AFAICT the logic takes advantage
of the fact that, after zero-extending a narrow integral type to a
wider type, further zero- or sign-extending is equivalent, which
enables different instructions to be used for equivalent effect.

Adjust the tests to accept all the equivalent instructions that can be
used.

Regstrapped on x86_64-linux-gnu, also tested on arm-eabi and
aarch64-elf.  Ok to install?


for  gcc/testsuite/ChangeLog

        PR target/113560
        * gcc.target/arm/wmul-5.c: Accept other mla instructions.
        * gcc.target/arm/wmul-6.c: Likewise.
        * gcc.target/arm/wmul-7.c: Likewise.
---
 gcc/testsuite/gcc.target/arm/wmul-5.c |    4 +++-
 gcc/testsuite/gcc.target/arm/wmul-6.c |    4 +++-
 gcc/testsuite/gcc.target/arm/wmul-7.c |    4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/wmul-5.c 
b/gcc/testsuite/gcc.target/arm/wmul-5.c
index 9f29a81c0b8bd..282e007d9be3f 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-5.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-5.c
@@ -8,4 +8,6 @@ foo (long long a, char *b, char *c)
   return a + *b * *c;
 }
 
-/* { dg-final { scan-assembler "umlal" } } */
+/* smlalbb after zero-extending the chars to HImode, or either signed- or
+   unsigned-widening multiply after extending them to SImode.  */
+/* { dg-final { scan-assembler {(?:smlalbb|[us]mlal)} } } */
diff --git a/gcc/testsuite/gcc.target/arm/wmul-6.c 
b/gcc/testsuite/gcc.target/arm/wmul-6.c
index babdaab1efd55..05247e00c5ebc 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-6.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-6.c
@@ -8,4 +8,6 @@ foo (long long a, unsigned char *b, signed char *c)
   return a + (long long)*b * (long long)*c;
 }
 
-/* { dg-final { scan-assembler "smlalbb" } } */
+/* After zero-extending B and sign-extending C to [HS]imode, either
+   signed-widening multiply will do.  */
+/* { dg-final { scan-assembler {smlal(?:bb)?} } } */
diff --git a/gcc/testsuite/gcc.target/arm/wmul-7.c 
b/gcc/testsuite/gcc.target/arm/wmul-7.c
index 2db4ad4e10d52..26933c42401a3 100644
--- a/gcc/testsuite/gcc.target/arm/wmul-7.c
+++ b/gcc/testsuite/gcc.target/arm/wmul-7.c
@@ -8,4 +8,6 @@ foo (unsigned long long a, unsigned char *b, unsigned short *c)
   return a + *b * *c;
 }
 
-/* { dg-final { scan-assembler "umlal" } } */
+/* After zero-extending both to SImode, either signed- or unsigned-widening
+   multiply will do.  */
+/* { dg-final { scan-assembler {[us]mlal} } } */


-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

Reply via email to