From bcd3886e6692ba4b7127debcdfe4890199ec9e54 Mon Sep 17 00:00:00 2001
From: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Date: Sun, 2 Feb 2025 16:46:07 -0300
Subject: [PATCH] arm: testsuite: Adapt mve-vabs.c to improved codegen

Since commit r15-491-gc290e6a0b7a9de this failure happens on
armv8l-linux-gnueabihf and arm-eabi:

Running gcc:gcc.target/arm/simd/simd.exp ...
gcc.target/arm/simd/mve-vabs.c: memmove found 0 times
FAIL: gcc.target/arm/simd/mve-vabs.c scan-assembler-times memmove 3

In PR PR target/116010, Andrew Pinski noted that
"gcc.target/arm/simd/mve-vabs.c now calls memcpy because of the restrict
instead of memmove. That should be a simple fix there."

Therefore change the test to expect memcpy rather than memmove.

Another change is that memcpy is inlined rather than called, so also change
the test to check the optimized tree dump rather than the generated
assembly.

Tested on armv8l-linux-gnueabihf and arm-eabi.

gcc/testsuite/ChangeLog:
	PR target/116010
	* gcc.target/arm/simd/mve-vabs.c: Test tree dump and adjust to new
	code.

Suggested-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/testsuite/gcc.target/arm/simd/mve-vabs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c b/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c
index f2f9ee349906..e85d0b18ee71 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vabs.c
@@ -1,7 +1,7 @@
 /* { dg-do assemble } */
 /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
 /* { dg-add-options arm_v8_1m_mve_fp } */
-/* { dg-additional-options "-O3 -funsafe-math-optimizations" } */
+/* { dg-additional-options "-O3 -funsafe-math-optimizations -fdump-tree-optimized" } */
 
 #include <stdint.h>
 #include <arm_mve.h>
@@ -35,10 +35,10 @@ FUNC_FLOAT(f, float, 32, 4, vabs)
 FUNC(f, float, 16, 8, vabs)
 
 /* Taking the absolute value of an unsigned value is a no-op, so half of the
-   integer optimizations actually generate a call to memmove, the other ones a
+   integer optimizations actually generate a call to memcpy, the other ones a
    'vabs'.  */
 /* { dg-final { scan-assembler-times {vabs.s[0-9]+\tq[0-9]+, q[0-9]+} 3 } } */
 /* { dg-final { scan-assembler-times {vabs.f[0-9]+\tq[0-9]+, q[0-9]+} 2 } } */
 /* { dg-final { scan-assembler-times {vldr[bhw].[0-9]+\tq[0-9]+} 5 } } */
 /* { dg-final { scan-assembler-times {vstr[bhw].[0-9]+\tq[0-9]+} 5 } } */
-/* { dg-final { scan-assembler-times {memmove} 3 } } */
+/* { dg-final { scan-tree-dump-times "memcpy" 3 "optimized" } } */
-- 
GitLab