Hi gcc-patches mailing list,
Saurabh Jha <[email protected]> has requested that the following 
forgejo pull request
be published on the mailing list.

Created on: 2026-03-10 11:09:56+00:00
Latest update: 2026-03-11 12:20:09+00:00
Changes: 3 changed files, 201 additions, 15 deletions
Head revision: saurabh.jha/gcc-TEST ref mingw-regtest commit 
e929cded3e80042364ee98e8f86c774f2dc31be5
Base revision: gcc/gcc-TEST ref trunk commit 
5b09326f7b82ca2481a4b8df1f80475d6a792a04 r16-7997-g5b09326f7b82ca
Merge base: 5b09326f7b82ca2481a4b8df1f80475d6a792a04
Full diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/142.diff
Discussion:  https://forge.sourceware.org/gcc/gcc-TEST/pulls/142
Requested Reviewers: rearnsha

The test gcc.target/aarch64/mingw/variadic_hva.c started failing after
this commit:
b67918fddab42c434c10bedff6c210c55ed907a0

This commit adds three variants of this test case with options that
introduce more predictability to code generation. This will make it less
probable that these tests will break with any other future change. The
options used are:
1. -fno-section-anchors
2. -mcmodel=tiny
3. -mcmodel=small.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/mingw/variadic_hva.c: Deleted and created
        three variants.
        * gcc.target/aarch64/mingw/variadic_hva1.c: Derived from
        variadic_hva.c and compiled with option -fno-section-anchors.
        * gcc.target/aarch64/mingw/variadic_hva2.c: Derived from
        variadic_hva.c and compiled with option -mcmodel=tiny.
        * gcc.target/aarch64/mingw/variadic_hva3.c: Derived from
        variadic_hva.c and compiled with option -mcmodel=small.

        ---
        Hey,

        Regression tested on aarch64-linux-gnu and tested the specific
        tests in gcc.target/aarch64/mingw directory for
        aarch64-w64-mingw32 target.

        Ok for gcc-16?

        Thanks,
        Saurabh

Changed files:
- A: gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva1.c
- A: gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva2.c
- A: gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva3.c
- D: gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c


Saurabh Jha (1):
  aarch64: mingw: Add more tests for variadic hva

 .../gcc.target/aarch64/mingw/variadic_hva1.c  | 93 +++++++++++++++++++
 .../mingw/{variadic_hva.c => variadic_hva2.c} | 30 +++---
 .../gcc.target/aarch64/mingw/variadic_hva3.c  | 93 +++++++++++++++++++
 3 files changed, 201 insertions(+), 15 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva1.c
 rename gcc/testsuite/gcc.target/aarch64/mingw/{variadic_hva.c => 
variadic_hva2.c} (84%)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva3.c

Range-diff against v2:
1:  027ac4093712 ! 1:  e929cded3e80 aarch64: mingw: Fix a failing test 
variadic_hva.c
    @@ Metadata
     Author: Saurabh Jha <[email protected]>
     
      ## Commit message ##
    -    aarch64: mingw: Fix a failing test variadic_hva.c
    +    aarch64: mingw: Add more tests for variadic hva
     
    -    This test started failing after this commit:
    +    The test gcc.target/aarch64/mingw/variadic_hva.c started failing after
    +    this commit:
         b67918fddab42c434c10bedff6c210c55ed907a0
     
    -    It is fixed by adding more predictability to code generation of the 
test
    -    by using the option "-mcmodel=tiny".
    +    This commit adds three variants of this test case with options that
    +    introduce more predictability to code generation. This will make it 
less
    +    probable that these tests will break with any other future change. The
    +    options used are:
    +    1. -fno-section-anchors
    +    2. -mcmodel=tiny
    +    3. -mcmodel=small.
     
         gcc/testsuite/ChangeLog:
     
    -            * gcc.target/aarch64/mingw/variadic_hva.c: Use -mcmodel=tiny
    -            compile option to make code generation more predictable.
    +            * gcc.target/aarch64/mingw/variadic_hva.c: Deleted and created
    +            three variants.
    +            * gcc.target/aarch64/mingw/variadic_hva1.c: Derived from
    +            variadic_hva.c and compiled with option -fno-section-anchors.
    +            * gcc.target/aarch64/mingw/variadic_hva2.c: Derived from
    +            variadic_hva.c and compiled with option -mcmodel=tiny.
    +            * gcc.target/aarch64/mingw/variadic_hva3.c: Derived from
    +            variadic_hva.c and compiled with option -mcmodel=small.
     
                 ---
                 Hey,
    @@ Commit message
                 Thanks,
                 Saurabh
     
    - ## gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c ##
    + ## gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva1.c (new) ##
    +@@
    ++/* { dg-do compile } */
    ++/* { dg-options "-fno-section-anchors" } */
    ++/* { dg-final { check-function-bodies "**" "" } } */
    ++
    ++#include <arm_neon.h>
    ++#include <stdarg.h>
    ++
    ++typedef struct {
    ++  float32x4_t a;
    ++  float32x4_t b;
    ++  float32x4_t c;
    ++  float32x4_t d;
    ++} mat4x4;
    ++
    ++mat4x4 accumulate(int count, ...) {
    ++    va_list va;
    ++    va_start(va, count);
    ++
    ++    mat4x4 result = {
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f)
    ++    };
    ++
    ++    for (int i = 0; i < count; ++i) {
    ++        mat4x4 v = va_arg(va, mat4x4);
    ++        result.a = vaddq_f32(result.a, v.a);
    ++        result.b = vaddq_f32(result.b, v.b);
    ++        result.c = vaddq_f32(result.c, v.c);
    ++        result.d = vaddq_f32(result.d, v.d);
    ++    }
    ++
    ++    va_end(va);
    ++    return result;
    ++}
    ++
    ++
    ++/**
    ++ * For aarch64-w64-mingw32 target, the Homogeneous Vector Aggregate (HVA) 
types
    ++ * are not treated specially.
    ++ *
    ++ * This is in contrast to to aarch64-linux-gnu target where float32x4n 
args
    ++ * would be loaded into 128 bit Q registers.
    ++ */
    ++
    ++
    ++/*
    ++** main:
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++*/
    ++int main()
    ++{
    ++  float32x4_t x = {1.0, 2.0, 3.0, 4.0};
    ++  float32x4_t y = {2.0, 3.0, 4.0, 5.0};
    ++  float32x4_t z = {3.0, 4.0, 5.0, 6.0};
    ++  float32x4_t w = {4.0, 5.0, 6.0, 7.0};
    ++
    ++  accumulate (4, x, y, z, w);
    ++  return 0;
    ++}
    +
    + ## gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c => 
gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva2.c ##
     @@
      /* { dg-do compile } */
    +-/* { dg-additional-options "-std=c99" } */
     +/* { dg-options "-mcmodel=tiny" } */
    - /* { dg-additional-options "-std=c99" } */
      /* { dg-final { check-function-bodies "**" "" } } */
      
    -@@ gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c: mat4x4 
accumulate(int count, ...) {
    + #include <arm_neon.h>
    +@@ gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva2.c: mat4x4 
accumulate(int count, ...) {
      /*
      ** main:
      **        ...
    @@ gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c: mat4x4 
accumulate(int cou
      */
      int main()
      {
    -@@ gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva.c: int main()
    +@@ gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva2.c: int main()
      
        accumulate (4, x, y, z, w);
        return 0;
     -}
      \ No newline at end of file
     +}
    +
    + ## gcc/testsuite/gcc.target/aarch64/mingw/variadic_hva3.c (new) ##
    +@@
    ++/* { dg-do compile } */
    ++/* { dg-options "-mcmodel=small" } */
    ++/* { dg-final { check-function-bodies "**" "" } } */
    ++
    ++#include <arm_neon.h>
    ++#include <stdarg.h>
    ++
    ++typedef struct {
    ++  float32x4_t a;
    ++  float32x4_t b;
    ++  float32x4_t c;
    ++  float32x4_t d;
    ++} mat4x4;
    ++
    ++mat4x4 accumulate(int count, ...) {
    ++    va_list va;
    ++    va_start(va, count);
    ++
    ++    mat4x4 result = {
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f),
    ++      vdupq_n_f32(0.0f)
    ++    };
    ++
    ++    for (int i = 0; i < count; ++i) {
    ++        mat4x4 v = va_arg(va, mat4x4);
    ++        result.a = vaddq_f32(result.a, v.a);
    ++        result.b = vaddq_f32(result.b, v.b);
    ++        result.c = vaddq_f32(result.c, v.c);
    ++        result.d = vaddq_f32(result.d, v.d);
    ++    }
    ++
    ++    va_end(va);
    ++    return result;
    ++}
    ++
    ++
    ++/**
    ++ * For aarch64-w64-mingw32 target, the Homogeneous Vector Aggregate (HVA) 
types
    ++ * are not treated specially.
    ++ *
    ++ * This is in contrast to to aarch64-linux-gnu target where float32x4n 
args
    ++ * would be loaded into 128 bit Q registers.
    ++ */
    ++
    ++
    ++/*
    ++** main:
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        add     x\d+, x\d+, :lo\d+:\.LC\d+
    ++**        ldr     q\d+, \[x\d+\]
    ++**        str     q\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++**        ldr     x\d+, \[sp, \d+\]
    ++**        ...
    ++*/
    ++int main()
    ++{
    ++  float32x4_t x = {1.0, 2.0, 3.0, 4.0};
    ++  float32x4_t y = {2.0, 3.0, 4.0, 5.0};
    ++  float32x4_t z = {3.0, 4.0, 5.0, 6.0};
    ++  float32x4_t w = {4.0, 5.0, 6.0, 7.0};
    ++
    ++  accumulate (4, x, y, z, w);
    ++  return 0;
    ++}
-- 
2.52.0

Reply via email to