Changes from v5:

1. Properly check x86 targets in gfortran.dg/pr112877-1.f90.

Changes from v4:

1. Rename gcc/testsuite/gfortran.dg/pr14907-1.f90 to
gcc/testsuite/gfortran.dg/pr112877-1.f90
2. Mention

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

Changes from v3:

1. Split improvement of outgoing integer argument promotion into 3
patches.
2. Drop the expand_promote_outgoing_argument change.  The bug

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

should be fixed differently in the x86 backend.

3. Update testcase adjustments.

--
For targets, like x86, which define TARGET_PROMOTE_PROTOTYPES to return
true, all integer arguments smaller than int are passed as int:

[hjl@gnu-tgl-3 pr14907]$ cat x.c
extern int baz (char c1);

int
foo (char c1)
{
  return baz (c1);
}
[hjl@gnu-tgl-3 pr14907]$ gcc -S -O2 -m32 x.c
[hjl@gnu-tgl-3 pr14907]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movsbl  4(%esp), %eax
        movl    %eax, 4(%esp)
        jmp     baz
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 14.2.1 20240912 (Red Hat 14.2.1-3)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 pr14907]$

But integer promotion:

        movsbl  4(%esp), %eax
        movl    %eax, 4(%esp)

isn't necessary when the incoming argument can be copied to the outgoing
argument without any changes.

1. Honor TARGET_PROMOTE_PROTOTYPES during RTL expand.
2. Drop targetm.promote_prototypes from C, C++ and Ada frontends.
3. Use incoming small integer argument type if possible.
4. Adjust tests for the C frontend promotion removal.
5. gcc.dg/tree-ssa/pr108357.c fails with the C frontend promotion removal.
This is a known issue:

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

H.J. Lu (7):
  Honor TARGET_PROMOTE_PROTOTYPES during RTL expand
  Drop targetm.promote_prototypes from C, C++ and Ada frontends
  Use incoming small integer argument type if possible
  i386: Adjust apx-ndd.c for frontend promotion removal
  vect-simd-clone-1[6-8][cd].c: Expect in-branch clones for x86
  scev-cast.c: Enable for all targets and adjust scan matches
  ssa-fre-4.c: Enable for all targets and adjust scan match

 gcc/ada/gcc-interface/utils.cc                | 24 -----------
 gcc/c/c-decl.cc                               | 40 -------------------
 gcc/c/c-typeck.cc                             | 19 ++-------
 gcc/calls.cc                                  | 36 +++++++++++++++++
 gcc/cp/call.cc                                | 10 -----
 gcc/cp/typeck.cc                              | 13 ++----
 gcc/gimple.cc                                 | 10 +----
 gcc/testsuite/gcc.dg/tree-ssa/scev-cast.c     |  5 +--
 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c     |  6 +--
 .../gcc.dg/vect/vect-simd-clone-16c.c         |  5 +--
 .../gcc.dg/vect/vect-simd-clone-16d.c         |  4 +-
 .../gcc.dg/vect/vect-simd-clone-17c.c         |  5 +--
 .../gcc.dg/vect/vect-simd-clone-17d.c         |  5 +--
 .../gcc.dg/vect/vect-simd-clone-18c.c         |  5 +--
 .../gcc.dg/vect/vect-simd-clone-18d.c         |  5 +--
 gcc/testsuite/gcc.target/i386/apx-ndd.c       |  9 ++---
 gcc/testsuite/gcc.target/i386/pr14907-1.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-10.c    | 23 +++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-11.c    | 12 ++++++
 gcc/testsuite/gcc.target/i386/pr14907-12.c    | 17 ++++++++
 gcc/testsuite/gcc.target/i386/pr14907-13.c    | 12 ++++++
 gcc/testsuite/gcc.target/i386/pr14907-14.c    | 17 ++++++++
 gcc/testsuite/gcc.target/i386/pr14907-15.c    | 26 ++++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-16.c    | 24 +++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-2.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-3.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-4.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-5.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-6.c     | 21 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-7.c     | 22 ++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-8.c     | 23 +++++++++++
 gcc/testsuite/gcc.target/i386/pr14907-9.c     | 22 ++++++++++
 gcc/testsuite/gfortran.dg/pr112877-1.f90      | 17 ++++++++
 gcc/tree.cc                                   | 14 -------
 34 files changed, 399 insertions(+), 157 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-1.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-10.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-11.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-12.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-13.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-14.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-15.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-16.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-2.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-3.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-4.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-5.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-6.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-7.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-8.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr14907-9.c
 create mode 100644 gcc/testsuite/gfortran.dg/pr112877-1.f90

-- 
2.47.1

Reply via email to