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

            Bug ID: 129017
           Summary: check_effective_target_arm_v8_3a_complex_neon_hw is
                    always false on hardware
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ishevlyakov at gcc dot gnu.org
  Target Milestone: ---

check_effective_target_arm_v8_3a_complex_neon_hw (gcc/testsuite/lib/
target-supports.exp) runs

  float32x2_t a = {1.0,3.0};
  float32x2_t b = {2.0,5.0};
  asm ("fcadd %0.2s, %1.2s, %2.2s, #90" : "=w"(results) : "w"(a), "w"(b));
  return (results[0] == 8 && results[1] == 24) ? 0 : 1;

(vcadd.f32 ... #90 on AArch32).  FCADD #90 computes
{ a[0] - b[1], a[1] + b[0] } = { 1 - 5, 3 + 2 } = { -4, 5 }, which is what
the hardware returns (checked on cfarm107, NVIDIA GB10, which has
FEAT_FCMA).  The check expects { 8, 24 }, so it fails on every machine
that can run the instruction, and every test that depends on it is
UNSUPPORTED on real hardware.

The check was added in r8-4112-g2b5de01437baf9 as "? 1 : 0", which
passed whenever the result was not { 8, 24 }, so it worked, if by
accident.  r11-5969-g3ed472af6bc inverted the return to "? 0 : 1" without
fixing the values, so it has been always false since GCC 11.

Tests affected on trunk:

  gcc.target/aarch64/pr126589.c       dg-do run { target ..._hw }
  gcc.target/aarch64/pr126592.c       dg-do run { target ..._hw }
  gcc.target/aarch64/pr126593.c       dg-do run { target ..._hw }
  gcc.target/aarch64/sve/pr126589.c   dg-require-effective-target ..._hw
  gfortran.target/aarch64/pr122408_2.f90
      dg-additional-options "-O2 -march=armv8.3-a" { target ..._hw }

pr122408_2.f90 is the run test for PR122408, but it never gets
-march=armv8.3-a, so it has never executed an FCMLA.  The wrong-code in
the FMS pattern from that fix (PR129007) went unnoticed partly because of
this.

With the expected values changed to { -4, 5 }, the tests above run and
pass on cfarm107.  One more problem shows up then: pr126592.c is a run
test with scan-assembler-not but no -save-temps, so the scan is
UNRESOLVED.

I'll post a patch.

Reply via email to