[gcc(refs/users/meissner/heads/work164-test)] Update ChangeLog.*

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:19d46f68bba26bc9b3e0b15f6aa6326d653d0940

commit 19d46f68bba26bc9b3e0b15f6aa6326d653d0940
Author: Michael Meissner 
Date:   Thu Apr 25 20:26:28 2024 -0400

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.test | 13 +
 1 file changed, 13 insertions(+)

diff --git a/gcc/ChangeLog.test b/gcc/ChangeLog.test
index 55cdbe9e14a..d30a9e2fbc6 100644
--- a/gcc/ChangeLog.test
+++ b/gcc/ChangeLog.test
@@ -1,3 +1,16 @@
+ Branch work164-test, patch #306 
+
+Add -mmfspr option.
+
+2024-04-25  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/rs6000-cpus.def (ISA_MASKS_2_7_SERVER): Add -mmfspr.
+   (POWERPC_MASKS): Likewise.
+   * config/rs6000/rs6000.cc (rs6000_register_move_cost): Check -mmfspr.
+   * config/rs6000/rs6000.opt (-mmfspr): New option.
+
  Branch work164-test, patch #305 
 
 Make moves from SPRs higher in cost.


[gcc(refs/users/meissner/heads/work164-test)] Add -mmfspr option.

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:cdcfeb5aa467d17024891bdbc218531151b0f1d6

commit cdcfeb5aa467d17024891bdbc218531151b0f1d6
Author: Michael Meissner 
Date:   Thu Apr 25 20:24:59 2024 -0400

Add -mmfspr option.

2024-04-25  Michael Meissner  

gcc/

* config/rs6000/rs6000-cpus.def (ISA_MASKS_2_7_SERVER): Add -mmfspr.
(POWERPC_MASKS): Likewise.
* config/rs6000/rs6000.cc (rs6000_register_move_cost): Check 
-mmfspr.
* config/rs6000/rs6000.opt (-mmfspr): New option.

Diff:
---
 gcc/config/rs6000/rs6000-cpus.def | 2 ++
 gcc/config/rs6000/rs6000.cc   | 3 ++-
 gcc/config/rs6000/rs6000.opt  | 4 
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000-cpus.def 
b/gcc/config/rs6000/rs6000-cpus.def
index 7ea3ce09c8d..ecb9471d84a 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -51,6 +51,7 @@
 | OPTION_MASK_CRYPTO   \
 | OPTION_MASK_DIRECT_MOVE  \
 | OPTION_MASK_EFFICIENT_UNALIGNED_VSX  \
+| OPTION_MASK_MFSPR\
 | OPTION_MASK_QUAD_MEMORY  \
 | OPTION_MASK_QUAD_MEMORY_ATOMIC   \
 | OPTION_MASK_TAR)
@@ -138,6 +139,7 @@
 | OPTION_MASK_HTM  \
 | OPTION_MASK_ISEL \
 | OPTION_MASK_MFCRF\
+| OPTION_MASK_MFSPR\
 | OPTION_MASK_MMA  \
 | OPTION_MASK_MODULO   \
 | OPTION_MASK_MULHW\
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index e5ebbd58cc0..4df4259335b 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -22816,7 +22816,8 @@ rs6000_register_move_cost (machine_mode mode,
   /* Make moves from SPR registers (LR, CTR, TAR) more expensive so that the
  register allocator does not think of these registers are useful for saving
  results.  */
-  else if (reg_classes_intersect_p (from, SPECIAL_REGS)
+  else if (TARGET_MFSPR
+  && reg_classes_intersect_p (from, SPECIAL_REGS)
   && reg_classes_intersect_p (to, GENERAL_REGS))
 {
   rclass = from;
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 8e9215a32c2..2cbf7c1db1c 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -607,6 +607,10 @@ mtar
 Target Mask(TAR) Var(rs6000_isa_flags)
 Generate (do not generate) code using the TAR register.
 
+mmfspr
+Target Undocumented Mask(MFSPR) Var(rs6000_isa_flags)
+Generate (do not generate) code making move from SPR register expensive.
+
 mrelative-jumptables
 Target Undocumented Var(rs6000_relative_jumptables) Init(1) Save


[gcc(refs/users/meissner/heads/work164-test)] Make moves from SPRs higher in cost.

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:eebc665799dc3cacf8c57f62863b489e07d6066d

commit eebc665799dc3cacf8c57f62863b489e07d6066d
Author: Michael Meissner 
Date:   Thu Apr 25 19:38:52 2024 -0400

Make moves from SPRs higher in cost.

2024-04-25  Michael Meissner  

gcc/

* config/rs6000/rs6000.cc (rs6000_register_move_cost): Make moves 
from
SPRs more expensive.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 908ad5dcb58..e5ebbd58cc0 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -22813,6 +22813,16 @@ rs6000_register_move_cost (machine_mode mode,
   ret = 2 * hard_regno_nregs (reg, mode);
 }
 
+  /* Make moves from SPR registers (LR, CTR, TAR) more expensive so that the
+ register allocator does not think of these registers are useful for saving
+ results.  */
+  else if (reg_classes_intersect_p (from, SPECIAL_REGS)
+  && reg_classes_intersect_p (to, GENERAL_REGS))
+{
+  rclass = from;
+  ret = (hard_regno_nregs (LR_REGNO, mode) > 1) ? 32768 : 32;
+}
+
   /*  Moves from/to GENERAL_REGS.  */
   else if ((rclass = from, reg_classes_intersect_p (to, GENERAL_REGS))
   || (rclass = to, reg_classes_intersect_p (from, GENERAL_REGS)))


[gcc(refs/users/meissner/heads/work164-test)] Revert all changes

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:b7c32f032d273335cf1f4e16c31754f23f7ba3ca

commit b7c32f032d273335cf1f4e16c31754f23f7ba3ca
Author: Michael Meissner 
Date:   Thu Apr 25 19:34:31 2024 -0400

Revert all changes

Diff:
---
 gcc/config/rs6000/rs6000.cc | 10 --
 1 file changed, 10 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index d498f62be7a..908ad5dcb58 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -22813,16 +22813,6 @@ rs6000_register_move_cost (machine_mode mode,
   ret = 2 * hard_regno_nregs (reg, mode);
 }
 
-  /* Make moves from SPR registers (LR, CTR, TAR) more expensive so that the
- register allocator does not think of these registers are useful for saving
- results.  */
-  else if (reg_classes_intersect_p (from, SPECIAL_REGS)
-  && reg_classes_intersect_p (to, GENERAL_REGS))
-{
-  rclass = from;
-  ret = 6;
-}
-
   /*  Moves from/to GENERAL_REGS.  */
   else if ((rclass = from, reg_classes_intersect_p (to, GENERAL_REGS))
   || (rclass = to, reg_classes_intersect_p (from, GENERAL_REGS)))


[gcc(refs/users/meissner/heads/work164-test)] Update ChangeLog.*

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d2805b66b9547d41e9fb3ee4c1ae2ecbbcd9077c

commit d2805b66b9547d41e9fb3ee4c1ae2ecbbcd9077c
Author: Michael Meissner 
Date:   Thu Apr 25 18:12:15 2024 -0400

Update ChangeLog.*

Diff:
---
 gcc/ChangeLog.test | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/gcc/ChangeLog.test b/gcc/ChangeLog.test
index 146d70fca7f..55cdbe9e14a 100644
--- a/gcc/ChangeLog.test
+++ b/gcc/ChangeLog.test
@@ -1,3 +1,14 @@
+ Branch work164-test, patch #305 
+
+Make moves from SPRs higher in cost.
+
+2024-04-25  Michael Meissner  
+
+gcc/
+
+   * config/rs6000/rs6000.cc (rs6000_register_move_cost): Make moves from
+   SPRs more expensive.
+
  Branch work164-test, patch #304 
 
 Adjust tests for tar register


[gcc(refs/users/meissner/heads/work164-test)] Make moves from SPRs higher in cost.

2024-04-25 Thread Michael Meissner via Gcc-cvs
https://gcc.gnu.org/g:d1a7529aaec43878cc0d0a5e754d894a1857d18a

commit d1a7529aaec43878cc0d0a5e754d894a1857d18a
Author: Michael Meissner 
Date:   Thu Apr 25 18:10:35 2024 -0400

Make moves from SPRs higher in cost.

2024-04-25  Michael Meissner  

gcc/

* config/rs6000/rs6000.cc (rs6000_register_move_cost): Make moves 
from
SPRs more expensive.

Diff:
---
 gcc/config/rs6000/rs6000.cc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 908ad5dcb58..d498f62be7a 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -22813,6 +22813,16 @@ rs6000_register_move_cost (machine_mode mode,
   ret = 2 * hard_regno_nregs (reg, mode);
 }
 
+  /* Make moves from SPR registers (LR, CTR, TAR) more expensive so that the
+ register allocator does not think of these registers are useful for saving
+ results.  */
+  else if (reg_classes_intersect_p (from, SPECIAL_REGS)
+  && reg_classes_intersect_p (to, GENERAL_REGS))
+{
+  rclass = from;
+  ret = 6;
+}
+
   /*  Moves from/to GENERAL_REGS.  */
   else if ((rclass = from, reg_classes_intersect_p (to, GENERAL_REGS))
   || (rclass = to, reg_classes_intersect_p (from, GENERAL_REGS)))


[gcc r11-11373] Darwin: Correct a version check.

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:dca9066e7deda6182b722ee4373f08909b8236d9

commit r11-11373-gdca9066e7deda6182b722ee4373f08909b8236d9
Author: Iain Sandoe 
Date:   Mon Apr 1 20:47:25 2024 +0100

Darwin: Correct a version check.

When the version for dsymutil comes from a clang build, it is
of the form NNmm.pp.qq where NN and mm are the major and minor
LLVM version components.  We need to check for a major version
greater than or equal to 7 - so use 700 in the check.

gcc/ChangeLog:

* config/darwin.c (darwin_override_options): Update the
clang major version value in the dsymutil check.

Signed-off-by: Iain Sandoe 
(cherry picked from commit 451bb0b9262d2f54173937569a29d7f1ad234e30)

Diff:
---
 gcc/config/darwin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 0564e6f0218..574424ac11c 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3369,7 +3369,7 @@ darwin_override_options (void)
   /* External toolchains based on LLVM or clang 7+ have support for
 dwarf-4.  */
   if ((dsymutil_version.kind == LLVM && dsymutil_version.major >= 7)
- || (dsymutil_version.kind == CLANG && dsymutil_version.major >= 7))
+ || (dsymutil_version.kind == CLANG && dsymutil_version.major >= 700))
dwarf_version = 4;
   else if (dsymutil_version.kind == DWARFUTILS
   && dsymutil_version.major >= 121)


[gcc r11-11372] Darwin: Check as for .build_version support and use it if available.

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:9702d54788021b1f48a2fd1fe9f13607d37f491f

commit r11-11372-g9702d54788021b1f48a2fd1fe9f13607d37f491f
Author: Iain Sandoe 
Date:   Tue Oct 17 11:10:27 2023 +0100

Darwin: Check as for .build_version support and use it if available.

This adds support for the minimum OS version data in assembler files.
At present, we have no mechanism to detect the SDK version in use, and
so that is omitted from build_versions.

We follow the implementation in clang, '.build_version' is only emitted
(where supported) for target macOS versions >= 10.14.  For earlier macOS
we fall back to using a '.macosx_version_min' directive.  This latter is
also emitted when the assembler supports it, but not build_version.

gcc/ChangeLog:

* config.in: Regenerate.
* config/darwin.c (darwin_file_start): Add assembler directives
for the target OS version, where these are supported by the
assembler.
(darwin_override_options): Check for building >= macOS 10.14.
* configure: Regenerate.
* configure.ac: Check for assembler support of .build_version
directives.

Signed-off-by: Iain Sandoe 
(cherry picked from commit a4184c8a65a00eaf8a8d7f92fb8ad2f8621b39e2)

Diff:
---
 gcc/config.in   |  6 ++
 gcc/config/darwin.c | 34 --
 gcc/configure   | 49 +++--
 gcc/configure.ac| 12 ++--
 4 files changed, 91 insertions(+), 10 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 982c453ca36..6dd0ff010ce 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -598,6 +598,12 @@
 #endif
 
 
+/* Define if your macOS assembler supports .build_version directives */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_MACOS_BUILD_VERSION
+#endif
+
+
 /* Define if the assembler understands -march=rv*_zifencei. */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_MARCH_ZIFENCEI
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index e01460a996f..0564e6f0218 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3032,7 +3032,35 @@ darwin_asm_output_dwarf_offset (FILE *file, int size, 
const char * lab,
 void
 darwin_file_start (void)
 {
-  /* Nothing to do.  */
+#ifdef HAVE_AS_MMACOSX_VERSION_MIN_OPTION
+  /* This should not happen with a well-formed command line, but the user could
+ invoke cc1* directly without it.  */
+  if (!darwin_macosx_version_min)
+return;
+  /* This assumes that the version passed has been validated in the driver.  */
+  unsigned maj, min, tiny;
+  int count = sscanf (darwin_macosx_version_min, "%u.%u.%u", , , 
);
+  if (count < 0)
+return;
+  if (count < 3)
+tiny = 0;
+  if (count < 2)
+min = 0;
+  const char *directive;
+#ifdef HAVE_AS_MACOS_BUILD_VERSION
+  /* We only handle macos, so far.  */
+  if (generating_for_darwin_version >= 18)
+directive = "build_version macos, ";
+  else
+#endif
+directive = "macosx_version_min ";
+  if (count > 2 && tiny != 0)
+fprintf (asm_out_file, "\t.%s %u, %u, %u\n", directive, maj, min, tiny);
+  else if (count > 1)
+fprintf (asm_out_file, "\t.%s %u, %u\n", directive, maj, min);
+  else
+ fprintf (asm_out_file, "\t.%s %u, 0\n", directive, maj);
+#endif
 }
 
 /* Called for the TARGET_ASM_FILE_END hook.
@@ -3254,7 +3282,9 @@ darwin_override_options (void)
   /* Keep track of which (major) version we're generating code for.  */
   if (darwin_macosx_version_min)
 {
-  if (strverscmp (darwin_macosx_version_min, "10.7") >= 0)
+  if (strverscmp (darwin_macosx_version_min, "10.14") >= 0)
+   generating_for_darwin_version = 18;
+  else if (strverscmp (darwin_macosx_version_min, "10.7") >= 0)
generating_for_darwin_version = 11;
   else if (strverscmp (darwin_macosx_version_min, "10.6") >= 0)
generating_for_darwin_version = 10;
diff --git a/gcc/configure b/gcc/configure
index d2ad1628edd..86f44a35f42 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -26007,16 +26007,22 @@ if ${gcc_cv_as_mmacosx_version_min+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   gcc_cv_as_mmacosx_version_min=no
-  if test x$gcc_cv_as != x; then
-$as_echo '.text' > conftest.s
-if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mmacosx-version-min=10.1 -o 
conftest.o conftest.s >&5'
+if test $in_tree_gas = yes; then
+if test $gcc_cv_gas_vers -ge `expr \( \( -mmacosx-version-min=10.1 \* 1000 
\) + gcc_cv_as_mmacosx_version_min=yes \) \* 1000 + `
+  then :
+fi
+  elif test x$gcc_cv_as != x; then
+$as_echo '' > conftest.s
+if { ac_try='$gcc_cv_as $gcc_cv_as_flags .text -o conftest.o conftest.s 
>&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }
 then
-   gcc_cv_as_mmacosx_version_min=yes
+
+$as_echo "#define 

[gcc r11-11371] Darwin, configure: Allow for an unrecognisable dsymutil [PR111610].

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:1fd4db58480a518b05dd835157e59b2ed9fd2bc1

commit r11-11371-g1fd4db58480a518b05dd835157e59b2ed9fd2bc1
Author: Iain Sandoe 
Date:   Wed Sep 27 11:05:31 2023 +0100

Darwin, configure: Allow for an unrecognisable dsymutil [PR111610].

We had a catch-all configuration case for missing or unrecognised dsymutil
but it was setting the dsymutil source to "UNKNOWN" which is not usable in
this context (since it clashes with an existing enum).  We rename this to
DET_UNKNOWN (for Darwin External Toolchain).

PR target/111610

gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Rename the missing dsymutil case to "DET_UNKNOWN".

Signed-off-by: Iain Sandoe 
(cherry picked from commit 2ecab2f32b9e9a75bf563f80752d5b44dcd26b98)

Diff:
---
 gcc/configure| 2 +-
 gcc/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index bf0bd5f428d..d2ad1628edd 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -30804,7 +30804,7 @@ $as_echo_n "checking dsymutil version 
\"$dsymutil_temp\"... " >&6; }
   dsymutil_kind=LLVM
   dsymutil_vers=`echo $dsymutil_temp | sed 's/.*LLVM\ version\ 
\([0-9\.]*\).*/\1/'`
 else
-  dsymutil_kind=UNKNOWN
+  dsymutil_kind=DET_UNKNOWN
   dsymutil_vers="0.0"
 fi
 dsymutil_major=`expr "$dsymutil_vers" : '\([0-9]*\)'`
diff --git a/gcc/configure.ac b/gcc/configure.ac
index d52104fbd41..7ea5c6fe51b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6438,7 +6438,7 @@ if test x"$dsymutil_flag" = x"yes"; then
   dsymutil_kind=LLVM
   dsymutil_vers=`echo $dsymutil_temp | sed 's/.*LLVM\ version\ 
\([[0-9\.]]*\).*/\1/'`
 else
-  dsymutil_kind=UNKNOWN
+  dsymutil_kind=DET_UNKNOWN
   dsymutil_vers="0.0"
 fi
 dsymutil_major=`expr "$dsymutil_vers" : '\([[0-9]]*\)'`


[gcc r11-11370] Darwin, debug : Switch to DWARF 3 or 4 when dsymutil supports it.

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:4805205720c5a3cd3997fb3d670f290856dba18d

commit r11-11370-g4805205720c5a3cd3997fb3d670f290856dba18d
Author: Iain Sandoe 
Date:   Sun Sep 17 15:56:07 2023 +0100

Darwin,debug : Switch to DWARF 3 or 4 when dsymutil supports it.

The main reason that Darwin has been using DWARF2 only as debug is that
earlier debug linkers (dsymutil) did not support any extensions to this
so that the default "non-strict" mode used in GCC would cause tool errors.

There are two sources for dsymutil, those based off a closed source base
"dwarfutils" and those based off LLVM.

For dsymutil versions based off LLVM-7+ we can use up to DWARF-4, and for
versions based on dwarfutils 121+ we can use DWARF-3.

Signed-off-by: Iain Sandoe 

gcc/ChangeLog:

* config/darwin-protos.h (enum darwin_external_toolchain): New.
* config/darwin.c (DSYMUTIL_VERSION): New.
(darwin_override_options): Choose the default debug DWARF version
depending on the configured dsymutil version.

(cherry picked from commit 47346acb72b50d178dae72393c851d57beec383f)

Diff:
---
 gcc/config/darwin-protos.h | 11 +++
 gcc/config/darwin.c| 33 +
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index f5ef82456aa..440e76ead42 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -129,4 +129,15 @@ extern void darwin_patch_builtins (void);
 extern void darwin_rename_builtins (void);
 extern bool darwin_libc_has_function (enum function_class fn_class, tree);
 
+/* For this port, there are several possible sources for external toolchain
+   components (e.g. as, ld, dsymutil) and we have to alter the allowable
+   output in response to which version and source is in use.  */
+enum darwin_external_toolchain {
+  DET_UNKNOWN=0,
+  CCTOOLS,
+  DWARFUTILS,
+  LLVM,
+  CLANG
+};
+
 #endif /* CONFIG_DARWIN_PROTOS_H */
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index db0e80889ab..e01460a996f 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -111,6 +111,19 @@ static bool ld_needs_eh_markers = false;
 /* Emit a section-start symbol for mod init and term sections.  */
 static bool ld_init_term_start_labels = false;
 
+/* The source and version of dsymutil in use.  */
+#ifndef DSYMUTIL_VERSION
+# warning Darwin toolchain without a defined dsymutil.
+# define DSYMUTIL_VERSION DET_UNKNOWN,0,0,0
+#endif
+
+struct {
+  darwin_external_toolchain kind; /* cctools, llvm, clang etc.  */
+  int major; /* version number.  */
+  int minor;
+  int tiny;
+} dsymutil_version = {DSYMUTIL_VERSION};
+
 /* Section names.  */
 section * darwin_sections[NUM_DARWIN_SECTIONS];
 
@@ -3316,14 +3329,26 @@ darwin_override_options (void)
  global_options.x_flag_objc_abi);
 }
 
-  /* Don't emit DWARF3/4 unless specifically selected.  This is a
- workaround for tool bugs.  */
+  /* Limit DWARF to the chosen version, the linker and debug linker might not
+ be able to consume newer structures.  */
   if (!global_options_set.x_dwarf_strict)
 dwarf_strict = 1;
+
   if (!global_options_set.x_dwarf_version)
-dwarf_version = 2;
+{
+  /* External toolchains based on LLVM or clang 7+ have support for
+dwarf-4.  */
+  if ((dsymutil_version.kind == LLVM && dsymutil_version.major >= 7)
+ || (dsymutil_version.kind == CLANG && dsymutil_version.major >= 7))
+   dwarf_version = 4;
+  else if (dsymutil_version.kind == DWARFUTILS
+  && dsymutil_version.major >= 121)
+   dwarf_version = 3;  /* From XC 6.4.  */
+  else
+   dwarf_version = 2;  /* Older cannot safely exceed dwarf-2.  */
+}
 
-  if (global_options_set.x_dwarf_split_debug_info)
+  if (global_options_set.x_dwarf_split_debug_info && dwarf_split_debug_info)
 {
   inform (input_location,
  "%<-gsplit-dwarf%> is not supported on this platform, ignored");


[gcc r11-11369] testsuite: adjust for darwin linker warning

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:12ce016bc52f88ebaa085f2af14854247570cca7

commit r11-11369-g12ce016bc52f88ebaa085f2af14854247570cca7
Author: Francois-Xavier Coudert 
Date:   Fri Sep 8 21:55:56 2023 +0200

testsuite: adjust for darwin linker warning

On recent macOS versions, no_pie is deprecated and the linker complains
about it: "-no_pie is deprecated when targeting new OS versions"

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-segaddr.c: Adjust for darwin linker warning.
* gcc.dg/pie-7.c: Likewise.

(cherry picked from commit d9926c0d974646dc6024d5a881fe1bee2f499139)

Diff:
---
 gcc/testsuite/gcc.dg/darwin-segaddr.c | 1 +
 gcc/testsuite/gcc.dg/pie-7.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/darwin-segaddr.c 
b/gcc/testsuite/gcc.dg/darwin-segaddr.c
index 526db77bd9c..77112ddb484 100644
--- a/gcc/testsuite/gcc.dg/darwin-segaddr.c
+++ b/gcc/testsuite/gcc.dg/darwin-segaddr.c
@@ -2,6 +2,7 @@
 /* { dg-do run { target *-*-darwin* } } */
 /* { dg-options "-O0 -segaddr __TEST 0x20 -fno-pie" { target { *-*-darwin* 
&& { ! lp64 } } } } */
 /* { dg-options "-O0 -segaddr __TEST 0x11000 -fno-pie" { target { 
*-*-darwin* && lp64 } } } */
+/* { dg-prune-output "-no_pie is deprecated when targeting new OS versions" } 
*/
 
 extern void abort ();
 
diff --git a/gcc/testsuite/gcc.dg/pie-7.c b/gcc/testsuite/gcc.dg/pie-7.c
index e118a98bafd..3879a6cc120 100644
--- a/gcc/testsuite/gcc.dg/pie-7.c
+++ b/gcc/testsuite/gcc.dg/pie-7.c
@@ -1,5 +1,6 @@
 /* { dg-do run { target pie } } */
 /* { dg-options "-fno-pie -no-pie" } */
+/* { dg-prune-output "-no_pie is deprecated when targeting new OS versions" } 
*/
 
 int main(void)
 {


[gcc r11-11368] Darwin, ppc: Add system stubs for all 32b PPC

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:7f93f55272b127257011f25937d4a39196322d2c

commit r11-11368-g7f93f55272b127257011f25937d4a39196322d2c
Author: Iain Sandoe 
Date:   Wed Jul 26 14:31:02 2023 +0100

Darwin, ppc: Add system stubs for all 32b PPC

This is a minor adjustment to make the GCC behaviour better match the
old system tools.

Signed-off-by: Iain Sandoe 

gcc/ChangeLog:

* config/rs6000/darwin.h (LIB_SPEC): Include libSystemStubs for
all 32b Darwin PowerPC cases.

(cherry picked from commit b3ab28c3e85af7995fffb87eb190ef942b7e9e4a)

Diff:
---
 gcc/config/rs6000/darwin.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 566794af706..e80dd7c77b6 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -98,7 +98,7 @@
Include libmx when targeting Darwin 7.0 and above, but before libSystem,
since the functions are actually in libSystem but for 7.x compatibility
we want them to be looked for in libmx first.
-   Include libSystemStubs when compiling against 10.3 - 10.5 SDKs (we assume
+   Include libSystemStubs when compiling against 10.3 - 10.6 SDKs (we assume
this is the case when targetting these) - but not for 64-bit long double.
Don't do either for m64, the library is either a dummy or non-existent.
 */
@@ -107,8 +107,8 @@
 #define LIB_SPEC \
 "%{!static:\
   %{!m64:%{!mlong-double-64:   \
-%{pg:%:version-compare(>< 10.3 10.5 mmacosx-version-min= 
-lSystemStubs_profile)} \
-%{!pg:%:version-compare(>< 10.3 10.5 mmacosx-version-min= -lSystemStubs)} \
+%{pg:%:version-compare(>< 10.3 10.7 mmacosx-version-min= 
-lSystemStubs_profile)} \
+%{!pg:%:version-compare(>< 10.3 10.7 mmacosx-version-min= -lSystemStubs)} \
  %:version-compare(>< 10.3 10.4 mmacosx-version-min= -lmx)}}   \
   -lSystem \
 }"


[gcc r11-11367] Darwin: Partial reversion of r14-3648 (Inits Section).

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:960ca4144ebb61d125f28fab17b57cd3b09b49fd

commit r11-11367-g960ca4144ebb61d125f28fab17b57cd3b09b49fd
Author: Iain Sandoe 
Date:   Sun Sep 10 14:48:42 2023 +0100

Darwin: Partial reversion of r14-3648 (Inits Section).

Although the Darwin ABI places both hot and cold partitions in the same
section (the linker can partition by name), this does not work with the
current dwarf2out implementation.

Since we do see global initialization code getting hot/cold splits, this
patch places the cold parts into text_cold, and keeps the hot part in
the correct Init section per ABI.

TODO: figure out a way to allow us to match the ABI fully.

gcc/ChangeLog:

* config/darwin.c (darwin_function_section): Place unlikely
executed global init code into the standard cold section.

Signed-off-by: Iain Sandoe 
(cherry picked from commit 5b33b364652866165431aef1810af1e890229c5e)

Diff:
---
 gcc/config/darwin.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index a3a7c509e36..db0e80889ab 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3848,19 +3848,22 @@ darwin_function_section (tree decl, enum node_frequency 
freq,
   if (decl && DECL_SECTION_NAME (decl) != NULL)
 return get_named_section (decl, NULL, 0);
 
+  /* We always put unlikely executed stuff in the cold section; we have to put
+ this ahead of the global init section, since partitioning within a section
+ breaks some assumptions made in the DWARF handling.  */
+  if (freq == NODE_FREQUENCY_UNLIKELY_EXECUTED)
+return (use_coal) ? darwin_sections[text_cold_coal_section]
+ : darwin_sections[text_cold_section];
+
   /* Intercept functions in global init; these are placed in separate sections.
- FIXME: there should be some neater way to do this.  */
+ FIXME: there should be some neater way to do this, FIXME we should be able
+ to partition within a section.  */
   if (DECL_NAME (decl)
   && (strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "_GLOBAL__sub_I", 
14) == 0
  || strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
 "__static_initialization_and_destruction", 39) == 0))
 return  darwin_sections[static_init_section];
 
-  /* We always put unlikely executed stuff in the cold section.  */
-  if (freq == NODE_FREQUENCY_UNLIKELY_EXECUTED)
-return (use_coal) ? darwin_sections[text_cold_coal_section]
- : darwin_sections[text_cold_section];
-
   /* If we have LTO *and* feedback information, then let LTO handle
  the function ordering, it makes a better job (for normal, hot,
  startup and exit - hence the bailout for cold above).  */


[gcc r11-11366] Darwin: Place global inits in the correct section.

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:084d0c427433d592e29247164b199c1f232f5c68

commit r11-11366-g084d0c427433d592e29247164b199c1f232f5c68
Author: Iain Sandoe 
Date:   Fri Sep 1 09:04:13 2023 +0100

Darwin: Place global inits in the correct section.

This handles placement of global initializers into __TEXT,__StaticInit as 
used
by other platform toolchains.

Signed-off-by: Iain Sandoe 

gcc/ChangeLog:

* config/darwin-sections.def (static_init_section): Add the
__TEXT,__StaticInit section.
* config/darwin.c (darwin_function_section): Use the static init
section for global initializers, to match other platform toolchains.

(cherry picked from commit 68dc3e94fd6bd395a8b343533485616dff3fc796)

Diff:
---
 gcc/config/darwin-sections.def | 2 ++
 gcc/config/darwin.c| 8 
 2 files changed, 10 insertions(+)

diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def
index ed9e058d1d1..dc4d0408a85 100644
--- a/gcc/config/darwin-sections.def
+++ b/gcc/config/darwin-sections.def
@@ -98,6 +98,8 @@ DEF_SECTION (mod_init_section, 0, ".mod_init_func", 0)
 DEF_SECTION (mod_term_section, 0, ".mod_term_func", 0)
 DEF_SECTION (constructor_section, 0, ".constructor", 0)
 DEF_SECTION (destructor_section, 0, ".destructor", 0)
+DEF_SECTION (static_init_section, SECTION_CODE,
+".section\t__TEXT,__StaticInit,regular,pure_instructions", 0)
 
 /* Objective-C ABI=0 (Original version) sections.  */
 DEF_SECTION (objc_class_section, 0, ".objc_class", 1)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index ddbd3943a1d..a3a7c509e36 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3848,6 +3848,14 @@ darwin_function_section (tree decl, enum node_frequency 
freq,
   if (decl && DECL_SECTION_NAME (decl) != NULL)
 return get_named_section (decl, NULL, 0);
 
+  /* Intercept functions in global init; these are placed in separate sections.
+ FIXME: there should be some neater way to do this.  */
+  if (DECL_NAME (decl)
+  && (strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "_GLOBAL__sub_I", 
14) == 0
+ || strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
+"__static_initialization_and_destruction", 39) == 0))
+return  darwin_sections[static_init_section];
+
   /* We always put unlikely executed stuff in the cold section.  */
   if (freq == NODE_FREQUENCY_UNLIKELY_EXECUTED)
 return (use_coal) ? darwin_sections[text_cold_coal_section]


[gcc r11-11365] Darwin: Match system sections and relocs for exception tables.

2024-04-25 Thread Iain D Sandoe via Gcc-cvs
https://gcc.gnu.org/g:9488ad0d780fae91afa910410cb4e6da8d607fd9

commit r11-11365-g9488ad0d780fae91afa910410cb4e6da8d607fd9
Author: Iain Sandoe 
Date:   Thu Aug 31 19:20:43 2023 +0100

Darwin: Match system sections and relocs for exception tables.

System tools from Darwin10 onwards have moved the exceptions tables from
the __DATA segment to the __TEXT one.  They also revised the relocations
used for typeinfo.  While Darwin9 was not changed at the time, in fact the
tools there are equally happy with the revised scheme - and therefore at
present there seems no reason to special-case it.

Signed-off-by: Iain Sandoe 

gcc/ChangeLog:

* config/darwin-sections.def (darwin_exception_section): Move to
the __TEXT segment.
* config/darwin.c (darwin_emit_except_table_label): Align before
the exception table label.
* config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use indirect PC-
relative 4byte relocs.

(cherry picked from commit 0fe7962afc7c01488432b98b6f442b24946a490d)

Diff:
---
 gcc/config/darwin-sections.def | 2 +-
 gcc/config/darwin.c| 1 +
 gcc/config/darwin.h| 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/config/darwin-sections.def b/gcc/config/darwin-sections.def
index 8be89624c9c..ed9e058d1d1 100644
--- a/gcc/config/darwin-sections.def
+++ b/gcc/config/darwin-sections.def
@@ -157,7 +157,7 @@ DEF_SECTION (machopic_picsymbol_stub3_section, 
SECTION_NO_ANCHOR,
 
 /* Exception-related.  */
 DEF_SECTION (darwin_exception_section, SECTION_NO_ANCHOR,
-".section __DATA,__gcc_except_tab", 0)
+".section __TEXT,__gcc_except_tab", 0)
 DEF_SECTION (darwin_eh_frame_section, SECTION_NO_ANCHOR,
 ".section " EH_FRAME_SECTION_NAME ",__eh_frame"
 EH_FRAME_SECTION_ATTR, 0)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 2371816e251..ddbd3943a1d 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2230,6 +2230,7 @@ darwin_emit_except_table_label (FILE *file)
 {
   char section_start_label[30];
 
+  fputs ("\t.p2align\t2\n", file);
   ASM_GENERATE_INTERNAL_LABEL (section_start_label, "GCC_except_table",
   except_table_label_num++);
   ASM_OUTPUT_LABEL (file, section_start_label);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 5be13293319..9cae0165ae9 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -1098,7 +1098,7 @@ enum machopic_addr_class {
 
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
-  (((CODE) == 2 && (GLOBAL) == 1) \
+  (((CODE) == 2 && (GLOBAL) == 1) || ((CODE) == 0 && (GLOBAL) == 1) \
? (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) : \
  ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)


[gcc r14-10135] bpf: set PREFERRED_DEBUGGING_TYPE to BTF_DEBUG

2024-04-25 Thread David Faust via Gcc-cvs
https://gcc.gnu.org/g:1604f7cebc49220e47d584615bcd91b1fdc1267f

commit r14-10135-g1604f7cebc49220e47d584615bcd91b1fdc1267f
Author: David Faust 
Date:   Wed Apr 24 15:01:02 2024 -0700

bpf: set PREFERRED_DEBUGGING_TYPE to BTF_DEBUG

BTF is the standard debug info used with BPF programs, so it makes sense
to default to BTF rather than DWARF.

gcc/
* config/bpf/bpf.h (PREFERRED_DEBUGGING_TYPE): Set to BTF_DEBUG.

gcc/testsuite/
* gcc.target/bpf/bpf-debug-options-1.c: New test.
* gcc.target/bpf/bpf-debug-options-2.c: Likewise.
* gcc.target/bpf/bpf-debug-options-3.c: Likewise.
* gcc.target/bpf/core-options-4.c: Likewise.

Diff:
---
 gcc/config/bpf/bpf.h   |  5 +
 gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c | 17 +
 gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c | 18 ++
 gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c | 14 ++
 gcc/testsuite/gcc.target/bpf/core-options-4.c  |  4 
 5 files changed, 58 insertions(+)

diff --git a/gcc/config/bpf/bpf.h b/gcc/config/bpf/bpf.h
index c67e17526bf..e163fbf688d 100644
--- a/gcc/config/bpf/bpf.h
+++ b/gcc/config/bpf/bpf.h
@@ -245,6 +245,11 @@ enum reg_class
 
 / Debugging Info /
 
+/* Use BTF debug info by default.  */
+
+#undef  PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE BTF_DEBUG
+
 /* In eBPF it is not possible to unwind frames. Disable CFA.  */
 
 #define DWARF2_FRAME_INFO 0
diff --git a/gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c 
b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c
new file mode 100644
index 000..409466c4ead
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-1.c
@@ -0,0 +1,17 @@
+/* Default to BTF debug info.  */
+/* { dg-do compile } */
+/* { dg-options "-g -dA" }*/
+
+struct A {
+  int x;
+  int y;
+};
+
+int
+foo (struct A *a)
+{
+  return a->x;
+}
+
+/* { dg-final { scan-assembler-not "DWARF version" } } */
+/* { dg-final { scan-assembler "btf_version" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c 
b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c
new file mode 100644
index 000..03bde12315b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-2.c
@@ -0,0 +1,18 @@
+/* -g defaults to BTF, which in turn implies -mco-re.  */
+/* { dg-do compile } */
+/* { dg-options "-g -dA" }*/
+
+struct A {
+  int x;
+  int y;
+};
+
+int
+foo (struct A *a)
+{
+  return __builtin_preserve_access_index (a->x);
+}
+
+/* { dg-final { scan-assembler-not "DWARF version" } } */
+/* { dg-final { scan-assembler "btf_version" } } */
+/* { dg-final { scan-assembler "btfext_version" } } */
diff --git a/gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c 
b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c
new file mode 100644
index 000..d41790e0928
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/bpf-debug-options-3.c
@@ -0,0 +1,14 @@
+/* Using -g does not incorrectly force CO-RE enabled.  */
+/* { dg-do compile } */
+/* { dg-options "-g -dA -mno-co-re" }*/
+
+struct A {
+  int x;
+  int y;
+};
+
+int
+foo (struct A *a)
+{
+  return __builtin_preserve_access_index (a->x); /* { dg-error "BPF CO-RE is 
required" } */
+}
diff --git a/gcc/testsuite/gcc.target/bpf/core-options-4.c 
b/gcc/testsuite/gcc.target/bpf/core-options-4.c
new file mode 100644
index 000..fde4195da42
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-options-4.c
@@ -0,0 +1,4 @@
+/* -g implies BTF, -gtoggle turns it off.  CO-RE should not work.  */
+/* { dg-do compile } */
+/* { dg-options "-g -mco-re -gtoggle" } */
+/* { dg-excess-errors "BPF CO-RE requires BTF debugging information" } */


[gcc r14-10134] c++: Fix constexpr evaluation of parameters passed by invisible reference [PR111284]

2024-04-25 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:f541757ba4632e204169dd08a5f10c782199af42

commit r14-10134-gf541757ba4632e204169dd08a5f10c782199af42
Author: Jakub Jelinek 
Date:   Thu Apr 25 20:45:04 2024 +0200

c++: Fix constexpr evaluation of parameters passed by invisible reference 
[PR111284]

My r9-6136 changes to make a copy of constexpr function bodies before
genericization modifies it broke the constant evaluation of non-POD
arguments passed by value.
In the callers such arguments are passed as reference to usually a
TARGET_EXPR, but on the callee side until genericization they are just
direct uses of a PARM_DECL with some class type.
In cxx_bind_parameters_in_call I've used convert_from_reference to
pretend it is passed by value and then cxx_eval_constant_expression
is called there and evaluates that as an rvalue, followed by
adjust_temp_type if the types don't match exactly (e.g. const Foo
argument and passing to it reference to Foo TARGET_EXPR).

The reason this doesn't work is that when the TARGET_EXPR in the caller
is constant initialized, this for it is the address of the TARGET_EXPR_SLOT,
but if the code later on pretends the PARM_DECL is just initialized to the
rvalue of the constant evaluation of the TARGET_EXPR, it is as if there
is a bitwise copy of the TARGET_EXPR to the callee, so this in the callee
is then address of the PARM_DECL in the callee.

The following patch attempts to fix that by constexpr evaluation of such
arguments in the caller as an lvalue instead of rvalue, and on the callee
side when seeing such a PARM_DECL, if we want an lvalue, lookup the value
(lvalue) saved in ctx->globals (if any), and if wanting an rvalue,
recursing with vc_prvalue on the looked up value (because it is there
as an lvalue, nor rvalue).

adjust_temp_type doesn't work for lvalues of non-scalarish types, for
such types it relies on changing the type of a CONSTRUCTOR, but on the
other side we know what we pass to the argument is addressable, so
the patch on type mismatch takes address of the argument value, casts
to reference to the desired type and dereferences it.

2024-04-25  Jakub Jelinek  

PR c++/111284
* constexpr.cc (cxx_bind_parameters_in_call): For PARM_DECLs with
TREE_ADDRESSABLE types use vc_glvalue rather than vc_prvalue for
cxx_eval_constant_expression and if it doesn't have the same
type as it should, cast the reference type to reference to type
before convert_from_reference and instead of adjust_temp_type
take address of the arg, cast to reference to type and then
convert_from_reference.
(cxx_eval_constant_expression) : For lval case
on parameters with TREE_ADDRESSABLE types lookup result in
ctx->globals if possible.  Otherwise if lookup in ctx->globals
was successful for parameter with TREE_ADDRESSABLE type,
recurse with vc_prvalue on the returned value.

* g++.dg/cpp1z/constexpr-111284.C: New test.
* g++.dg/cpp1y/constexpr-lifetime7.C: Expect one error on a 
different
line.

Diff:
---
 gcc/cp/constexpr.cc  | 44 ++--
 gcc/testsuite/g++.dg/cpp1y/constexpr-lifetime7.C |  2 +-
 gcc/testsuite/g++.dg/cpp1z/constexpr-111284.C| 19 ++
 3 files changed, 54 insertions(+), 11 deletions(-)

diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 2e83d24dfda..8078b31544d 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -1872,13 +1872,18 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, 
tree t, tree fun,
  x = build_address (x);
}
   if (TREE_ADDRESSABLE (type))
-   /* Undo convert_for_arg_passing work here.  */
-   x = convert_from_reference (x);
-  /* Normally we would strip a TARGET_EXPR in an initialization context
-such as this, but here we do the elision differently: we keep the
-TARGET_EXPR, and use its CONSTRUCTOR as the value of the parm.  */
-  arg = cxx_eval_constant_expression (ctx, x, vc_prvalue,
- non_constant_p, overflow_p);
+   {
+ /* Undo convert_for_arg_passing work here.  */
+ x = convert_from_reference (x);
+ arg = cxx_eval_constant_expression (ctx, x, vc_glvalue,
+ non_constant_p, overflow_p);
+   }
+  else
+   /* Normally we would strip a TARGET_EXPR in an initialization context
+  such as this, but here we do the elision differently: we keep the
+  TARGET_EXPR, and use its CONSTRUCTOR as the value of the parm.  */
+   arg = cxx_eval_constant_expression (ctx, x, vc_prvalue,
+   non_constant_p, overflow_p);
   /* Check we aren't dereferencing a 

[gcc r14-10133] libgcc: Don't use weakrefs for glibc 2.34

2024-04-25 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:fe02f6caac2d9b51ad311889e76ba0c484356ea1

commit r14-10133-gfe02f6caac2d9b51ad311889e76ba0c484356ea1
Author: Jakub Jelinek 
Date:   Thu Apr 25 20:43:13 2024 +0200

libgcc: Don't use weakrefs for glibc 2.34

glibc 2.34 and later doesn't have separate libpthread (libpthread.so.0 is a
dummy shared library with just some symbol versions for compatibility, but
all the pthread_* APIs are in libc.so.6).
So, we don't need to do the .weakref dances to check whether a program
has been linked with -lpthread or not, in dynamically linked apps those
will be always true anyway.
In -static linking, this fixes various issues people had when only linking
some parts of libpthread.a and getting weird crashes.  A hack for that was
what e.g. some Fedora glibcs used, where libpthread.a was a library
containing just one giant *.o file which had all the normal libpthread.a
*.o files linked with -r together.

libstdc++-v3 actually does something like this already since r10-10928,
the following patch is meant to fix it even for libgfortran, libobjc and
whatever else uses gthr.h.

2024-04-25  Jakub Jelinek  

* gthr.h (GTHREAD_USE_WEAK): Redefine to 0 for GLIBC 2.34 or later.

Diff:
---
 libgcc/gthr.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/libgcc/gthr.h b/libgcc/gthr.h
index 31c404250b8..53a5f0f7458 100644
--- a/libgcc/gthr.h
+++ b/libgcc/gthr.h
@@ -141,6 +141,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  
If not, see
 #define GTHREAD_USE_WEAK 0
 #endif
 
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2, 34)
+/* glibc 2.34 and later has all pthread_* APIs inside of libc,
+   no need to link separately with -lpthread.  */
+#undef GTHREAD_USE_WEAK
+#define GTHREAD_USE_WEAK 0
+#endif
+#endif
+
 #ifndef GTHREAD_USE_WEAK
 #define GTHREAD_USE_WEAK 1
 #endif


[gcc r14-10132] c++: Retry the aliasing of base/complete cdtor optimization at import_export_decl time [PR113208]

2024-04-25 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:c39654e7a431992773b48d61f804494b0d70855f

commit r14-10132-gc39654e7a431992773b48d61f804494b0d70855f
Author: Jakub Jelinek 
Date:   Thu Apr 25 20:37:10 2024 +0200

c++: Retry the aliasing of base/complete cdtor optimization at 
import_export_decl time [PR113208]

When expand_or_defer_fn is called at_eof time, it calls import_export_decl
and then maybe_clone_body, which uses DECL_ONE_ONLY and comdat name in a
couple of places to try to optimize cdtors which are known to have the
same body by making the complete cdtor an alias to base cdtor (and in
that case also uses *[CD]5* as comdat group name instead of the normal
comdat group names specific to each mangled name).
Now, this optimization depends on DECL_ONE_ONLY and DECL_INTERFACE_KNOWN,
maybe_clone_body and can_alias_cdtor use:
  if (DECL_ONE_ONLY (fn))
cgraph_node::get_create (clone)->set_comdat_group (cxx_comdat_group 
(clone));
...
  bool can_alias = can_alias_cdtor (fn);
...
  /* Tell cgraph if both ctors or both dtors are known to have
 the same body.  */
  if (can_alias
  && fns[0]
  && idx == 1
  && cgraph_node::get_create (fns[0])->create_same_body_alias
   (clone, fns[0]))
{
  alias = true;
  if (DECL_ONE_ONLY (fns[0]))
{
  /* For comdat base and complete cdtors put them
 into the same, *[CD]5* comdat group instead of
 *[CD][12]*.  */
  comdat_group = cdtor_comdat_group (fns[1], fns[0]);
  cgraph_node::get_create (fns[0])->set_comdat_group 
(comdat_group);
  if (symtab_node::get (clone)->same_comdat_group)
symtab_node::get (clone)->remove_from_same_comdat_group ();
  symtab_node::get (clone)->add_to_same_comdat_group
(symtab_node::get (fns[0]));
}
}
and
  /* Don't use aliases for weak/linkonce definitions unless we can put both
 symbols in the same COMDAT group.  */
  return (DECL_INTERFACE_KNOWN (fn)
  && (SUPPORTS_ONE_ONLY || !DECL_WEAK (fn))
  && (!DECL_ONE_ONLY (fn)
  || (HAVE_COMDAT_GROUP && DECL_WEAK (fn;
The following testcase regressed with Marek's r14-5979 change,
when pr113208_0.C is compiled where the ctor is marked constexpr,
we no longer perform this optimization, where
_ZN6vectorI12QualityValueEC2ERKS1_ was emitted in the
_ZN6vectorI12QualityValueEC5ERKS1_ comdat group and
_ZN6vectorI12QualityValueEC1ERKS1_ was made an alias to it,
instead we emit _ZN6vectorI12QualityValueEC2ERKS1_ in
_ZN6vectorI12QualityValueEC2ERKS1_ comdat group and the same
content _ZN6vectorI12QualityValueEC1ERKS1_ as separate symbol in
_ZN6vectorI12QualityValueEC1ERKS1_ comdat group.
Now, the linker seems to somehow cope with that, eventhough it
probably keeps both copies of the ctor, but seems LTO can't cope
with that and Honza doesn't know what it should do in that case
(linker decides that the prevailing symbol is
_ZN6vectorI12QualityValueEC2ERKS1_ (from the
_ZN6vectorI12QualityValueEC2ERKS1_ comdat group) and
_ZN6vectorI12QualityValueEC1ERKS1_ alias (from the other TU,
from _ZN6vectorI12QualityValueEC5ERKS1_ comdat group)).

Note, the case where some constructor is marked constexpr in one
TU and not in another one happens pretty often in libstdc++ when
one mixes -std= flags used to compile different compilation units.

The reason the optimization doesn't trigger when the constructor is
constexpr is that expand_or_defer_fn is called in that case much earlier
than when it is not constexpr; in the former case it is called when we
try to constant evaluate that constructor.  But DECL_INTERFACE_KNOWN
is false in that case and comdat_linkage hasn't been called either
(I think it is desirable, because comdat group is stored in the cgraph
node and am not sure it is a good idea to create cgraph nodes for
something that might not be needed later on at all), so maybe_clone_body
clones the bodies, but doesn't make them as aliases.

The following patch is an attempt to redo this optimization when
import_export_decl is called at_eof time on the base/complete cdtor
(or deleting dtor).  It will not do anything if maybe_clone_body
hasn't been called uyet (the TREE_ASM_WRITTEN check on the
DECL_MAYBE_IN_CHARGE_CDTOR_P), or when one or both of the base/complete
cdtors have been lowered already, or when maybe_clone_body called
maybe_thunk_body and it was successful.  Otherwise retries the
can_alias_cdtor check and makes the complete cdtor alias to the
base cdtor with adjustments to the comdat group.

2024-04-25  Jakub Jelinek  

 

[gcc r14-10131] bpf: avoid issues with CO-RE and -gtoggle

2024-04-25 Thread David Faust via Gcc-cvs
https://gcc.gnu.org/g:f175622d25e4146bb7450430831ec48615e6e4cb

commit r14-10131-gf175622d25e4146bb7450430831ec48615e6e4cb
Author: David Faust 
Date:   Thu Apr 25 09:31:14 2024 -0700

bpf: avoid issues with CO-RE and -gtoggle

Compiling a BPF program with CO-RE relocations (and BTF) while also
passing -gtoggle led to an inconsistent state where CO-RE support was
enabled but BTF would not be generated, and this was not caught by the
existing option parsing.  This led to an ICE when generating the CO-RE
relocation info, since BTF is required for CO-RE.

Update bpf_option_override to avoid this case, and add a few tests for
the interactions of these options.

gcc/
* config/bpf/bpf.cc (bpf_option_override): Improve handling of CO-RE
options to avoid issues with -gtoggle.

gcc/testsuite/
* gcc.target/bpf/core-options-1.c: New test.
* gcc.target/bpf/core-options-2.c: Likewise.
* gcc.target/bpf/core-options-3.c: Likewise.

Diff:
---
 gcc/config/bpf/bpf.cc |  7 +--
 gcc/testsuite/gcc.target/bpf/core-options-1.c | 15 +++
 gcc/testsuite/gcc.target/bpf/core-options-2.c | 14 ++
 gcc/testsuite/gcc.target/bpf/core-options-3.c |  5 +
 4 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index 98fb755bb8b..e6ea211a2c6 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -192,7 +192,8 @@ bpf_option_override (void)
   init_machine_status = bpf_init_machine_status;
 
   /* BPF CO-RE support requires BTF debug info generation.  */
-  if (TARGET_BPF_CORE && !btf_debuginfo_p ())
+  if (TARGET_BPF_CORE
+  && (!btf_debuginfo_p () || (debug_info_level < DINFO_LEVEL_NORMAL)))
 error ("BPF CO-RE requires BTF debugging information, use %<-gbtf%>");
 
   /* BPF applications always generate .BTF.ext.  */
@@ -215,7 +216,9 @@ bpf_option_override (void)
 
   /* -gbtf implies -mcore when using the BPF backend, unless -mno-co-re
  is specified.  */
-  if (btf_debuginfo_p () && !(target_flags_explicit & MASK_BPF_CORE))
+  if (btf_debuginfo_p ()
+  && (debug_info_level >= DINFO_LEVEL_NORMAL)
+  && !(target_flags_explicit & MASK_BPF_CORE))
 target_flags |= MASK_BPF_CORE;
 
   /* Determine available features from ISA setting (-mcpu=).  */
diff --git a/gcc/testsuite/gcc.target/bpf/core-options-1.c 
b/gcc/testsuite/gcc.target/bpf/core-options-1.c
new file mode 100644
index 000..7d8c677f239
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-options-1.c
@@ -0,0 +1,15 @@
+/* -gbtf for the BPF target should enable CO-RE support automatically.  */
+/* { dg-do compile } */
+/* { dg-options "-gbtf" } */
+
+struct A {
+  int x;
+  int y;
+  char c;
+};
+
+int
+foo (struct A *a) {
+  int y = __builtin_preserve_access_index (a->y);
+  return y;
+}
diff --git a/gcc/testsuite/gcc.target/bpf/core-options-2.c 
b/gcc/testsuite/gcc.target/bpf/core-options-2.c
new file mode 100644
index 000..8f466258e29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-options-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-gbtf -gtoggle" } */
+
+struct A {
+  int x;
+  int y;
+  char c;
+};
+
+int
+foo (struct A *a) {
+  int y = __builtin_preserve_access_index (a->y); /* { dg-error "BPF CO-RE is 
required" } */
+  return y;
+}
diff --git a/gcc/testsuite/gcc.target/bpf/core-options-3.c 
b/gcc/testsuite/gcc.target/bpf/core-options-3.c
new file mode 100644
index 000..ca32a7c4012
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bpf/core-options-3.c
@@ -0,0 +1,5 @@
+/* This combination of options tries to enable CO-RE without BTF, and should
+   produce an error.  */
+/* { dg-do compile } */
+/* { dg-options "-gbtf -gtoggle -mco-re" } */
+/* { dg-excess-errors "BPF CO-RE requires BTF debugging information" } */


[gcc r14-10130] openmp: Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_? to tree-nested decl copy [PR114825]

2024-04-25 Thread Jakub Jelinek via Gcc-cvs
https://gcc.gnu.org/g:14d48516e588ad2b35e2007b3970bdcb1b3f145c

commit r14-10130-g14d48516e588ad2b35e2007b3970bdcb1b3f145c
Author: Jakub Jelinek 
Date:   Thu Apr 25 20:09:35 2024 +0200

openmp: Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_? to tree-nested decl 
copy [PR114825]

tree-nested.cc creates in 2 spots artificial VAR_DECLs, one of them is used
both for debug info and OpenMP/OpenACC lowering purposes, the other solely 
for
OpenMP/OpenACC lowering purposes.
When the decls are used in OpenMP/OpenACC lowering, the OMP langhooks 
(mostly
Fortran, C just a little and C++ doesn't have nested functions) then inspect
the flags on the vars and based on that decide how to lower the 
corresponding
clauses.

Unfortunately we weren't copying DECL_LANG_SPECIFIC and DECL_LANG_FLAG_?, so
the langhooks made decisions on the default flags on those instead.
As the original decl isn't necessarily a VAR_DECL, could be e.g. PARM_DECL,
using copy_node wouldn't work properly, so this patch just copies those
flags in addition to other flags it was copying already.  And I've removed
code duplication by introducing a helper function which does copying common
to both uses.

2024-04-25  Jakub Jelinek  

PR fortran/114825
* tree-nested.cc (get_debug_decl): New function.
(get_nonlocal_debug_decl): Use it.
(get_local_debug_decl): Likewise.

* gfortran.dg/gomp/pr114825.f90: New test.

Diff:
---
 gcc/testsuite/gfortran.dg/gomp/pr114825.f90 | 16 
 gcc/tree-nested.cc  | 61 -
 2 files changed, 49 insertions(+), 28 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/gomp/pr114825.f90 
b/gcc/testsuite/gfortran.dg/gomp/pr114825.f90
new file mode 100644
index 000..b635476af61
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr114825.f90
@@ -0,0 +1,16 @@
+! PR fortran/114825
+
+subroutine pr114825(b)
+  type t
+real, allocatable :: m(:)
+  end type t
+  type(t), allocatable, target :: b(:)
+  type(t), pointer :: d
+  !$omp parallel private(d)
+  d => b(1)
+  !$omp end parallel
+contains
+  subroutine sub
+d => b(1)
+  end subroutine sub
+end subroutine pr114825
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index c8f07f78185..4e5f3be7676 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -1047,6 +1047,37 @@ get_frame_field (struct nesting_info *info, tree 
target_context,
 
 static void note_nonlocal_vla_type (struct nesting_info *info, tree type);
 
+/* Helper for get_nonlocal_debug_decl and get_local_debug_decl.  */
+
+static tree
+get_debug_decl (tree decl)
+{
+  tree new_decl
+= build_decl (DECL_SOURCE_LOCATION (decl),
+ VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+  DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
+  DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
+  TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
+  TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
+  TREE_READONLY (new_decl) = TREE_READONLY (decl);
+  TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
+  DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
+  if ((TREE_CODE (decl) == PARM_DECL
+   || TREE_CODE (decl) == RESULT_DECL
+   || VAR_P (decl))
+  && DECL_BY_REFERENCE (decl))
+DECL_BY_REFERENCE (new_decl) = 1;
+  /* Copy DECL_LANG_SPECIFIC and DECL_LANG_FLAG_* for OpenMP langhook
+ purposes.  */
+  DECL_LANG_SPECIFIC (new_decl) = DECL_LANG_SPECIFIC (decl);
+#define COPY_DLF(n) DECL_LANG_FLAG_##n (new_decl) = DECL_LANG_FLAG_##n (decl)
+  COPY_DLF (0); COPY_DLF (1); COPY_DLF (2); COPY_DLF (3);
+  COPY_DLF (4); COPY_DLF (5); COPY_DLF (6); COPY_DLF (7);
+  COPY_DLF (8);
+#undef COPY_DLF
+  return new_decl;
+}
+
 /* A subroutine of convert_nonlocal_reference_op.  Create a local variable
in the nested function with DECL_VALUE_EXPR set to reference the true
variable in the parent function.  This is used both for debug info
@@ -1094,21 +1125,8 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree 
decl)
 x = build_simple_mem_ref_notrap (x);
 
   /* ??? We should be remapping types as well, surely.  */
-  new_decl = build_decl (DECL_SOURCE_LOCATION (decl),
-VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
+  new_decl = get_debug_decl (decl);
   DECL_CONTEXT (new_decl) = info->context;
-  DECL_ARTIFICIAL (new_decl) = DECL_ARTIFICIAL (decl);
-  DECL_IGNORED_P (new_decl) = DECL_IGNORED_P (decl);
-  TREE_THIS_VOLATILE (new_decl) = TREE_THIS_VOLATILE (decl);
-  TREE_SIDE_EFFECTS (new_decl) = TREE_SIDE_EFFECTS (decl);
-  TREE_READONLY (new_decl) = TREE_READONLY (decl);
-  TREE_ADDRESSABLE (new_decl) = TREE_ADDRESSABLE (decl);
-  DECL_SEEN_IN_BIND_EXPR_P (new_decl) = 1;
-  if ((TREE_CODE (decl) == PARM_DECL
-   || TREE_CODE (decl) == RESULT_DECL
-   || VAR_P (decl))
-  && DECL_BY_REFERENCE (decl))
-DECL_BY_REFERENCE (new_decl) 

[gcc r13-8649] libstdc++: Add libstdc++_libbacktrace.a to libstdc++exp

2024-04-25 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:f3cff718df0cf7590ccf9bc1d8cd17e4e08f1e6d

commit r13-8649-gf3cff718df0cf7590ccf9bc1d8cd17e4e08f1e6d
Author: Jonathan Wakely 
Date:   Thu Apr 18 17:26:55 2024 +0100

libstdc++: Add libstdc++_libbacktrace.a to libstdc++exp

This completes the fixes to put all experimental symbols into
libstdc++exp.a.

On trunk the libstdc++_libbacktrace.a was removed completely and its
contents aded to libstdc++exp.a instead. We don't want to remove it on
the gcc-13 branch because that would break makefiles using it. We can
add the contents to libstdc++exp.a and then install a symlink so that
using -lstdc++_libbacktrace still works, but links to libstdc++exp.a
instead.

The libstdc++_libbacktrace.la libtool control file is removed by this
change, because I'm pretty sure it's not actually useful, and I don't
know whether it should be a symlink to libstdc++exp.la or a regular file
that refers to libstdc++_libbacktrace.a.

libstdc++-v3/ChangeLog:

* src/experimental/Makefile.am (install-exec-local): New target.
(uninstall-local): New target.
* src/experimental/Makefile.in: Regenerate.
* src/libbacktrace/Makefile.am: Build libstdc++_libbacktrace as
noinst_LTLIBRARIES so it's only a convenience library.
* src/libbacktrace/Makefile.in: Regenerate.

Diff:
---
 libstdc++-v3/src/experimental/Makefile.am |  9 
 libstdc++-v3/src/experimental/Makefile.in | 29 +++
 libstdc++-v3/src/libbacktrace/Makefile.am |  2 +-
 libstdc++-v3/src/libbacktrace/Makefile.in | 86 ++-
 4 files changed, 44 insertions(+), 82 deletions(-)

diff --git a/libstdc++-v3/src/experimental/Makefile.am 
b/libstdc++-v3/src/experimental/Makefile.am
index c5a38d882c2..6536e759abd 100644
--- a/libstdc++-v3/src/experimental/Makefile.am
+++ b/libstdc++-v3/src/experimental/Makefile.am
@@ -66,6 +66,15 @@ AM_CXXFLAGS = \
 AM_MAKEFLAGS = \
"gxx_include_dir=$(gxx_include_dir)"
 
+if ENABLE_BACKTRACE
+install-exec-local:
+   -cd '$(DESTDIR)$(toolexeclibdir)' && \
+   $(LN_S) libstdc++exp.a libstdc++_libbacktrace.a
+uninstall-local:
+   -cd '$(DESTDIR)$(toolexeclibdir)' && \
+   rm -f libstdc++_libbacktrace.a
+endif
+
 # Libtool notes
 
 # 1) In general, libtool expects an argument such as `--tag=CXX' when
diff --git a/libstdc++-v3/src/experimental/Makefile.in 
b/libstdc++-v3/src/experimental/Makefile.in
index c16083a7fc8..238c96d9f9a 100644
--- a/libstdc++-v3/src/experimental/Makefile.in
+++ b/libstdc++-v3/src/experimental/Makefile.in
@@ -712,6 +712,8 @@ distclean-generic:
 maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+@ENABLE_BACKTRACE_FALSE@install-exec-local:
+@ENABLE_BACKTRACE_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
@@ -740,7 +742,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am: install-toolexeclibLTLIBRARIES
+install-exec-am: install-exec-local install-toolexeclibLTLIBRARIES
 
 install-html: install-html-am
 
@@ -779,7 +781,7 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-local uninstall-toolexeclibLTLIBRARIES
 
 .MAKE: install-am install-strip
 
@@ -789,18 +791,25 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
distclean-libtool distclean-tags dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
-   install-html install-html-am install-info install-info-am \
-   install-man install-pdf install-pdf-am install-ps \
-   install-ps-am install-strip install-toolexeclibLTLIBRARIES \
-   installcheck installcheck-am installdirs maintainer-clean \
-   maintainer-clean-generic mostlyclean mostlyclean-compile \
-   mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-   tags tags-am uninstall uninstall-am \
-   uninstall-toolexeclibLTLIBRARIES
+   install-exec-local install-html install-html-am install-info \
+   install-info-am install-man install-pdf install-pdf-am \
+   install-ps install-ps-am install-strip \
+   install-toolexeclibLTLIBRARIES installcheck installcheck-am \
+   installdirs maintainer-clean maintainer-clean-generic \
+   mostlyclean mostlyclean-compile mostlyclean-generic \
+   mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+   uninstall-am uninstall-local uninstall-toolexeclibLTLIBRARIES
 
 .PRECIOUS: Makefile
 
 
+@ENABLE_BACKTRACE_TRUE@install-exec-local:
+@ENABLE_BACKTRACE_TRUE@-cd '$(DESTDIR)$(toolexeclibdir)' && \
+@ENABLE_BACKTRACE_TRUE@$(LN_S) libstdc++exp.a libstdc++_libbacktrace.a
+@ENABLE_BACKTRACE_TRUE@uninstall-local:

[gcc r14-10129] libstdc++: Rename man pages to use '::' instead of '_'

2024-04-25 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:8d80e3c5a641556e32fdf3637f08a0648f5aaab3

commit r14-10129-g8d80e3c5a641556e32fdf3637f08a0648f5aaab3
Author: Jonathan Wakely 
Date:   Thu Apr 25 14:02:36 2024 +0100

libstdc++: Rename man pages to use '::' instead of '_'

The Doxygen-generated man pages for some new types need to be renamed to
use '::' instead of '_' in the filenames.

libstdc++-v3/ChangeLog:

* scripts/run_doxygen: Rename man pages for nested types.

Diff:
---
 libstdc++-v3/scripts/run_doxygen | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen
index ea9bcb56553..11f24b058af 100644
--- a/libstdc++-v3/scripts/run_doxygen
+++ b/libstdc++-v3/scripts/run_doxygen
@@ -415,8 +415,21 @@ for f in __cxxabiv1_*; do
 mv $f $newname
 done
 
+mv std::__unspecified___exception_ptr.3 std::exception_ptr.3
+
 # Then piecemeal nested classes
 
+for f in std*distribution_param_type.3; do
+newname=`echo $f | sed 
's/distribution_param_type/distribution::param_type/'`
+mv $f $newname
+done
+
+for f in std*filesystem::path_iterator.3; do
+newname=`echo $f | sed 's/path_iterator/path::iterator/'`
+mv $f $newname
+done
+
+mv std::chrono::tzdb_list_const_iterator.3 
std::chrono::tzdb_list::const_iterator.3
 
 # Generic removal bits, where there are things in the generated man
 # pages that need to be killed.


[gcc r14-10128] libstdc++: Fix typo in Doxygen comment

2024-04-25 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:6391cf8bd9c1d71805d9aba00b25fdaa550f39c8

commit r14-10128-g6391cf8bd9c1d71805d9aba00b25fdaa550f39c8
Author: Jonathan Wakely 
Date:   Thu Apr 25 13:52:00 2024 +0100

libstdc++: Fix typo in Doxygen comment

libstdc++-v3/ChangeLog:

* include/std/chrono (tzdb_list): Fix typo in Doxygen comment.

Diff:
---
 libstdc++-v3/include/std/chrono | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 3a9751781d2..b0aadf83b03 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -2780,7 +2780,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /** Remove the tzdb object _after_ the one the iterator refers to.
*
-   * Calling this function concurently with any of `front()`, `begin()`,
+   * Calling this function concurrently with any of `front()`, `begin()`,
* or `end()` does not cause a data race, but in general this function
* is not thread-safe. The behaviour may be undefined if erasing an
* element from the list while another thread is calling the same


[gcc r14-10127] libstdc++: Fix run_doxygen for Doxygen 1.10 man page format

2024-04-25 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:c9cc1c850c6d084752207b6cf247a0a48bae0d52

commit r14-10127-gc9cc1c850c6d084752207b6cf247a0a48bae0d52
Author: Jonathan Wakely 
Date:   Thu Apr 25 13:24:56 2024 +0100

libstdc++: Fix run_doxygen for Doxygen 1.10 man page format

Doxygen switched from \fC to \fR in its man page output:
https://github.com/doxygen/doxygen/pull/10497

This breaks our script that expects \fC so change the regaulr expression
to work with either style.

libstdc++-v3/ChangeLog:

* scripts/run_doxygen: Adjust sed pattern to match '\fR' for
new man output that Doxygen 1.10 generates.

Diff:
---
 libstdc++-v3/scripts/run_doxygen | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen
index fbd601b11cc..ea9bcb56553 100644
--- a/libstdc++-v3/scripts/run_doxygen
+++ b/libstdc++-v3/scripts/run_doxygen
@@ -294,7 +294,11 @@ $gxx $cppflags $cxxflags 
${srcdir}/doc/doxygen/stdheader.cc -o ./stdheader || ex
 problematic=`grep -E -l '#include <.*h>' [a-z]*.3`
 for f in $problematic; do
 # this is also slow, but safe and easy to debug
-oldh=`sed -n '/fC#include .*/\1/p' $f`
+oldh=`sed -n '/f[CR]#include .*/\1/p' $f`
+if [ "$oldh" == "" ]; then
+  echo "ERROR: Doxygen man page formatting changed" 2>&1
+  continue
+fi
 newh=`echo $oldh | sed 's/&\\././g' | ./stdheader`
 sed "s=${oldh/\\/.}=${newh}=" $f > TEMP && mv TEMP $f
 done


[gcc r14-10126] libstdc++: Update Doxygen config for new headers

2024-04-25 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:d5b2c6b32c97e1fd03214771d35f8d67b0d72940

commit r14-10126-gd5b2c6b32c97e1fd03214771d35f8d67b0d72940
Author: Jonathan Wakely 
Date:   Thu Apr 25 13:09:27 2024 +0100

libstdc++: Update Doxygen config for new headers

libstdc++-v3/ChangeLog:

* doc/doxygen/stdheader.cc (init_map): Add missing headers.
* doc/doxygen/user.cfg.in (EXCLUDE): Exclude generated files for
std::format and std::text_encoding.

Diff:
---
 libstdc++-v3/doc/doxygen/stdheader.cc | 42 ++-
 libstdc++-v3/doc/doxygen/user.cfg.in  |  6 +
 2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/libstdc++-v3/doc/doxygen/stdheader.cc 
b/libstdc++-v3/doc/doxygen/stdheader.cc
index 67f54eef02b..3ee825feb66 100644
--- a/libstdc++-v3/doc/doxygen/stdheader.cc
+++ b/libstdc++-v3/doc/doxygen/stdheader.cc
@@ -40,19 +40,25 @@ void init_map()
 headers["ranges_algo.h"]= "algorithm";
 headers["ranges_algobase.h"]= "algorithm";
 headers["heap.h"]   = "algorithm";
+headers["chrono_io.h"]  = "chrono";
+headers["parse_numbers.h"]  = "chrono";
 headers["exception_ptr.h"]  = "exception";
 headers["nested_exception.h"]   = "exception";
 headers["fs_dir.h"] = "filesystem";
 headers["fs_fwd.h"] = "filesystem";
 headers["fs_ops.h"] = "filesystem";
 headers["fs_path.h"]= "filesystem";
+headers["unicode.h"]= "format";
+headers["unicode-data.h"]   = "format";
 headers["binders.h"]= "functional";
 headers["function.h"]   = "functional";
 headers["functional_hash.h"]= "functional";
 headers["mofunc_impl.h"]= "functional";
 headers["move_only_function.h"] = "functional";
 headers["invoke.h"] = "functional";
+headers["ranges_cmp.h"] = "functional";
 headers["refwrap.h"]= "functional";
+headers["elements_of.h"]= "generator";
 headers["quoted_string.h"]  = "iomanip";
 headers["ios_base.h"]   = "ios";
 headers["basic_ios.h"]  = "ios";
@@ -64,6 +70,7 @@ void init_map()
 headers["stream_iterator.h"]= "iterator";
 headers["streambuf_iterator.h"] = "iterator";
 headers["iterator_concepts.h"]  = "iterator";
+headers["max_size_type.h"]  = "iterator";
 headers["range_access.h"]   = "iterator";
 headers["codecvt.h"]= "locale";
 headers["c++locale.h"]  = "locale";
@@ -80,9 +87,11 @@ void init_map()
 headers["memoryfwd.h"]  = "memory";
 headers["align.h"]  = "memory";
 headers["alloc_traits.h"]   = "memory";
+headers["allocated_ptr.h"]  = "memory";
 headers["auto_ptr.h"]  = "memory";
 headers["construct.h"]  = "memory";
 headers["allocator.h"]  = "memory";
+headers["new_allocator.h"]  = "memory";
 headers["raw_storage_iter.h"]   = "memory";
 headers["tempbuf.h"]= "memory";
 headers["uninitialized.h"]  = "memory";
@@ -94,11 +103,15 @@ void init_map()
 headers["ptr_traits.h"] = "memory";
 headers["uses_allocator.h"] = "memory";
 headers["uses_allocator_args.h"]= "memory";
+headers["out_ptr.h"]= "memory";
+headers["memory_resource.h"]= "memory_resource";
 headers["unique_lock.h"]= "mutex";
+headers["sat_arith.h"]  = "numeric";
+headers["ostream_insert.h"] = "ostream";
 headers["uniform_int_dist.h"]   = "random";
 headers["ranges_base.h"]= "ranges";
+headers["ranges_to.h"]  = "ranges";
 headers["ranges_util.h"]= "ranges";
-headers["ranges_cmp.h"] = "functional";
 headers["regex_automaton.h"]= "regex";
 headers["regex_automaton.tcc"]  = "regex";
 headers["regex_compiler.h"] = "regex";
@@ -122,6 +135,9 @@ void init_map()
 headers["string_view.tcc"]  = "string_view";
 headers["this_thread_sleep.h"]  = "thread";
 headers["tree.h"]   = "map";
+headers["hashtable.h"]  = "unordered_map";
+headers["hashtable_policy.h"]   = "unordered_map";
+headers["move.h"]   = "utility";
 headers["pair.h"]   = "utility";
 headers["relops.h"] = "utility";
 headers["gslice.h"] = "valarray";
@@ -142,30 +158,34 @@ void init_map()
 headers["abs.h"]= "cstdlib";
 headers["specfun.h"]= "cmath";
 
-// This list is complete as of the October 2021 working draft.
+// This 

[gcc r14-10125] libstdc++: Add comment to #include in

2024-04-25 Thread Jonathan Wakely via Libstdc++-cvs
https://gcc.gnu.org/g:f3021e6e0600bedd69567b21d2a06b0b9854c533

commit r14-10125-gf3021e6e0600bedd69567b21d2a06b0b9854c533
Author: Jonathan Wakely 
Date:   Thu Apr 25 13:04:43 2024 +0100

libstdc++: Add comment to #include in 

It's not obvious why  needs  so add a
comment to it.

libstdc++-v3/ChangeLog:

* include/std/variant: Add comment to #include.

Diff:
---
 libstdc++-v3/include/std/variant | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index f79d95db7a8..748e9bae1cb 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -42,7 +42,7 @@
 #include 
 #include 
 #include 
-#include 
+#include  // _Select_int
 #include 
 #include 
 #include  // in_place_index_t


gcc-wwwdocs branch master updated. 688a21c3093f0d3dbf7248066b5c9c00802bdf89

2024-04-25 Thread Eric Botcazou via Gcc-cvs-wwwdocs
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gcc-wwwdocs".

The branch, master has been updated
   via  688a21c3093f0d3dbf7248066b5c9c00802bdf89 (commit)
  from  215f3f4f7d8ad162a9a3f5e48b475d82ee4cfb3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 688a21c3093f0d3dbf7248066b5c9c00802bdf89
Author: Eric Botcazou 
Date:   Thu Apr 25 19:37:27 2024 +0200

gcc-14/changes.html: Add SPARC section and fix syntax error

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index f0f0efe0..83b1016c 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -136,7 +136,7 @@ a work-in-progress.
int foo (int n)
{
  int res = 0;
- for (int i = 0; i < n; i++)
+ for (int i = 0; i  n; i++)
{
   y[i] = x[i] * 2;
   res += x[i] + y[i];
@@ -1212,7 +1212,17 @@ __asm (".global __flmap_lock"  "\n\t"
 
 
 
-
+SPARC
+
+
+  
+The implementation of calling conventions for small structures containing
+arrays of floating-point components has been changed in 64-bit mode for
+the Solaris port to match the implementation of the vendor compiler (and
+the ABI). As a result, the code generated will not be binary compatible
+with earlier releases in these cases.
+  
+
 
 
 

---

Summary of changes:
 htdocs/gcc-14/changes.html | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gcc-wwwdocs


[gcc r14-10124] PR modula2/114836 Avoid concatenation of error strings to aid error locale translation

2024-04-25 Thread Gaius Mulley via Gcc-cvs
https://gcc.gnu.org/g:d0e1e1291b10372d71ad3d6cb66b333ea91097e7

commit r14-10124-gd0e1e1291b10372d71ad3d6cb66b333ea91097e7
Author: Gaius Mulley 
Date:   Thu Apr 25 18:31:55 2024 +0100

PR modula2/114836 Avoid concatenation of error strings to aid error locale 
translation

This patch avoids a concatenation of error strings making locale
translation of the error message easier.

gcc/m2/ChangeLog:

PR modula2/114836
* gm2-compiler/M2Range.mod (FoldTypeAssign): Avoid error
string concatenation.

Signed-off-by: Gaius Mulley 

Diff:
---
 gcc/m2/gm2-compiler/M2Range.mod | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index 7686620a247..a8e572eff50 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -1706,20 +1706,17 @@ BEGIN
THEN
   (* Expression type compatibility rules for pass by reference parameters. 
 *)
   compatible := ParameterTypeCompatible (tokenNo,
- '{%4EN} parameter failure due to 
expression incompatibility ' +
- 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ '{%4EN} parameter failure due to 
expression incompatibility between actual parameter {%3ad} and the {%4N} formal 
{%2ad} parameter in procedure {%1ad}',
  procedure, formal, actual, 
paramNo, TRUE)
ELSIF GetPIM ()
THEN
   (* Assignment type compatibility rules for pass by value PIM parameters. 
 *)
   compatible := ParameterTypeCompatible (tokenNo,
- '{%4EN} parameter failure due to 
assignment incompatibility ' +
- 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ '{%4EN} parameter failure due to 
assignment incompatibility between actual parameter {%3ad} and the {%4N} formal 
{%2ad} parameter in procedure {%1ad}',
  procedure, formal, actual, 
paramNo, FALSE)
ELSE
   compatible := ParameterTypeCompatible (tokenNo,
- '{%4EN} parameter failure due to 
parameter incompatibility ' +
- 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ '{%4EN} parameter failure due to 
parameter incompatibility between actual parameter {%3ad} and the {%4N} formal 
{%2ad} parameter in procedure {%1ad}',
  procedure, formal, actual, 
paramNo, FALSE)
END ;
IF compatible


[gcc r13-8648] libstdc++: Fix libstdc++exp.a so it really does contain Filesystem TS symbols

2024-04-25 Thread Jonathan Wakely via Gcc-cvs
https://gcc.gnu.org/g:9c49ab21b5df71cf5e397dfe0f7b97765300ec45

commit r13-8648-g9c49ab21b5df71cf5e397dfe0f7b97765300ec45
Author: Jonathan Wakely 
Date:   Fri Feb 2 12:07:09 2024 +

libstdc++: Fix libstdc++exp.a so it really does contain Filesystem TS 
symbols

In r14-3812-gb96b554592c5cb I claimed that libstdc++exp.a now contains
all the symbols from libstdc++fs.a as well as libstdc++_libbacktrace.a,
but that wasn't true. Only the symbols from the latter were added to
libstdc++exp.a, the Filesystem TS ones weren't. This seems to be because
libtool won't combine static libs that are going to be installed
separately. Because libstdc++fs.a is still installed, libtool decides it
shouldn't be included in libstdc++exp.a.

The solution is similar to what we already do for libsupc++.a: build two
static libs, libstdc++fs.a and libstdc++fsconvenience.a, where the
former is installed and the latter isn't. If we then tell libtool to
include the latter in libstdc++exp.a it will do as it's told.

libstdc++-v3/ChangeLog:

* src/experimental/Makefile.am: Use libstdc++fsconvenience.a
instead of libstdc++fs.a.
* src/experimental/Makefile.in: Regenerate.
* src/filesystem/Makefile.am: Build libstdc++fsconvenience.a as
well.
* src/filesystem/Makefile.in: Regenerate.

(cherry picked from commit abf40d2953639534af3428424f467adf3cb52177)

Diff:
---
 libstdc++-v3/src/experimental/Makefile.am |  2 +-
 libstdc++-v3/src/experimental/Makefile.in |  4 ++--
 libstdc++-v3/src/filesystem/Makefile.am   |  4 
 libstdc++-v3/src/filesystem/Makefile.in   | 37 ++-
 4 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/src/experimental/Makefile.am 
b/libstdc++-v3/src/experimental/Makefile.am
index 1c7cea7e846..c5a38d882c2 100644
--- a/libstdc++-v3/src/experimental/Makefile.am
+++ b/libstdc++-v3/src/experimental/Makefile.am
@@ -25,7 +25,7 @@ include $(top_srcdir)/fragment.am
 toolexeclib_LTLIBRARIES = libstdc++exp.la
 
 if ENABLE_FILESYSTEM_TS
-filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fs.la
+filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fsconvenience.la
 else
 filesystem_lib =
 endif
diff --git a/libstdc++-v3/src/experimental/Makefile.in 
b/libstdc++-v3/src/experimental/Makefile.in
index 6f6b742c1cf..c16083a7fc8 100644
--- a/libstdc++-v3/src/experimental/Makefile.in
+++ b/libstdc++-v3/src/experimental/Makefile.in
@@ -148,7 +148,7 @@ am__uninstall_files_from_dir = { \
   }
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
-@ENABLE_FILESYSTEM_TS_TRUE@am__DEPENDENCIES_1 = 
$(top_builddir)/src/filesystem/libstdc++fs.la
+@ENABLE_FILESYSTEM_TS_TRUE@am__DEPENDENCIES_1 = 
$(top_builddir)/src/filesystem/libstdc++fsconvenience.la
 @ENABLE_BACKTRACE_TRUE@am__DEPENDENCIES_2 = 
$(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la
 am__objects_1 = contract.lo
 am_libstdc__exp_la_OBJECTS = $(am__objects_1)
@@ -450,7 +450,7 @@ WARN_CXXFLAGS = \
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
 toolexeclib_LTLIBRARIES = libstdc++exp.la
 @ENABLE_FILESYSTEM_TS_FALSE@filesystem_lib = 
-@ENABLE_FILESYSTEM_TS_TRUE@filesystem_lib = 
$(top_builddir)/src/filesystem/libstdc++fs.la
+@ENABLE_FILESYSTEM_TS_TRUE@filesystem_lib = 
$(top_builddir)/src/filesystem/libstdc++fsconvenience.la
 @ENABLE_BACKTRACE_FALSE@backtrace_lib = 
 @ENABLE_BACKTRACE_TRUE@backtrace_lib = 
$(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la
 headers = 
diff --git a/libstdc++-v3/src/filesystem/Makefile.am 
b/libstdc++-v3/src/filesystem/Makefile.am
index d2e1fde3f13..55f309b5c15 100644
--- a/libstdc++-v3/src/filesystem/Makefile.am
+++ b/libstdc++-v3/src/filesystem/Makefile.am
@@ -22,7 +22,10 @@
 
 include $(top_srcdir)/fragment.am
 
+# Separate libstdc++fs.a to be installed.
 toolexeclib_LTLIBRARIES = libstdc++fs.la
+# Duplicate lib that is to be part of libstdc++exp.a
+noinst_LTLIBRARIES = libstdc++fsconvenience.la
 
 headers =
 
@@ -44,6 +47,7 @@ sources = \
 # vpath % $(top_srcdir)/src/filesystem
 
 libstdc__fs_la_SOURCES = $(sources)
+libstdc__fsconvenience_la_SOURCES = $(sources)
 
 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
 # modified in a per-library or per-sub-library way.  Need to manually
diff --git a/libstdc++-v3/src/filesystem/Makefile.in 
b/libstdc++-v3/src/filesystem/Makefile.in
index 852390ec1a9..76ba905087b 100644
--- a/libstdc++-v3/src/filesystem/Makefile.in
+++ b/libstdc++-v3/src/filesystem/Makefile.in
@@ -147,7 +147,7 @@ am__uninstall_files_from_dir = { \
  $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
-LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 libstdc__fs_la_LIBADD =
 @ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-dir.lo cow-ops.lo \
 @ENABLE_DUAL_ABI_TRUE@ 

[gcc r14-10123] bpf: default to using pseudo-C assembly syntax by default

2024-04-25 Thread Jose E. Marchesi via Gcc-cvs
https://gcc.gnu.org/g:c96c2a304b4a98116520cce497fbf5bab7465f23

commit r14-10123-gc96c2a304b4a98116520cce497fbf5bab7465f23
Author: Jose E. Marchesi 
Date:   Thu Apr 25 16:53:49 2024 +0200

bpf: default to using pseudo-C assembly syntax by default

At this point the kernel headers that almost all BPF programs use
contain pseudo-C inline assembly and having the GNU toolchain using
the conventional assembly syntax by default would force users to
specify the command-line option explicitly almost all of the time,
which is very inconvenient.

This patch changes GCC in order to recognize and generate the pseudo-C
assembly syntax of BPF by default.  The ASM_SPEC is adapted
accordingly, and in a way that the current release of the BPF
assembler (which still expects conventional assembler syntax by
default) does the right thing.

Tested in bpf-unknown-none-bpf target and x86_64-linux-gnu host.
No regressions.

gcc/ChangeLog

* config/bpf/bpf.opt: Use ASM_PSEUDOC for the default value of
-masm.
* config/bpf/bpf.h (ASM_SPEC): Adapt accordingly.
* doc/invoke.texi (eBPF Options): Update.

gcc/testsuite/ChangeLog

* gcc.target/bpf/alu-1.c: Specify conventional asm dialect.
* gcc.target/bpf/xbpf-indirect-call-1.c: Likewise.
* gcc.target/bpf/sync-fetch-and-add.c: Likewise.
* gcc.target/bpf/smov-2.c: Likewise.
* gcc.target/bpf/smov-1.c: Likewise.
* gcc.target/bpf/smod-1.c: Likewise.
* gcc.target/bpf/sload-1.c: Likewise.
* gcc.target/bpf/sdiv-1.c: Likewise.
* gcc.target/bpf/nop-1.c: Likewise.
* gcc.target/bpf/neg-1.c: Likewise.
* gcc.target/bpf/ldxdw.c: Likewise.
* gcc.target/bpf/jmp-1.c: Likewise.
* gcc.target/bpf/inline-memops-threshold-1.c: Likewise.
* gcc.target/bpf/float-1.c: Likewise.
* gcc.target/bpf/double-2.c: Likewise.
* gcc.target/bpf/double-1.c: Likewise.
* gcc.target/bpf/core-builtin-type-id.c: Likewise.
* gcc.target/bpf/core-builtin-type-based.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-size-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-sign-2.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-sign-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-rshift-2.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-rshift-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-offset-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-lshift-2.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-lshift-1-le.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-lshift-1-be.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-existence-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-errors-2.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-errors-1.c: Likewise.
* gcc.target/bpf/core-builtin-fieldinfo-const-elimination.c:
Likewise.
* gcc.target/bpf/core-builtin-exprlist-4.c: Likewise.
* gcc.target/bpf/core-builtin-exprlist-3.c: Likewise.
* gcc.target/bpf/core-builtin-exprlist-2.c: Likewise.
* gcc.target/bpf/core-builtin-exprlist-1.c: Likewise.
* gcc.target/bpf/core-builtin-enumvalue-opt.c: Likewise.
* gcc.target/bpf/core-builtin-enumvalue-errors.c: Likewise.
* gcc.target/bpf/core-builtin-enumvalue.c: Likewise.
* gcc.target/bpf/core-builtin-3.c: Likewise.
* gcc.target/bpf/core-builtin-2.c: Likewise.
* gcc.target/bpf/core-builtin-1.c: Likewise.
* gcc.target/bpf/core-attr-struct-as-array.c: Likewise.
* gcc.target/bpf/core-attr-6.c: Likewise.
* gcc.target/bpf/core-attr-5.c: Likewise.
* gcc.target/bpf/core-attr-4.c: Likewise.
* gcc.target/bpf/core-attr-3.c: Likewise.
* gcc.target/bpf/core-attr-2.c: Likewise.
* gcc.target/bpf/core-attr-1.c: Likewise.
* gcc.target/bpf/builtin-load.c: Likewise.
* gcc.target/bpf/btfext-funcinfo-nocore.c: Likewise.
* gcc.target/bpf/btfext-funcinfo.c: Likewise.
* gcc.target/bpf/bswap-1.c: Likewise.
* gcc.target/bpf/bswap-2.c: Likewise.
* gcc.target/bpf/attr-kernel-helper.c: Likewise.
* gcc.target/bpf/atomic-xchg-2.c: Likewise.
* gcc.target/bpf/atomic-xchg-1.c: Likewise.
* gcc.target/bpf/atomic-op-3.c: Likewise.
* gcc.target/bpf/atomic-op-2.c: Likewise.
* gcc.target/bpf/atomic-op-1.c: Likewise.
* gcc.target/bpf/atomic-fetch-op-3.c: Likewise.
* gcc.target/bpf/atomic-fetch-op-2.c: Likewise.
   

[gcc r11-11364] arm: Zero/Sign extends for CMSE security

2024-04-25 Thread Richard Ball via Gcc-cvs
https://gcc.gnu.org/g:dabd742cc25f8992c24e639510df0965dbf14f21

commit r11-11364-gdabd742cc25f8992c24e639510df0965dbf14f21
Author: Richard Ball 
Date:   Thu Apr 25 15:30:42 2024 +0100

arm: Zero/Sign extends for CMSE security

Co-Authored by: Andre Simoes Dias Vieira 

This patch makes the following changes:

1) When calling a secure function from non-secure code then any arguments
   smaller than 32-bits that are passed in registers are zero- or 
sign-extended.
2) After a non-secure function returns into secure code then any return 
value
   smaller than 32-bits that is passed in a register is  zero- or 
sign-extended.

This patch addresses the following CVE-2024-0151.

gcc/ChangeLog:
PR target/114837
* config/arm/arm.c (cmse_nonsecure_call_inline_register_clear):
Add zero/sign extend.
(arm_expand_prologue): Add zero/sign extend.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/extend-param.c: New test.
* gcc.target/arm/cmse/extend-return.c: New test.

(cherry picked from commit ad45086178d833254d66fab518b14234418f002b)

Diff:
---
 gcc/config/arm/arm.c  | 69 
 gcc/testsuite/gcc.target/arm/cmse/extend-param.c  | 96 +++
 gcc/testsuite/gcc.target/arm/cmse/extend-return.c | 92 ++
 3 files changed, 257 insertions(+)

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 96d62b2164e..e386186db6f 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -18864,6 +18864,30 @@ cmse_nonsecure_call_inline_register_clear (void)
  end_sequence ();
  emit_insn_before (seq, insn);
 
+ /* The AAPCS requires the callee to widen integral types narrower
+than 32 bits to the full width of the register; but when handling
+calls to non-secure space, we cannot trust the callee to have
+correctly done so.  So forcibly re-widen the result here.  */
+ tree ret_type = TREE_TYPE (fntype);
+ if ((TREE_CODE (ret_type) == INTEGER_TYPE
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (TYPE_MODE (ret_type)), 4))
+   {
+ machine_mode ret_mode = TYPE_MODE (ret_type);
+ rtx extend;
+ if (TYPE_UNSIGNED (ret_type))
+   extend = gen_rtx_ZERO_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ else
+   extend = gen_rtx_SIGN_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ emit_insn_after (gen_rtx_SET (gen_rtx_REG (SImode, R0_REGNUM),
+extend), insn);
+
+   }
+
+
  if (TARGET_HAVE_FPCXT_CMSE)
{
  rtx_insn *last, *pop_insn, *after = insn;
@@ -23272,6 +23296,51 @@ arm_expand_prologue (void)
 
   ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
 
+  /* The AAPCS requires the callee to widen integral types narrower
+ than 32 bits to the full width of the register; but when handling
+ calls to non-secure space, we cannot trust the callee to have
+ correctly done so.  So forcibly re-widen the result here.  */
+  if (IS_CMSE_ENTRY (func_type))
+{
+  function_args_iterator args_iter;
+  CUMULATIVE_ARGS args_so_far_v;
+  cumulative_args_t args_so_far;
+  bool first_param = true;
+  tree arg_type;
+  tree fndecl = current_function_decl;
+  tree fntype = TREE_TYPE (fndecl);
+  arm_init_cumulative_args (_so_far_v, fntype, NULL_RTX, fndecl);
+  args_so_far = pack_cumulative_args (_so_far_v);
+  FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
+   {
+ rtx arg_rtx;
+
+ if (VOID_TYPE_P (arg_type))
+   break;
+
+ function_arg_info arg (arg_type, /*named=*/true);
+ if (!first_param)
+   /* We should advance after processing the argument and pass
+  the argument we're advancing past.  */
+   arm_function_arg_advance (args_so_far, arg);
+ first_param = false;
+ arg_rtx = arm_function_arg (args_so_far, arg);
+ gcc_assert (REG_P (arg_rtx));
+ if ((TREE_CODE (arg_type) == INTEGER_TYPE
+ || TREE_CODE (arg_type) == ENUMERAL_TYPE
+ || TREE_CODE (arg_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (GET_MODE (arg_rtx)), 4))
+   {
+ if (TYPE_UNSIGNED (arg_type))
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_ZERO_EXTEND (SImode, arg_rtx));
+ else
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_SIGN_EXTEND (SImode, arg_rtx));
+   }
+ 

[gcc r12-10394] arm: Zero/Sign extends for CMSE security

2024-04-25 Thread Richard Ball via Gcc-cvs
https://gcc.gnu.org/g:441e194abcf3211de647d74c892f90879ae9ca8c

commit r12-10394-g441e194abcf3211de647d74c892f90879ae9ca8c
Author: Richard Ball 
Date:   Thu Apr 25 15:30:42 2024 +0100

arm: Zero/Sign extends for CMSE security

Co-Authored by: Andre Simoes Dias Vieira 

This patch makes the following changes:

1) When calling a secure function from non-secure code then any arguments
   smaller than 32-bits that are passed in registers are zero- or 
sign-extended.
2) After a non-secure function returns into secure code then any return 
value
   smaller than 32-bits that is passed in a register is  zero- or 
sign-extended.

This patch addresses the following CVE-2024-0151.

gcc/ChangeLog:
PR target/114837
* config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear):
Add zero/sign extend.
(arm_expand_prologue): Add zero/sign extend.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/extend-param.c: New test.
* gcc.target/arm/cmse/extend-return.c: New test.

(cherry picked from commit ad45086178d833254d66fab518b14234418f002b)

Diff:
---
 gcc/config/arm/arm.cc | 69 
 gcc/testsuite/gcc.target/arm/cmse/extend-param.c  | 96 +++
 gcc/testsuite/gcc.target/arm/cmse/extend-return.c | 92 ++
 3 files changed, 257 insertions(+)

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index b700c23b866..f3064b4e270 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -18989,6 +18989,30 @@ cmse_nonsecure_call_inline_register_clear (void)
  end_sequence ();
  emit_insn_before (seq, insn);
 
+ /* The AAPCS requires the callee to widen integral types narrower
+than 32 bits to the full width of the register; but when handling
+calls to non-secure space, we cannot trust the callee to have
+correctly done so.  So forcibly re-widen the result here.  */
+ tree ret_type = TREE_TYPE (fntype);
+ if ((TREE_CODE (ret_type) == INTEGER_TYPE
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (TYPE_MODE (ret_type)), 4))
+   {
+ machine_mode ret_mode = TYPE_MODE (ret_type);
+ rtx extend;
+ if (TYPE_UNSIGNED (ret_type))
+   extend = gen_rtx_ZERO_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ else
+   extend = gen_rtx_SIGN_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ emit_insn_after (gen_rtx_SET (gen_rtx_REG (SImode, R0_REGNUM),
+extend), insn);
+
+   }
+
+
  if (TARGET_HAVE_FPCXT_CMSE)
{
  rtx_insn *last, *pop_insn, *after = insn;
@@ -23397,6 +23421,51 @@ arm_expand_prologue (void)
 
   ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
 
+  /* The AAPCS requires the callee to widen integral types narrower
+ than 32 bits to the full width of the register; but when handling
+ calls to non-secure space, we cannot trust the callee to have
+ correctly done so.  So forcibly re-widen the result here.  */
+  if (IS_CMSE_ENTRY (func_type))
+{
+  function_args_iterator args_iter;
+  CUMULATIVE_ARGS args_so_far_v;
+  cumulative_args_t args_so_far;
+  bool first_param = true;
+  tree arg_type;
+  tree fndecl = current_function_decl;
+  tree fntype = TREE_TYPE (fndecl);
+  arm_init_cumulative_args (_so_far_v, fntype, NULL_RTX, fndecl);
+  args_so_far = pack_cumulative_args (_so_far_v);
+  FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
+   {
+ rtx arg_rtx;
+
+ if (VOID_TYPE_P (arg_type))
+   break;
+
+ function_arg_info arg (arg_type, /*named=*/true);
+ if (!first_param)
+   /* We should advance after processing the argument and pass
+  the argument we're advancing past.  */
+   arm_function_arg_advance (args_so_far, arg);
+ first_param = false;
+ arg_rtx = arm_function_arg (args_so_far, arg);
+ gcc_assert (REG_P (arg_rtx));
+ if ((TREE_CODE (arg_type) == INTEGER_TYPE
+ || TREE_CODE (arg_type) == ENUMERAL_TYPE
+ || TREE_CODE (arg_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (GET_MODE (arg_rtx)), 4))
+   {
+ if (TYPE_UNSIGNED (arg_type))
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_ZERO_EXTEND (SImode, arg_rtx));
+ else
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_SIGN_EXTEND (SImode, arg_rtx));
+  

[gcc r13-8647] arm: Zero/Sign extends for CMSE security

2024-04-25 Thread Richard Ball via Gcc-cvs
https://gcc.gnu.org/g:5550214b58e95320b54e42ef0e37c6479e04b27b

commit r13-8647-g5550214b58e95320b54e42ef0e37c6479e04b27b
Author: Richard Ball 
Date:   Thu Apr 25 15:30:42 2024 +0100

arm: Zero/Sign extends for CMSE security

Co-Authored by: Andre Simoes Dias Vieira 

This patch makes the following changes:

1) When calling a secure function from non-secure code then any arguments
   smaller than 32-bits that are passed in registers are zero- or 
sign-extended.
2) After a non-secure function returns into secure code then any return 
value
   smaller than 32-bits that is passed in a register is  zero- or 
sign-extended.

This patch addresses the following CVE-2024-0151.

gcc/ChangeLog:
PR target/114837
* config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear):
Add zero/sign extend.
(arm_expand_prologue): Add zero/sign extend.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/extend-param.c: New test.
* gcc.target/arm/cmse/extend-return.c: New test.

(cherry picked from commit ad45086178d833254d66fab518b14234418f002b)

Diff:
---
 gcc/config/arm/arm.cc | 69 
 gcc/testsuite/gcc.target/arm/cmse/extend-param.c  | 96 +++
 gcc/testsuite/gcc.target/arm/cmse/extend-return.c | 92 ++
 3 files changed, 257 insertions(+)

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index bf7ff9a9704..cd82728ae60 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -19133,6 +19133,30 @@ cmse_nonsecure_call_inline_register_clear (void)
  end_sequence ();
  emit_insn_before (seq, insn);
 
+ /* The AAPCS requires the callee to widen integral types narrower
+than 32 bits to the full width of the register; but when handling
+calls to non-secure space, we cannot trust the callee to have
+correctly done so.  So forcibly re-widen the result here.  */
+ tree ret_type = TREE_TYPE (fntype);
+ if ((TREE_CODE (ret_type) == INTEGER_TYPE
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (TYPE_MODE (ret_type)), 4))
+   {
+ machine_mode ret_mode = TYPE_MODE (ret_type);
+ rtx extend;
+ if (TYPE_UNSIGNED (ret_type))
+   extend = gen_rtx_ZERO_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ else
+   extend = gen_rtx_SIGN_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ emit_insn_after (gen_rtx_SET (gen_rtx_REG (SImode, R0_REGNUM),
+extend), insn);
+
+   }
+
+
  if (TARGET_HAVE_FPCXT_CMSE)
{
  rtx_insn *last, *pop_insn, *after = insn;
@@ -23575,6 +23599,51 @@ arm_expand_prologue (void)
 
   ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
 
+  /* The AAPCS requires the callee to widen integral types narrower
+ than 32 bits to the full width of the register; but when handling
+ calls to non-secure space, we cannot trust the callee to have
+ correctly done so.  So forcibly re-widen the result here.  */
+  if (IS_CMSE_ENTRY (func_type))
+{
+  function_args_iterator args_iter;
+  CUMULATIVE_ARGS args_so_far_v;
+  cumulative_args_t args_so_far;
+  bool first_param = true;
+  tree arg_type;
+  tree fndecl = current_function_decl;
+  tree fntype = TREE_TYPE (fndecl);
+  arm_init_cumulative_args (_so_far_v, fntype, NULL_RTX, fndecl);
+  args_so_far = pack_cumulative_args (_so_far_v);
+  FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
+   {
+ rtx arg_rtx;
+
+ if (VOID_TYPE_P (arg_type))
+   break;
+
+ function_arg_info arg (arg_type, /*named=*/true);
+ if (!first_param)
+   /* We should advance after processing the argument and pass
+  the argument we're advancing past.  */
+   arm_function_arg_advance (args_so_far, arg);
+ first_param = false;
+ arg_rtx = arm_function_arg (args_so_far, arg);
+ gcc_assert (REG_P (arg_rtx));
+ if ((TREE_CODE (arg_type) == INTEGER_TYPE
+ || TREE_CODE (arg_type) == ENUMERAL_TYPE
+ || TREE_CODE (arg_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (GET_MODE (arg_rtx)), 4))
+   {
+ if (TYPE_UNSIGNED (arg_type))
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_ZERO_EXTEND (SImode, arg_rtx));
+ else
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_SIGN_EXTEND (SImode, arg_rtx));
+   

[gcc r14-10122] arm: Zero/Sign extends for CMSE security

2024-04-25 Thread Richard Ball via Gcc-cvs
https://gcc.gnu.org/g:ad45086178d833254d66fab518b14234418f002b

commit r14-10122-gad45086178d833254d66fab518b14234418f002b
Author: Richard Ball 
Date:   Thu Apr 25 15:30:42 2024 +0100

arm: Zero/Sign extends for CMSE security

Co-Authored by: Andre Simoes Dias Vieira 

This patch makes the following changes:

1) When calling a secure function from non-secure code then any arguments
   smaller than 32-bits that are passed in registers are zero- or 
sign-extended.
2) After a non-secure function returns into secure code then any return 
value
   smaller than 32-bits that is passed in a register is  zero- or 
sign-extended.

This patch addresses the following CVE-2024-0151.

gcc/ChangeLog:
PR target/114837
* config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear):
Add zero/sign extend.
(arm_expand_prologue): Add zero/sign extend.

gcc/testsuite/ChangeLog:

* gcc.target/arm/cmse/extend-param.c: New test.
* gcc.target/arm/cmse/extend-return.c: New test.

Diff:
---
 gcc/config/arm/arm.cc | 69 
 gcc/testsuite/gcc.target/arm/cmse/extend-param.c  | 96 +++
 gcc/testsuite/gcc.target/arm/cmse/extend-return.c | 92 ++
 3 files changed, 257 insertions(+)

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 0217abc218d..ea0c963a4d6 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -19210,6 +19210,30 @@ cmse_nonsecure_call_inline_register_clear (void)
  end_sequence ();
  emit_insn_before (seq, insn);
 
+ /* The AAPCS requires the callee to widen integral types narrower
+than 32 bits to the full width of the register; but when handling
+calls to non-secure space, we cannot trust the callee to have
+correctly done so.  So forcibly re-widen the result here.  */
+ tree ret_type = TREE_TYPE (fntype);
+ if ((TREE_CODE (ret_type) == INTEGER_TYPE
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (TYPE_MODE (ret_type)), 4))
+   {
+ machine_mode ret_mode = TYPE_MODE (ret_type);
+ rtx extend;
+ if (TYPE_UNSIGNED (ret_type))
+   extend = gen_rtx_ZERO_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ else
+   extend = gen_rtx_SIGN_EXTEND (SImode,
+ gen_rtx_REG (ret_mode, 
R0_REGNUM));
+ emit_insn_after (gen_rtx_SET (gen_rtx_REG (SImode, R0_REGNUM),
+extend), insn);
+
+   }
+
+
  if (TARGET_HAVE_FPCXT_CMSE)
{
  rtx_insn *last, *pop_insn, *after = insn;
@@ -23652,6 +23676,51 @@ arm_expand_prologue (void)
 
   ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
 
+  /* The AAPCS requires the callee to widen integral types narrower
+ than 32 bits to the full width of the register; but when handling
+ calls to non-secure space, we cannot trust the callee to have
+ correctly done so.  So forcibly re-widen the result here.  */
+  if (IS_CMSE_ENTRY (func_type))
+{
+  function_args_iterator args_iter;
+  CUMULATIVE_ARGS args_so_far_v;
+  cumulative_args_t args_so_far;
+  bool first_param = true;
+  tree arg_type;
+  tree fndecl = current_function_decl;
+  tree fntype = TREE_TYPE (fndecl);
+  arm_init_cumulative_args (_so_far_v, fntype, NULL_RTX, fndecl);
+  args_so_far = pack_cumulative_args (_so_far_v);
+  FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
+   {
+ rtx arg_rtx;
+
+ if (VOID_TYPE_P (arg_type))
+   break;
+
+ function_arg_info arg (arg_type, /*named=*/true);
+ if (!first_param)
+   /* We should advance after processing the argument and pass
+  the argument we're advancing past.  */
+   arm_function_arg_advance (args_so_far, arg);
+ first_param = false;
+ arg_rtx = arm_function_arg (args_so_far, arg);
+ gcc_assert (REG_P (arg_rtx));
+ if ((TREE_CODE (arg_type) == INTEGER_TYPE
+ || TREE_CODE (arg_type) == ENUMERAL_TYPE
+ || TREE_CODE (arg_type) == BOOLEAN_TYPE)
+ && known_lt (GET_MODE_SIZE (GET_MODE (arg_rtx)), 4))
+   {
+ if (TYPE_UNSIGNED (arg_type))
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_ZERO_EXTEND (SImode, arg_rtx));
+ else
+   emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
+  gen_rtx_SIGN_EXTEND (SImode, arg_rtx));
+   }
+   }
+}
+
   if (IS_STACKALIGN (func_type))
 {
   rtx r0, 

[gcc r14-10121] modula2: issue the parameter incompatibility error message based on dialect

2024-04-25 Thread Gaius Mulley via Gcc-cvs
https://gcc.gnu.org/g:070dd5c883ec2c0be542f448bd82d0f7f0ead390

commit r14-10121-g070dd5c883ec2c0be542f448bd82d0f7f0ead390
Author: Gaius Mulley 
Date:   Thu Apr 25 15:19:30 2024 +0100

modula2: issue the parameter incompatibility error message based on dialect

This tiny patch improves the parameter incompatibility error message by
having a different message for the dialect chosen mentioning the specific
violation.  PIM uses assignment rules for pass by value and expression
rules for pass by reference.  ISO uses expression type checking for
pass by value and pass by reference.

gcc/m2/ChangeLog:

* gm2-compiler/M2FileName.def (CalculateFileName): Remove
quoted string in comment.
* gm2-compiler/M2Range.mod (FoldTypeParam): Generate dialect
specific parameter incompatibility error message.

Signed-off-by: Gaius Mulley 

Diff:
---
 gcc/m2/gm2-compiler/M2FileName.def |  2 +-
 gcc/m2/gm2-compiler/M2Range.mod| 32 +++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2FileName.def 
b/gcc/m2/gm2-compiler/M2FileName.def
index 02413593003..01acb9b48d5 100644
--- a/gcc/m2/gm2-compiler/M2FileName.def
+++ b/gcc/m2/gm2-compiler/M2FileName.def
@@ -39,7 +39,7 @@ EXPORT QUALIFIED CalculateFileName, CalculateStemName, 
ExtractExtension ;
given a module and an extension. This file name
length will be operating system specific.
String, Extension, is concatenated onto
-   Module and thus it is safe to `Mark' the extension
+   Module and thus it is safe to Mark the extension
for garbage collection.
 *)
 
diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod
index 4b8e5fadfe7..7686620a247 100644
--- a/gcc/m2/gm2-compiler/M2Range.mod
+++ b/gcc/m2/gm2-compiler/M2Range.mod
@@ -56,7 +56,7 @@ FROM M2Debug IMPORT Assert ;
 FROM Indexing IMPORT Index, InitIndex, InBounds, PutIndice, GetIndice ;
 FROM Storage IMPORT ALLOCATE ;
 FROM M2ALU IMPORT PushIntegerTree, PushInt, ConvertToInt, Equ, Gre, Less, 
GreEqu ;
-FROM M2Options IMPORT VariantValueChecking, CaseEnumChecking ;
+FROM M2Options IMPORT VariantValueChecking, CaseEnumChecking, GetPIM ;
 
 FROM M2Error IMPORT Error, InternalError, ErrorFormat0, ErrorFormat1, 
ErrorFormat2, FlushErrors,
 GetAnnounceScope ;
@@ -1693,14 +1693,36 @@ END FoldTypeAssign ;
 
 
 (*
-   FoldTypeParam -
+   FoldTypeParam - performs a parameter check between actual and formal.
+   The quad is removed if the check succeeds.
 *)
 
 PROCEDURE FoldTypeParam (q: CARDINAL; tokenNo: CARDINAL; formal, actual, 
procedure: CARDINAL; paramNo: CARDINAL) ;
+VAR
+   compatible: BOOLEAN ;
 BEGIN
-   IF ParameterTypeCompatible (tokenNo,
-   '{%4EN} parameter type failure between actual 
parameter type {%3ad} and the formal type {%2ad}',
-   procedure, formal, actual, paramNo, IsVarParam 
(procedure, paramNo))
+   compatible := FALSE ;
+   IF IsVarParam (procedure, paramNo)
+   THEN
+  (* Expression type compatibility rules for pass by reference parameters. 
 *)
+  compatible := ParameterTypeCompatible (tokenNo,
+ '{%4EN} parameter failure due to 
expression incompatibility ' +
+ 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ procedure, formal, actual, 
paramNo, TRUE)
+   ELSIF GetPIM ()
+   THEN
+  (* Assignment type compatibility rules for pass by value PIM parameters. 
 *)
+  compatible := ParameterTypeCompatible (tokenNo,
+ '{%4EN} parameter failure due to 
assignment incompatibility ' +
+ 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ procedure, formal, actual, 
paramNo, FALSE)
+   ELSE
+  compatible := ParameterTypeCompatible (tokenNo,
+ '{%4EN} parameter failure due to 
parameter incompatibility ' +
+ 'between actual parameter {%3ad} 
and the {%4N} formal {%2ad} parameter in procedure {%1ad}',
+ procedure, formal, actual, 
paramNo, FALSE)
+   END ;
+   IF compatible
THEN
   SubQuad(q)
END


[gcc r14-10120] tree-optimization/114792 - order loops to unloops in CH

2024-04-25 Thread Richard Biener via Gcc-cvs
https://gcc.gnu.org/g:59ff81835fee22a9d4c9a481a4d1814583aae945

commit r14-10120-g59ff81835fee22a9d4c9a481a4d1814583aae945
Author: Richard Biener 
Date:   Thu Apr 25 08:08:24 2024 +0200

tree-optimization/114792 - order loops to unloops in CH

When we use unloop_loops we have to make sure to have loops ordered
inner to outer as otherwise we can wreck inner loop structure where
unlooping relies on that being intact.  The following re-sorts the
vector of to unloop loops after copy-header as that adds to the
vector in two places and the wrong order.

PR tree-optimization/114792
* tree-ssa-loop-ch.cc (ch_order_loops): New function.
(ch_base::copy_headers): Sort loops to unloop inner-to-outer.

* gcc.dg/torture/pr114792.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr114792.c | 16 
 gcc/tree-ssa-loop-ch.cc | 25 +
 2 files changed, 41 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/torture/pr114792.c 
b/gcc/testsuite/gcc.dg/torture/pr114792.c
new file mode 100644
index 000..4990e76eb2a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr114792.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-ccp -fno-tree-copy-prop" } */
+
+int a;
+int main() {
+  int b = -1, c;
+  for (; b >= 0; b++) {
+for (c = 0; c; c++) {
+L:
+  while (a)
+if (a)
+  goto L;
+}
+  }
+  return 0;
+}
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index b7ef485c4cc..d7dd3e5459d 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -759,6 +759,21 @@ protected:
   bool process_loop_p (class loop *loop) final override;
 }; // class pass_ch_vect
 
+/* Sort comparator to order loops after the specified order.  */
+
+static int
+ch_order_loops (const void *a_, const void *b_, void *order_)
+{
+  int *order = (int *)order_;
+  const class loop *a = *(const class loop * const *)a_;
+  const class loop *b = *(const class loop * const *)b_;
+  if (a->num == b->num)
+return 0;
+  if (order[a->num] < order[b->num])
+return -1;
+  return 1;
+}
+
 /* For all loops, copy the condition at the end of the loop body in front
of the loop.  This is beneficial since it increases efficiency of
code motion optimizations.  It also saves one jump on entry to the loop.  */
@@ -1152,6 +1167,16 @@ ch_base::copy_headers (function *fun)
 }
   if (!loops_to_unloop.is_empty ())
 {
+  /* Make sure loops are ordered inner to outer for unlooping.  */
+  if (loops_to_unloop.length () != 1)
+   {
+ auto_vec order;
+ order.safe_grow (number_of_loops (cfun), true);
+ int i = 0;
+ for (auto loop : loops_list (cfun, LI_FROM_INNERMOST))
+   order[loop->num] = i++;
+ loops_to_unloop.sort (ch_order_loops, order.address ());
+   }
   bool irred_invalidated;
   auto_bitmap lc_invalidated;
   auto_vec edges_to_remove;


[gcc r14-10119] Fix calling convention incompatibility with vendor compiler

2024-04-25 Thread Eric Botcazou via Gcc-cvs
https://gcc.gnu.org/g:1d238c84025aaef1641e4000bd2a8f4328b474dd

commit r14-10119-g1d238c84025aaef1641e4000bd2a8f4328b474dd
Author: Eric Botcazou 
Date:   Thu Apr 25 12:44:14 2024 +0200

Fix calling convention incompatibility with vendor compiler

For the 20th anniversary of https://gcc.gnu.org/gcc-3.4/sparc-abi.html,
a new calling convention incompatibility with the vendor compiler (and
the ABI) has been discovered in 64-bit mode, affecting small structures
containing arrays of floating-point components.  The decision has been
made to fix it on Solaris only at this point.

gcc/
PR target/114416
* config/sparc/sparc.h (SUN_V9_ABI_COMPATIBILITY): New macro.
* config/sparc/sol2.h (SUN_V9_ABI_COMPATIBILITY): Redefine it.
* config/sparc/sparc.cc (fp_type_for_abi): New predicate.
(traverse_record_type): Use it to spot floating-point types.
(compute_fp_layout): Also deal with array types.

gcc/testsuite/
* gcc.target/sparc/small-struct-1.c: New test.
* gcc.target/sparc/pr105573.c: Rename to...
* gcc.target/sparc/20230425-1.c: ...this.
* gcc.target/sparc/pr109541.c: Rename to...
* gcc.target/sparc/20230607-1.c: ...this

Diff:
---
 gcc/config/sparc/sol2.h|  3 ++
 gcc/config/sparc/sparc.cc  | 26 +++-
 gcc/config/sparc/sparc.h   |  3 ++
 .../gcc.target/sparc/{pr105573.c => 20230425-1.c}  |  3 ++
 .../gcc.target/sparc/{pr109541.c => 20230607-1.c}  |  3 ++
 gcc/testsuite/gcc.target/sparc/small-struct-1.c| 46 ++
 6 files changed, 82 insertions(+), 2 deletions(-)

diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
index e849af9038b..552f58b2cc8 100644
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -456,3 +456,6 @@ extern const char *host_detect_local_cpu (int argc, const 
char **argv);
 
 #undef SPARC_LOW_FE_EXCEPT_VALUES
 #define SPARC_LOW_FE_EXCEPT_VALUES 1
+
+#undef SUN_V9_ABI_COMPATIBILITY
+#define SUN_V9_ABI_COMPATIBILITY 1
diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc
index 30fa4474bbd..8a5f76c8885 100644
--- a/gcc/config/sparc/sparc.cc
+++ b/gcc/config/sparc/sparc.cc
@@ -6782,6 +6782,22 @@ sparc_pass_by_reference (cumulative_args_t, const 
function_arg_info )
|| GET_MODE_SIZE (mode) > 16);
 }
 
+/* Return true if TYPE is considered as a floating-point type by the ABI.  */
+
+static bool
+fp_type_for_abi (const_tree type)
+{
+  /* This is the original GCC implementation.  */
+  if (FLOAT_TYPE_P (type) || VECTOR_TYPE_P (type))
+return true;
+
+  /* This has been introduced in GCC 14 to match the vendor compiler.  */
+  if (SUN_V9_ABI_COMPATIBILITY && TREE_CODE (type) == ARRAY_TYPE)
+return fp_type_for_abi (TREE_TYPE (type));
+
+  return false;
+}
+
 /* Traverse the record TYPE recursively and call FUNC on its fields.
NAMED is true if this is for a named parameter.  DATA is passed
to FUNC for each field.  OFFSET is the starting position and
@@ -6820,8 +6836,7 @@ traverse_record_type (const_tree type, bool named, T 
*data,
 packed);
else
  {
-   const bool fp_type
- = FLOAT_TYPE_P (field_type) || VECTOR_TYPE_P (field_type);
+   const bool fp_type = fp_type_for_abi (field_type);
Func (field, bitpos, fp_type && named && !packed && TARGET_FPU,
  data);
  }
@@ -7072,6 +7087,13 @@ compute_fp_layout (const_tree field, int bitpos, 
assign_data_t *data,
   mode = TYPE_MODE (TREE_TYPE (TREE_TYPE (field)));
   nregs = 2;
 }
+  else if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)
+{
+  tree elt_type = strip_array_types (TREE_TYPE (field));
+  mode = TYPE_MODE (elt_type);
+  nregs
+   = int_size_in_bytes (TREE_TYPE (field)) / int_size_in_bytes (elt_type);
+}
   else
 nregs = 1;
 
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index fb074808d30..232ecb30ddc 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1700,3 +1700,6 @@ extern int sparc_indent_opcode;
 #define SPARC_LOW_FE_EXCEPT_VALUES 0
 
 #define TARGET_SUPPORTS_WIDE_INT 1
+
+/* Define this to 1 to accept ABI changes to match the vendor compiler.  */
+#define SUN_V9_ABI_COMPATIBILITY 0
diff --git a/gcc/testsuite/gcc.target/sparc/pr105573.c 
b/gcc/testsuite/gcc.target/sparc/20230425-1.c
similarity index 82%
rename from gcc/testsuite/gcc.target/sparc/pr105573.c
rename to gcc/testsuite/gcc.target/sparc/20230425-1.c
index 14043a5fdad..c07dd3261fc 100644
--- a/gcc/testsuite/gcc.target/sparc/pr105573.c
+++ b/gcc/testsuite/gcc.target/sparc/20230425-1.c
@@ -1,3 +1,6 @@
+/* PR target/105573 */
+/* Reported by Sam James  */
+
 /* { dg-do compile } */
 /* { dg-options "-O3 -mvis3" } */
 
diff --git 

[gcc r14-10118] RISC-V: Add test cases for insn does not satisfy its constraints [PR114714]

2024-04-25 Thread Pan Li via Gcc-cvs
https://gcc.gnu.org/g:af7d981ba40f145256f6f6d3409451e8fa647f75

commit r14-10118-gaf7d981ba40f145256f6f6d3409451e8fa647f75
Author: Pan Li 
Date:   Thu Apr 25 15:04:02 2024 +0800

RISC-V: Add test cases for insn does not satisfy its constraints [PR114714]

We have one ICE when RVV register overlap is enabled.  We reverted this
feature as it is in stage 4 and there is no much time to figure a better
solution for this.  Thus, for now add the related test cases which will
trigger ICE when register overlap enabled.

This will gate the RVV register overlap support in GCC-15.

PR target/114714

gcc/testsuite/ChangeLog:

* g++.target/riscv/rvv/base/pr114714-1.C: New test.
* g++.target/riscv/rvv/base/pr114714-2.C: New test.

Signed-off-by: Pan Li 
Co-Authored-by: Kito Cheng 

Diff:
---
 .../g++.target/riscv/rvv/base/pr114714-1.C | 85 ++
 .../g++.target/riscv/rvv/base/pr114714-2.C | 85 ++
 2 files changed, 170 insertions(+)

diff --git a/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-1.C 
b/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-1.C
new file mode 100644
index 000..d3230f7f23e
--- /dev/null
+++ b/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-1.C
@@ -0,0 +1,85 @@
+/* Test that we do not have ice when compile */
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -std=c++17" } */
+
+typedef int a;
+typedef short b;
+typedef unsigned c;
+template < typename > using e = unsigned;
+template < typename > void ab();
+#pragma riscv intrinsic "vector"
+template < typename f, int, int ac > struct g {
+  using i = f;
+  template < typename m > using j = g< m, 0, ac >;
+  using k = g< i, 1, ac - 1 >;
+  using ad = g< i, 1, ac + 1 >;
+};
+namespace ae {
+struct af {
+  using h = g< short, 6, 0 < 3 >;
+};
+struct ag {
+  using h = af::h;
+};
+} template < typename, int > using ah = ae::ag::h;
+template < class ai > using aj = typename ai::i;
+template < class i, class ai > using j = typename ai::j< i >;
+template < class ai > using ak = j< e< ai >, ai >;
+template < class ai > using k = typename ai::k;
+template < class ai > using ad = typename ai::ad;
+template < a ap > vuint16m1_t ar(g< b, ap, 0 >, b);
+template < a ap > vuint16m2_t ar(g< b, ap, 1 >, b);
+template < a ap > vuint32m2_t ar(g< c, ap, 1 >, c);
+template < a ap > vuint32m4_t ar(g< c, ap, 2 >, c);
+template < class ai > using as = decltype(ar(ai(), aj< ai >()));
+template < class ai > as< ai > at(ai);
+namespace ae {
+template < int ap > vuint32m4_t au(g< c, ap, 1 + 1 >, vuint32m2_t l) {
+  return __riscv_vlmul_ext_v_u32m2_u32m4(l);
+}
+} template < int ap > vuint32m2_t aw(g< c, ap, 1 >, vuint16m1_t l) {
+  return __riscv_vzext_vf2_u32m2(l, 0);
+}
+namespace ae {
+vuint32m4_t ax(vuint32m4_t, vuint32m4_t, a);
+}
+template < class ay, class an > as< ay > az(ay ba, an bc) {
+  an bb;
+  return ae::ax(ae::au(ba, bc), ae::au(ba, bb), 2);
+}
+template < class bd > as< bd > be(bd, as< ad< bd > >);
+namespace ae {
+template < class bh, class bi > void bj(bh bk, bi bl) {
+  ad< decltype(bk) > bn;
+  az(bn, bl);
+}
+} template < int ap, int ac, class bp, class bq >
+void br(g< c, ap, ac > bk, bp, bq bl) {
+  ae::bj(bk, bl);
+}
+template < class ai > using bs = decltype(at(ai()));
+struct bt;
+template < int ac = 1 > class bu {
+public:
+  template < typename i > void operator()(i) {
+ah< i, ac > d;
+bt()(i(), d);
+  }
+};
+struct bt {
+  template < typename bv, class bf > void operator()(bv, bf bw) {
+using bx = bv;
+ak< bf > by;
+k< bf > bz;
+using bq = bs< decltype(by) >;
+using bp = bs< decltype(bw) >;
+bp cb;
+ab< bx >();
+for (;;) {
+  bp cc;
+  bq bl = aw(by, be(bz, cc));
+  br(by, cb, bl);
+}
+  }
+};
+void d() { bu()(b()); }
diff --git a/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-2.C 
b/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-2.C
new file mode 100644
index 000..55621e98fee
--- /dev/null
+++ b/gcc/testsuite/g++.target/riscv/rvv/base/pr114714-2.C
@@ -0,0 +1,85 @@
+/* Test that we do not have ice when compile */
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -std=c++17" } */
+
+typedef int a;
+typedef short b;
+typedef unsigned c;
+template < typename > using e = unsigned;
+template < typename > void ab();
+#pragma riscv intrinsic "vector"
+template < typename f, int, int ac > struct g {
+  using i = f;
+  template < typename m > using j = g< m, 0, ac >;
+  using k = g< i, 1, ac - 1 >;
+  using ad = g< i, 1, ac + 1 >;
+};
+namespace ae {
+struct af {
+  using h = g< short, 6, 0 < 3 >;
+};
+struct ag {
+  using h = af::h;
+};
+} template < typename, int > using ah = ae::ag::h;
+template < class ai > using aj = typename ai::i;
+template < class i, class ai > using j = typename ai::j< i >;
+template < class ai > using ak = j< e< ai >, ai >;
+template < class ai > using k = 

[gcc r14-10117] RISC-V: Add early clobber to the dest of vwsll

2024-04-25 Thread Pan Li via Gcc-cvs
https://gcc.gnu.org/g:10ad46bc191f8aa90b0d7b00963bfd52c6d7b09c

commit r14-10117-g10ad46bc191f8aa90b0d7b00963bfd52c6d7b09c
Author: Pan Li 
Date:   Thu Apr 25 08:55:08 2024 +0800

RISC-V: Add early clobber to the dest of vwsll

We missed the existing early clobber for the dest operand of vwsll
pattern when resolve the conflict of revert register overlap.  Thus
add it back to the pattern.  Unfortunately, we have no test to cover
this part and will improve this after GCC-15 open.

The below tests are passed for this patch:
* The rv64gcv fully regression test with isl build.

gcc/ChangeLog:

* config/riscv/vector-crypto.md: Add early clobber to the
dest operand of vwsll.

Signed-off-by: Pan Li 

Diff:
---
 gcc/config/riscv/vector-crypto.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/vector-crypto.md 
b/gcc/config/riscv/vector-crypto.md
index 8a4888a7653..e474ddf5da7 100755
--- a/gcc/config/riscv/vector-crypto.md
+++ b/gcc/config/riscv/vector-crypto.md
@@ -303,7 +303,7 @@
(set_attr "mode" "")])
 
 (define_insn "@pred_vwsll_scalar"
-  [(set (match_operand:VWEXTI 0 "register_operand"  "=vr, vr")
+  [(set (match_operand:VWEXTI 0 "register_operand"  "=,")
  (if_then_else:VWEXTI
(unspec:
  [(match_operand: 1 "vector_mask_operand"   "vmWc1, vmWc1")