https://gcc.gnu.org/g:0ec86b4c9d3b66be6750a3e015c4a6e37890c666

commit r17-6675-g0ec86b4c9d3b66be6750a3e015c4a6e37890c666
Author: Igor Shevlyakov <[email protected]>
Date:   Tue Nov 24 23:34:25 2026 -0800

    testsuite: Fix the AArch64 complex, dotprod and i8mm hardware checks 
[PR129017]
    
    check_effective_target_arm_v8_3a_complex_neon_hw runs FCADD #90 on
    {1, 3} and {2, 5} and expects {8, 24}, values copied from the dotprod
    check.  FCADD #90 gives {1 - 5, 3 + 2} = {-4, 5}, so since
    r11-5969-g3ed472af6bc inverted the return value the check has failed on
    every machine with FEAT_FCMA, and the tests that need it have been
    UNSUPPORTED on real hardware.  pr122408_2.f90 has never been run with
    -march=armv8.3-a.  Expecting {-4, 5} instead would fail on big-endian,
    where the real and imaginary lanes are swapped, so use a zero addend:
    FCADD then returns its first operand whatever the lane order.
    
    check_effective_target_arm_v8_2a_dotprod_neon_hw has the opposite
    problem.  UDOT accumulates into its destination, but the asm declares
    RESULTS as output only, so the sum is added to whatever the register
    held; the check then fails only when the result is exactly {8, 24}, the
    right answer.  It works as long as the register is not zero.
    check_effective_target_arm_v8_2a_i8mm_neon_hw, a copy of it for USDOT,
    has the same problem.  In both, make RESULTS an input as well and fail
    on anything but {8, 24}.
    
    With the complex check fixed, pr126592.c runs, and its
    scan-assembler-not has no assembly file to scan.  Add -save-temps.
    
    Assisted-by: Claude Opus 5.5
    
            PR testsuite/129017
    
    gcc/testsuite/ChangeLog:
    
            * lib/target-supports.exp
            (check_effective_target_arm_v8_2a_dotprod_neon_hw): Accumulate into
            a zeroed RESULTS and fail unless the result is {8, 24}.
            (check_effective_target_arm_v8_2a_i8mm_neon_hw): Likewise.
            (check_effective_target_arm_v8_3a_complex_neon_hw): Use a zero
            addend and expect the first operand.
            * gcc.target/aarch64/pr126592.c: Add -save-temps.
    
    Signed-off-by: Igor Shevlyakov <[email protected]>

Diff:
---
 gcc/testsuite/gcc.target/aarch64/pr126592.c |  2 +-
 gcc/testsuite/lib/target-supports.exp       | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/pr126592.c 
b/gcc/testsuite/gcc.target/aarch64/pr126592.c
index 00e82c1a7954..3e0453399fc3 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr126592.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr126592.c
@@ -1,6 +1,6 @@
 /* { dg-do run { target arm_v8_3a_complex_neon_hw } } */
 /* { dg-require-effective-target aarch64_little_endian } */
-/* { dg-options "-O3 -march=armv8.3-a" } */
+/* { dg-options "-O3 -march=armv8.3-a -save-temps" } */
 
 #define N 64
 double a[N], b[N], c[N];
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 950732ed8b6c..291c29932913 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8174,18 +8174,18 @@ proc check_effective_target_arm_v8_2a_dotprod_neon_hw { 
} {
 
          #ifdef __ARM_ARCH_ISA_A64
          asm ("udot %0.2s, %1.8b, %2.8b"
-              : "=w"(results)
+              : "+w"(results)
               : "w"(a), "w"(b)
               : /* No clobbers.  */);
 
          #else
          asm ("vudot.u8 %P0, %P1, %P2"
-              : "=w"(results)
+              : "+w"(results)
               : "w"(a), "w"(b)
               : /* No clobbers.  */);
          #endif
 
-         return (results[0] == 8 && results[1] == 24) ? 1 : 0;
+         return (results[0] == 8 && results[1] == 24) ? 0 : 1;
        }
     } [add_options_for_arm_v8_2a_dotprod_neon ""]]
 }
@@ -8210,19 +8210,19 @@ proc check_effective_target_arm_v8_2a_i8mm_neon_hw { } {
 
          #ifdef __ARM_ARCH_ISA_A64
          asm ("usdot %0.2s, %1.8b, %2.8b"
-              : "=w"(results)
+              : "+w"(results)
               : "w"(a), "w"(b)
               : /* No clobbers.  */);
 
          #else
          asm ("vusdot.u8 %P0, %P1, %P2"
-              : "=w"(results)
+              : "+w"(results)
               : "w"(a), "w"(b)
               : /* No clobbers.  */);
          #endif
 
          return (vget_lane_u32 (results, 0) == 8
-                 && vget_lane_u32 (results, 1) == 24) ? 1 : 0;
+                 && vget_lane_u32 (results, 1) == 24) ? 0 : 1;
        }
     } [add_options_for_arm_v8_2a_i8mm ""]]
 }
@@ -14587,9 +14587,10 @@ proc check_effective_target_arm_v8_3a_complex_neon_hw 
{ } {
        main (void)
        {
 
-         float32x2_t results = {-4.0,5.0};
+         /* A zero addend makes the result independent of lane order.  */
+         float32x2_t results;
          float32x2_t a = {1.0,3.0};
-         float32x2_t b = {2.0,5.0};
+         float32x2_t b = {0.0,0.0};
 
          #ifdef __ARM_ARCH_ISA_A64
          asm ("fcadd %0.2s, %1.2s, %2.2s, #90"
@@ -14604,7 +14605,7 @@ proc check_effective_target_arm_v8_3a_complex_neon_hw { 
} {
               : /* No clobbers.  */);
          #endif
 
-         return (results[0] == 8 && results[1] == 24) ? 0 : 1;
+         return (results[0] == 1 && results[1] == 3) ? 0 : 1;
        }
     } [add_options_for_arm_v8_3a_complex_neon ""]]
 }

Reply via email to