On Sun, Oct 25, 2026 at 8:27 AM Zhongteng Gui <[email protected]> wrote:
>
> On 2026/10/22 16:29, Zhongteng Gui wrote:
> > From 7b974976c2245e8c230569fa356d031965a42c41 Mon Sep 17 00:00:00 2001
> > From: Zhongteng Gui <[email protected]>
> > Date: Thu, 22 Oct 2026 00:58:17 +0800
> > Subject: [PATCH 1/4] i386: Remove outdated message from GCC 4.6 (passing
> >  aligned parameter) [PR128083]
> >
> > This removes "the ABI for passing parameters with %d-byte alignment has
> > changed in GCC 4.6".  It has been 15 years since then.
> >
> > gcc/ChangeLog:
> >
> >       * config/i386/i386.cc (ix86_compat_function_arg_boundary):
> >       Removed.  No longer used anywhere.
> >       (ix86_function_arg_boundary): Don't warn for ABI change from GCC
> >       4.6.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * gcc.target/i386/pr68657.c: Remove dg-message.
> >
> > Signed-off-by: Zhongteng Gui <[email protected]>
> > ---
> >  gcc/config/i386/i386.cc                 | 50 -------------------------
> >  gcc/testsuite/gcc.target/i386/pr68657.c |  1 -
> >  2 files changed, 51 deletions(-)
> >
> From 25997652f50c71430f222f6c28349e9722b5f6e6 Mon Sep 17 00:00:00 2001
> From: Zhongteng Gui <[email protected]>
> Date: Thu, 22 Oct 2026 00:58:17 +0800
> Subject: [PATCH v2 1/4] i386: Remove outdated message from GCC 4.6 (passing
>  aligned parameter) [PR128083]
>
> This removes "the ABI for passing parameters with %d-byte alignment has
> changed in GCC 4.6".  It has been 15 years since then.
>
> Also removes now-unused functions ix86_compat_function_arg_boundary and
> ix86_compat_aligned_value_p.

As indicated in the PR we should never prune those, instead a -Wpsabi=<version>
option should handle the version to report ABI changes against and -Wpsabi
might get a reasonable default version for that.

Richard.

> gcc/ChangeLog:
>
>         * config/i386/i386.cc (ix86_compat_function_arg_boundary):
>         Removed.  No longer used anywhere.
>         (ix86_compat_aligned_value_p): Removed.  No non-recursive user.
>         (ix86_function_arg_boundary): Don't warn for ABI change from GCC
>         4.6.
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/i386/pr68657.c: Remove dg-message.
>
> Signed-off-by: Zhongteng Gui <[email protected]>
> ---
> Changes since v1: also remove ix86_compat_aligned_value_p and update commit 
> message.
> Found by sashiko:
> https://gcc.sashiko.dev/#/patchset/SL2P216MB227176DF8249DFF3A95BBCFFEF652%40SL2P216MB2271.KORP216.PROD.OUTLOOK.COM
>
>  gcc/config/i386/i386.cc                 | 101 ------------------------
>  gcc/testsuite/gcc.target/i386/pr68657.c |   1 -
>  2 files changed, 102 deletions(-)
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 0b29d9a4026..08c321322d0 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -3703,92 +3703,6 @@ ix86_pass_by_reference (cumulative_args_t cum_v, const 
> function_arg_info &arg)
>    return ix86_pass_by_reference_abi (cum ? cum->call_abi : ix86_abi, arg);
>  }
>
> -/* Return true when TYPE should be 128bit aligned for 32bit argument
> -   passing ABI.  XXX: This function is obsolete and is only used for
> -   checking psABI compatibility with previous versions of GCC.  */
> -
> -static bool
> -ix86_compat_aligned_value_p (const_tree type)
> -{
> -  machine_mode mode = TYPE_MODE (type);
> -  if (((TARGET_SSE && SSE_REG_MODE_P (mode))
> -       || mode == TDmode
> -       || mode == TFmode
> -       || mode == TCmode)
> -      && (!TYPE_USER_ALIGN (type) || TYPE_ALIGN (type) > 128))
> -    return true;
> -  if (TYPE_ALIGN (type) < 128)
> -    return false;
> -
> -  if (AGGREGATE_TYPE_P (type))
> -    {
> -      /* Walk the aggregates recursively.  */
> -      switch (TREE_CODE (type))
> -       {
> -       case RECORD_TYPE:
> -       case UNION_TYPE:
> -       case QUAL_UNION_TYPE:
> -         {
> -           tree field;
> -
> -           /* Walk all the structure fields.  */
> -           for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN 
> (field))
> -             {
> -               if (TREE_CODE (field) == FIELD_DECL
> -                   && ix86_compat_aligned_value_p (TREE_TYPE (field)))
> -                 return true;
> -             }
> -           break;
> -         }
> -
> -       case ARRAY_TYPE:
> -         /* Just for use if some languages passes arrays by value.  */
> -         if (ix86_compat_aligned_value_p (TREE_TYPE (type)))
> -           return true;
> -         break;
> -
> -       default:
> -         gcc_unreachable ();
> -       }
> -    }
> -  return false;
> -}
> -
> -/* Return the alignment boundary for MODE and TYPE with alignment ALIGN.
> -   XXX: This function is obsolete and is only used for checking psABI
> -   compatibility with previous versions of GCC.  */
> -
> -static unsigned int
> -ix86_compat_function_arg_boundary (machine_mode mode,
> -                                  const_tree type, unsigned int align)
> -{
> -  /* In 32bit, only _Decimal128 and __float128 are aligned to their
> -     natural boundaries.  */
> -  if (!TARGET_64BIT && mode != TDmode && mode != TFmode)
> -    {
> -      /* i386 ABI defines all arguments to be 4 byte aligned.  We have to
> -        make an exception for SSE modes since these require 128bit
> -        alignment.
> -
> -        The handling here differs from field_alignment.  ICC aligns MMX
> -        arguments to 4 byte boundaries, while structure fields are aligned
> -        to 8 byte boundaries.  */
> -      if (!type)
> -       {
> -         if (!(TARGET_SSE && SSE_REG_MODE_P (mode)))
> -           align = PARM_BOUNDARY;
> -       }
> -      else
> -       {
> -         if (!ix86_compat_aligned_value_p (type))
> -           align = PARM_BOUNDARY;
> -       }
> -    }
> -  if (align > BIGGEST_ALIGNMENT)
> -    align = BIGGEST_ALIGNMENT;
> -  return align;
> -}
> -
>  /* Return true when TYPE should be 128bit aligned for 32bit argument
>     passing ABI.  */
>
> @@ -3864,9 +3778,6 @@ ix86_function_arg_boundary (machine_mode mode, 
> const_tree type)
>      align = PARM_BOUNDARY;
>    else
>      {
> -      static bool warned;
> -      unsigned int saved_align = align;
> -
>        if (!TARGET_64BIT)
>         {
>           /* i386 ABI defines XFmode arguments to be 4 byte aligned.  */
> @@ -3881,18 +3792,6 @@ ix86_function_arg_boundary (machine_mode mode, 
> const_tree type)
>           if (align < 128)
>             align = PARM_BOUNDARY;
>         }
> -
> -      if (warn_psabi
> -         && !warned
> -         && align != ix86_compat_function_arg_boundary (mode, type,
> -                                                        saved_align))
> -       {
> -         warned = true;
> -         inform (input_location,
> -                 "the ABI for passing parameters with %d-byte"
> -                 " alignment has changed in GCC 4.6",
> -                 align / BITS_PER_UNIT);
> -       }
>      }
>
>    return align;
> diff --git a/gcc/testsuite/gcc.target/i386/pr68657.c 
> b/gcc/testsuite/gcc.target/i386/pr68657.c
> index 3480242760f..0f8eae8841e 100644
> --- a/gcc/testsuite/gcc.target/i386/pr68657.c
> +++ b/gcc/testsuite/gcc.target/i386/pr68657.c
> @@ -4,7 +4,6 @@
>  typedef int V __attribute__((vector_size (64)));
>
>  void foo (V x, V *y) { /* { dg-error "AVX512F vector argument without 
> AVX512F enabled" } */
> -  /* { dg-message "the ABI for passing parameters with 64-byte alignment has 
> changed" "" { target *-*-* } .-1 } */
>    *y = x;
>  }
>
> --
> 2.56.0.windows.3
>
>

Reply via email to