[gcc r15-586] make -freg-struct-return visibly a negative alias of -fpcc-struct-return

2024-05-16 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:b7483de99536c05983129d9ca28b53b575861078

commit r15-586-gb7483de99536c05983129d9ca28b53b575861078
Author: Alexandre Oliva 
Date:   Fri May 17 00:45:45 2024 -0300

make -freg-struct-return visibly a negative alias of -fpcc-struct-return

The fact that both options accept negative forms suggests that maybe
they aren't negative forms of each other.  They are, but that isn't
clear even by examining common.opt.  Use NegativeAlias to make it
abundantly clear.

The 'Optimization' keyword next to freg-struct-return was the only
thing that caused flag_pcc_struct_return to be a per-function flag,
and ipa-inline relied on that.  After making it an alias, the
Optimization keyword was no longer operational.  I'm not sure it was
sensible or desirable for flag_pcc_struct_return to be a per-function
setting, but this patch does not intend to change behavior.


for  gcc/ChangeLog

* common.opt (freg-struct-return): Make it explicitly
fpcc-struct-return's NegativeAlias.  Copy Optimization...
(freg-struct-return): ... here.

Diff:
---
 gcc/common.opt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 40cab3cb36a3..40d90817b868 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2412,7 +2412,7 @@ Common RejectNegative Joined UInteger Optimization
 -fpack-struct= Set initial maximum structure member alignment.
 
 fpcc-struct-return
-Common Var(flag_pcc_struct_return,1) Init(DEFAULT_PCC_STRUCT_RETURN)
+Common Var(flag_pcc_struct_return,1) Init(DEFAULT_PCC_STRUCT_RETURN) 
Optimization
 Return small aggregates in memory, not registers.
 
 fpeel-loops
@@ -2602,7 +2602,7 @@ Common Var(flag_record_gcc_switches)
 Record gcc command line switches in the object file.
 
 freg-struct-return
-Common Var(flag_pcc_struct_return,0) Optimization
+Common NegativeAlias Alias(fpcc_struct_return) Optimization
 Return small aggregates in registers.
 
 fregmove


[gcc/aoliva/heads/testme] (668 commits) [testsuite] xfail pr79004 on longdouble64; drop long_double

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 7c0885519050... [testsuite] xfail pr79004 on longdouble64; drop long_double

It previously pointed to:

 ec1d688d102c... adjust iteration count for ppc costmodel 76b

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  ec1d688... adjust iteration count for ppc costmodel 76b
  df13301... [testsuite] require sqrt_insn effective target where needed
  22b9a80... xfail fetestexcept test - ppc always uses fcmpu
  b40c8c9... ppc: testsuite: pr79004 needs -mlong-double-128
  1275905... ppc: testsuite: vec-mul requires vsx runtime
  4c42bea... make -freg-struct-return visibly a negative alias of -fpcc-
  7ef6054... add explicit ABI and align options to pr88233.c
  760577d... [testsuite] [powerpc] adjust -m32 counts for fold-vec-extra
  7d97712... decay vect tests from run to link for pr95401
  9cb06df... Request check for hw support in ppc run tests with -maltive
  5b0e0d4... disable ldist for test, to restore vectorizing-candidate lo
  6996207... [testsuite] [ppc64] expect error on vxworks too
  0cbe329... [testsuite] [arm] add effective target and options for pacb


Summary of changes (added commits):
---

  7c08855... [testsuite] xfail pr79004 on longdouble64; drop long_double
  db37e04... [testsuite] cope with rtems implicit -ftls-model=local-exec
  b7483de... make -freg-struct-return visibly a negative alias of -fpcc- (*)
  d477d68... RISC-V: Cleanup some temporally files [NFC] (*)
  0b2c333... Update gcc sv.po (*)
  556e777... RISC-V: Enable vectorizable early exit testsuite (*)
  6c1de78... RISC-V: Implement vectorizable early exit with vcond_mask_l (*)
  96d5325... Fix points_to_local_or_readonly_memory_p wrt TARGET_MEM_REF (*)
  f3e5f4c... tree-optimization/13962 - handle ptr-ptr compares in ptrs_c (*)
  a9251ab... wrong code with points-to and volatile (*)
  57f8a2f... Vect: Support loop len in vectorizable early exit (*)
  d4dee34... Vect: Support new IFN SAT_ADD for unsigned vector int (*)
  52b0536... Internal-fn: Support new IFN SAT_ADD for unsigned scalar in (*)
  da73261... Revert "Revert: "Enable prange support."" (*)
  b8e3574... Cleanup prange sanity checks. (*)
  f6bed6d... Use a boolean type when folding conditionals in simplify_us (*)
  b8b82bb... RISC-V: testsuite: Drop march-string in cmpmemsi/cpymemsi t (*)
  1e0ae1f... tree-optimization/79958 - make DSE track multiple paths (*)
  bff5328... ada: Remove obsolete reference in comment (*)
  f72988a... ada: Reset scope of top level object declaration during unn (*)
  584ade0... ada: Redundant validity checks (*)
  9ec20f1... ada: Exception on Indefinite_Vector aggregate with loop_par (*)
  568c795... ada: Implement new experimental attribute 'Super (*)
  33ae453... ada: Fix reference to RM clause in comment (*)
  5c9205a... ada: Fix missing length checks with case expressions (*)
  ea64884... ada: Fix standalone Windows builds of adaint.c (*)
  c3b570b... ada: Avoid checking parameters of protected procedures (*)
  c485a15... ada: Ignore ghost nodes in call graph information for dispa (*)
  a802cb3... ada: Fix reason code for length check (*)
  8e22376... ada: Propagate Program_Error from failed finalization of co (*)
  55d11e8... ada: Improve recovery from illegal occurrence of 'Old in if (*)
  f5c7870... ada: No need to follow New_Occurrence_Of with Set_Etype (*)
  7d2a5db... ada: Fix detection of if_expressions that are known on entr (*)
  fa832b4... ada: Fix comments about Get_Ranged_Checks (*)
  8560a06... ada: Minor performance improvement for dynamically-allocate (*)
  513f6b8... ada: Fixup one more pattern of broken scope information (*)
  bc35098... ada: Fix typo in CUDA error message (*)
  4806875... ada: Fix latent alignment issue for dynamically-allocated c (*)
  b98e256... ada: Fix resolving tagged operations in array aggregates (*)
  81a5815... ada: Fix bogus error on function returning noncontrolling r (*)
  7c487eb... ada: Fix casing of CUDA in error messages (*)
  f039057... ada: Fix crash with -gnatdJ and -gnatw_q (*)
  a58b6be... ada: Follow up fixes for Put_Image/streaming regressions (*)
  50a... ada: Implement per-finalization-collection spinlocks (*)
  91c6302... ada: Formal_Derived_Type'Size is not static (*)
  e730d52... ada: Fix bug in maintaining dimension info (*)
  8b73cb9... ada: Remove Aspect_Specifications field from N_Procedure_Sp (*)
  0607818... ada: Reuse existing expression when rewriting aspects to pr (*)
  492f896... ada: Cleanup reporting locations for Ada 2022 and GNAT exte (*)
  1d992c4... ada: Fix alphabetic ordering of aspect identifiers (*)
  61751ee... ada: Fix ordering of code for pragma Preelaborable_Initiali (*)
  3549a58... ada: Fix casing in error messages (*)
  fd3a9ee... ada: Fix docs and comments about pragmas for Boolean-valued (*)
  e656656... diagnostics: use unicode art for interprocedural depth (*)

[gcc(refs/users/aoliva/heads/testme)] [testsuite] cope with rtems implicit -ftls-model=local-exec

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:db37e042c4b3ab0fc594c207a4ebe34ed84350d7

commit db37e042c4b3ab0fc594c207a4ebe34ed84350d7
Author: Alexandre Oliva 
Date:   Fri May 17 02:02:08 2024 -0300

[testsuite] cope with rtems implicit -ftls-model=local-exec

gcc/config/rtems.h's OS_CC1_SPEC changes the -ftls-model default to
local-exec, which breaks some tests that compile with PIC and thus
expect dynamic TLS access models.

I assume the default overriding even with PIC is intended, so I'm
adjusting the testcases.

For those in gcc.dg/tls, I adjusted the ipa dump expectations, so that
they check for tls-local- only, which covers both -dynamic and -exec.

For those in g{cc,++}.target/aarch64/sve, I've added a -ftls-local
overrider, so that the expected opcodes for dynamic TLS are generated.


for  gcc/testsuite/ChangeLog

* gcc.dg/tls/vis-attr-hidden.c: Match tls-local- for both
-dynamic and -exec.  Note rtems's default.
* gcc.dg/tls/vis-flag-hidden.c: Likewise.
* gcc.dg/tls/vis-pragma-hidden.c: Likewise.
* gcc.target/aarch64/sve/tls_1.c: Override -ftls-model default
on rtems.
* gcc.target/aarch64/sve/tls_preserve_2.c: Likewise.
* gcc.target/aarch64/sve/tls_preserve_3.c: Likewise.
* g++.target/aarch64/sve/tls_2.C: Likewise.

Diff:
---
 gcc/testsuite/g++.target/aarch64/sve/tls_2.C  | 1 +
 gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c| 3 ++-
 gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c| 3 ++-
 gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c  | 3 ++-
 gcc/testsuite/gcc.target/aarch64/sve/tls_1.c  | 1 +
 gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c | 1 +
 gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_3.c | 1 +
 7 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C 
b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
index a1a2c85e5910..23004d9984d5 100644
--- a/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
+++ b/gcc/testsuite/g++.target/aarch64/sve/tls_2.C
@@ -2,6 +2,7 @@
 /* { dg-require-effective-target tls } */
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } 
} */
 
 #include 
 
diff --git a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
index 0d43fc565b09..007d382fa9a0 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-attr-hidden.c
@@ -9,4 +9,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
index a15df092d4d0..baf248dc3bab 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-flag-hidden.c
@@ -9,4 +9,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c 
b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
index 1be97644243a..50cd010924cf 100644
--- a/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
+++ b/gcc/testsuite/gcc.dg/tls/vis-pragma-hidden.c
@@ -13,4 +13,5 @@ __thread int x;
 
 void reference() { x++; }
 
-/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-dynamic" 
"whole-program" } } */
+/* rtems defaults to local-exec, others should get local-dynamic.  */
+/* { dg-final { scan-ipa-dump "Varpool flags: tls-local-" "whole-program" } } 
*/
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
index 43c52bc2b906..71f354dfe1b4 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_1.c
@@ -1,5 +1,6 @@
 /* { dg-options "-O2 -fPIC -msve-vector-bits=256" } */
 /* { dg-require-effective-target fpic } */
+/* { dg-additional-options "-ftls-model=global-dynamic" { target *-*-rtems* } 
} */
 
 typedef unsigned int v8si __attribute__((vector_size(32)));
 
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
index 20e939fbb85b..1f477ba8c259 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/tls_preserve_2.c
@@ -2,6 +2,7 @@
 /* { dg-options "-O3 -fpic -msve-vector-bits=256 -fno-schedule-insns" } */
 /* { dg-require-effective-target fpic } */
 /* { dg-

[gcc(refs/users/aoliva/heads/testme)] [testsuite] xfail pr79004 on longdouble64; drop long_double_64bit

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7c08855190502bca6a1e59577ffe304677f126ed

commit 7c08855190502bca6a1e59577ffe304677f126ed
Author: Alexandre Oliva 
Date:   Fri May 17 06:40:10 2024 -0300

[testsuite] xfail pr79004 on longdouble64; drop long_double_64bit

Diff:
---
 gcc/testsuite/gcc.target/powerpc/pr79004.c | 14 +-
 gcc/testsuite/lib/target-supports.exp  | 43 --
 2 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/pr79004.c 
b/gcc/testsuite/gcc.target/powerpc/pr79004.c
index caf1f6c1eefe..2cb8bf4bc14b 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr79004.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr79004.c
@@ -100,10 +100,12 @@ void to_uns_short_store_n (TYPE a, unsigned short *p, 
long n) { p[n] = (unsigned
 void to_uns_int_store_n (TYPE a, unsigned int *p, long n) { p[n] = (unsigned 
int)a; }
 void to_uns_long_store_n (TYPE a, unsigned long *p, long n) { p[n] = (unsigned 
long)a; }
 
-/* { dg-final { scan-assembler-not {\mbl __}   } } */
-/* { dg-final { scan-assembler {\mxscvdpqp\M}  } } */
-/* { dg-final { scan-assembler {\mxscvqpdp\M}  } } */
-/* { dg-final { scan-assembler {\mxscvqpdpo\M} } } */
+/* On targets with 64-bit long double, some opcodes to deal with __float128 are
+   disabled, see PR target/105359.  */
+/* { dg-final { scan-assembler-not {\mbl __}   { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvdpqp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvqpdp\M}  { xfail longdouble64 } } } 
*/
+/* { dg-final { scan-assembler {\mxscvqpdpo\M} { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler {\mxscvqpsdz\M} } } */
 /* { dg-final { scan-assembler {\mxscvqpswz\M} } } */
 /* { dg-final { scan-assembler {\mxscvsdqp\M}  } } */
@@ -111,7 +113,7 @@ void to_uns_long_store_n (TYPE a, unsigned long *p, long n) 
{ p[n] = (unsigned l
 /* { dg-final { scan-assembler {\mlxsd\M}  } } */
 /* { dg-final { scan-assembler {\mlxsiwax\M}   } } */
 /* { dg-final { scan-assembler {\mlxsiwzx\M}   } } */
-/* { dg-final { scan-assembler {\mlxssp\M} } } */
+/* { dg-final { scan-assembler {\mlxssp\M} { xfail longdouble64 } } } 
*/
 /* { dg-final { scan-assembler {\mstxsd\M} } } */
 /* { dg-final { scan-assembler {\mstxsiwx\M}   } } */
-/* { dg-final { scan-assembler {\mstxssp\M}} } */
+/* { dg-final { scan-assembler {\mstxssp\M}{ xfail longdouble64 } } } 
*/
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index ec9baa4f32a3..dc7d4f2b5f39 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2930,49 +2930,6 @@ proc add_options_for_long_double_ieee128 { flags } {
 return "$flags"
 }
 
-# Check if GCC and GLIBC supports explicitly specifying that the long double
-# format uses the IEEE 64-bit.  Under little endian PowerPC Linux, you need
-# GLIBC 2.32 or later to be able to use a different long double format for
-# running a program than the system default.
-
-proc check_effective_target_long_double_64bit { } {
-return [check_runtime_nocache long_double_64bit {
-   #include 
-   #include 
-   /* use volatile to prevent optimization.  */
-   volatile double a = 3.0;
-   volatile long double one = 1.0L;
-   volatile long double two = 2.0L;
-   volatile long double b;
-   char buffer[20];
-   int main()
-   {
- double a2;
- long double b2;
- if (sizeof (long double) != 8)
-   return 1;
- b = one + two;
- /* eliminate removing volatile cast warning.  */
- a2 = a;
- b2 = b;
- if (memcmp (&a2, &b2, 16) != 0)
-   return 1;
- sprintf (buffer, "%lg", b);
- return strcmp (buffer, "3") != 0;
-   }
-}  [add_options_for_ppc_long_double_override_64bit ""]]
-}
-
-# Return the appropriate options to specify that long double uses the IEEE
-# 64-bit format on PowerPC.
-
-proc add_options_for_long_double_64bit { flags } {
-if { [istarget powerpc*-*-*] } {
-   return "$flags -mlong-double-64"
-}
-return "$flags"
-}
-
 # Return 1 if the target supports executing VSX instructions, 0
 # otherwise.  Cache the result.


[gcc/aoliva/heads/testbase] (666 commits) make -freg-struct-return visibly a negative alias of -fpcc-

2024-05-17 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 b7483de99536... make -freg-struct-return visibly a negative alias of -fpcc-

It previously pointed to:

 f17d31e709af... Fortran: Detect 'no implicit type' error in right place [PR

Diff:

Summary of changes (added commits):
---

  b7483de... make -freg-struct-return visibly a negative alias of -fpcc- (*)
  d477d68... RISC-V: Cleanup some temporally files [NFC] (*)
  0b2c333... Update gcc sv.po (*)
  556e777... RISC-V: Enable vectorizable early exit testsuite (*)
  6c1de78... RISC-V: Implement vectorizable early exit with vcond_mask_l (*)
  96d5325... Fix points_to_local_or_readonly_memory_p wrt TARGET_MEM_REF (*)
  f3e5f4c... tree-optimization/13962 - handle ptr-ptr compares in ptrs_c (*)
  a9251ab... wrong code with points-to and volatile (*)
  57f8a2f... Vect: Support loop len in vectorizable early exit (*)
  d4dee34... Vect: Support new IFN SAT_ADD for unsigned vector int (*)
  52b0536... Internal-fn: Support new IFN SAT_ADD for unsigned scalar in (*)
  da73261... Revert "Revert: "Enable prange support."" (*)
  b8e3574... Cleanup prange sanity checks. (*)
  f6bed6d... Use a boolean type when folding conditionals in simplify_us (*)
  b8b82bb... RISC-V: testsuite: Drop march-string in cmpmemsi/cpymemsi t (*)
  1e0ae1f... tree-optimization/79958 - make DSE track multiple paths (*)
  bff5328... ada: Remove obsolete reference in comment (*)
  f72988a... ada: Reset scope of top level object declaration during unn (*)
  584ade0... ada: Redundant validity checks (*)
  9ec20f1... ada: Exception on Indefinite_Vector aggregate with loop_par (*)
  568c795... ada: Implement new experimental attribute 'Super (*)
  33ae453... ada: Fix reference to RM clause in comment (*)
  5c9205a... ada: Fix missing length checks with case expressions (*)
  ea64884... ada: Fix standalone Windows builds of adaint.c (*)
  c3b570b... ada: Avoid checking parameters of protected procedures (*)
  c485a15... ada: Ignore ghost nodes in call graph information for dispa (*)
  a802cb3... ada: Fix reason code for length check (*)
  8e22376... ada: Propagate Program_Error from failed finalization of co (*)
  55d11e8... ada: Improve recovery from illegal occurrence of 'Old in if (*)
  f5c7870... ada: No need to follow New_Occurrence_Of with Set_Etype (*)
  7d2a5db... ada: Fix detection of if_expressions that are known on entr (*)
  fa832b4... ada: Fix comments about Get_Ranged_Checks (*)
  8560a06... ada: Minor performance improvement for dynamically-allocate (*)
  513f6b8... ada: Fixup one more pattern of broken scope information (*)
  bc35098... ada: Fix typo in CUDA error message (*)
  4806875... ada: Fix latent alignment issue for dynamically-allocated c (*)
  b98e256... ada: Fix resolving tagged operations in array aggregates (*)
  81a5815... ada: Fix bogus error on function returning noncontrolling r (*)
  7c487eb... ada: Fix casing of CUDA in error messages (*)
  f039057... ada: Fix crash with -gnatdJ and -gnatw_q (*)
  a58b6be... ada: Follow up fixes for Put_Image/streaming regressions (*)
  50a... ada: Implement per-finalization-collection spinlocks (*)
  91c6302... ada: Formal_Derived_Type'Size is not static (*)
  e730d52... ada: Fix bug in maintaining dimension info (*)
  8b73cb9... ada: Remove Aspect_Specifications field from N_Procedure_Sp (*)
  0607818... ada: Reuse existing expression when rewriting aspects to pr (*)
  492f896... ada: Cleanup reporting locations for Ada 2022 and GNAT exte (*)
  1d992c4... ada: Fix alphabetic ordering of aspect identifiers (*)
  61751ee... ada: Fix ordering of code for pragma Preelaborable_Initiali (*)
  3549a58... ada: Fix casing in error messages (*)
  fd3a9ee... ada: Fix docs and comments about pragmas for Boolean-valued (*)
  e656656... diagnostics: use unicode art for interprocedural depth (*)
  0b7ebe5... diagnostics: add warning emoji to events with VERB_danger (*)
  3cd2674... diagnostics: simplify output of purely intraprocedural exec (*)
  a7be993... diagnostics: handle SGR codes in line_label::m_display_widt (*)
  38dd4e2... RISC-V: Add Zvfbfwma extension to the -march= option (*)
  090714e... Set d.one_operand_p to true when TARGET_SSSE3 in ix86_expan (*)
  0cc0956... Optimize ashift >> 7 to vpcmpgtb for vector int8. (*)
  25456c0... Daily bump. (*)
  d7e6fe0... Add missing hunk in recent change. (*)
  1779e22... analyzer: fix ICE seen with -fsanitize=undefined [PR114899] (*)
  1fbbae1... [v2,2/2] RISC-V: strcmp expansion: Use adjust_address() for (*)
  4bf1aa1... [v2,1/2] RISC-V: Add cmpmemsi expansion (*)
  1a05332... c++: ICE with reference NSDMI [PR114854] (*)
  0b3eac4... c++: DR 569, DR 1693: fun with semicolons [PR113760] (*)
  6ad7ca1... c++: Optimize in maybe_clone_body aliases even when not at_ (*)
  0b93a0a... combine: Fix up simplify_compare_const [PR115092] (*)
  7fdbefc... openmp: Diagnose using grainsize+num_tasks clauses together (*)
  99b1daa... tree-optimization/114589 - r

[gcc r15-3081] Dump aliases in -fcallgraph-info

2024-08-21 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:23496098bba769044ed352c0d7bdb317477c16ac

commit r15-3081-g23496098bba769044ed352c0d7bdb317477c16ac
Author: Alexandre Oliva 
Date:   Thu Aug 22 01:27:55 2024 -0300

Dump aliases in -fcallgraph-info

Dump ICF-unified decls, thunks, aliases and whatnot along with their
ultimate targets, with edges from the alias to the target.

Add support for dropping the source file's suffix when forming from
dump-base, so that auxiliary files can be scanned, such as the .ci
files generated by -fcallgraph-info, as in the testcase.


for  gcc/ChangeLog

* toplev.cc (dump_final_alias_vcg): New.
(dump_final_node_vcg): Dump aliases along with node.

for  gcc/testsuite/ChangeLog

* lib/scandump.exp (dump-base): Support {} in dump base suffix
to drop it.
* gcc.dg/callgraph-info-1.c: New.

Diff:
---
 gcc/testsuite/gcc.dg/callgraph-info-1.c |  7 +++
 gcc/testsuite/lib/scandump.exp  |  4 
 gcc/toplev.cc   | 37 +
 3 files changed, 48 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/callgraph-info-1.c 
b/gcc/testsuite/gcc.dg/callgraph-info-1.c
new file mode 100644
index ..853ff9554eeb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/callgraph-info-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-fcallgraph-info" } */
+
+void f() {}
+void g() __attribute__ ((__alias__ ("f")));
+
+/* { dg-final { scan-dump-times "ci" "triangle" 1 "ci" {{}} } } */
diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
index 14536ae7379b..adf9886b61c9 100644
--- a/gcc/testsuite/lib/scandump.exp
+++ b/gcc/testsuite/lib/scandump.exp
@@ -37,6 +37,10 @@ proc dump-base { args } {
 # gcc-defs to base compilation dumps only on the source basename.
 set dumpbase $src
 if { [string length $dumpbase_suf] != 0 } {
+   # Accept {} as dump base suffix to drop the source suffix entirely.
+   if { "$dumpbase_suf" == "{}" } {
+   set dumpbase_suf ""
+   }
regsub {[.][^.]*$} $src $dumpbase_suf dumpbase
 }
 return $dumpbase
diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index eee4805b504a..f308fb151083 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -914,6 +914,37 @@ dump_final_callee_vcg (FILE *f, location_t location, tree 
callee)
   fputs ("\" }\n", f);
 }
 
+/* Callback for cgraph_node::call_for_symbol_thunks_and_aliases to dump to F_ a
+   node and an edge from ALIAS->DECL to CURRENT_FUNCTION_DECL.  */
+
+static bool
+dump_final_alias_vcg (cgraph_node *alias, void *f_)
+{
+  FILE *f = (FILE *)f_;
+
+  if (alias->decl == current_function_decl)
+return false;
+
+  dump_final_node_vcg_start (f, alias->decl);
+  fputs ("\" shape : triangle }\n", f);
+
+  fputs ("edge: { sourcename: \"", f);
+  print_decl_identifier (f, alias->decl, PRINT_DECL_UNIQUE_NAME);
+  fputs ("\" targetname: \"", f);
+  print_decl_identifier (f, current_function_decl, PRINT_DECL_UNIQUE_NAME);
+  location_t location = DECL_SOURCE_LOCATION (alias->decl);
+  if (LOCATION_LOCUS (location) != UNKNOWN_LOCATION)
+{
+  expanded_location loc;
+  fputs ("\" label: \"", f);
+  loc = expand_location (location);
+  fprintf (f, "%s:%d:%d", loc.file, loc.line, loc.column);
+}
+  fputs ("\" }\n", f);
+
+  return false;
+}
+
 /* Dump final cgraph node in VCG format.  */
 
 static void
@@ -950,6 +981,12 @@ dump_final_node_vcg (FILE *f)
 dump_final_callee_vcg (f, c->location, c->decl);
   vec_free (cfun->su->callees);
   cfun->su->callees = NULL;
+
+  cgraph_node *node = cgraph_node::get (current_function_decl);
+  if (!node)
+return;
+  node->call_for_symbol_thunks_and_aliases (dump_final_alias_vcg, f,
+   true, false);
 }
 
 /* Output stack usage and callgraph info, as requested.  */


[gcc/aoliva/heads/testme] (223 commits) Optimize initialization of small padded objects

2024-08-23 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 ce140008fff6... Optimize initialization of small padded objects

It previously pointed to:

 d2b89c77861c... Dump aliases in -fcallgraph-info

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  d2b89c7... Dump aliases in -fcallgraph-info
  7b50738... Optimize initialization of small padded objects


Summary of changes (added commits):
---

  ce14000... Optimize initialization of small padded objects
  3ff1b91... Daily bump. (*)
  a523d1b... libstdc++: Update and clarify Doxygen version requirements  (*)
  5cfee93... libstdc++: Hide std::tuple internals from Doxygen docs (*)
  cd8e0ea... libstdc++: Improve Doxygen docs for std::allocator_traits s (*)
  5dce17e... RISC-V: Use encoded nelts when calling repeating_sequence_p (*)
  a9f5e23... ifcvt: Do not overwrite results in noce_convert_multiple_se (*)
  c9e2d0e... ifcvt: disallow call instructions in noce_convert_multiple_ (*)
  6e68c3d... rs6000: Fix PTImode handling in power8 swap optimization pa (*)
  cb51e0b... lto: Don't check obj.found for offload section (*)
  c429d50... libstdc++: Implement LWG 3746 for std::optional (*)
  952e67c... libstdc++: Optimize __try_use_facet for const types (*)
  8cf51d7... libstdc++: Fix std::allocator_traits::construct constraints (*)
  43b8153... libstdc++: Only use std::time_put in std::format for non-C  (*)
  591b719... libstdc++: Define operator== for hash table iterators [PR11 (*)
  125bab2... libstdc++: Fix std::random_shuffle for low RAND_MAX [PR8893 (*)
  de1923f... tree-optimization/116463 - complex lowering leaves around d (*)
  a35dd27... libstdc++: Make debug sequence members mutable [PR116369] (*)
  9115593... libstdc++: Use noexcept insted of throw() in src/c++11/debu (*)
  0bb2652... libstdc++: Simplify C++20 implementation of std::variant (*)
  b25b101... libstdc++: Make std::vector::reference constructor pr (*)
  f9f599a... Revert "Fortran: Fix class transformational intrinsic calls (*)
  0798887... Match: Support form 4 for unsigned integer .SAT_TRUNC (*)
  b2c1d7c... libcpp: bump padding size in _cpp_convert_input [PR116458] (*)
  96fe95b... optabs-query: Use opt_machine_mode for smallest_int_mode_fo (*)
  c22d57c... RISC-V: Expand vec abs without masking. (*)
  a8ae8f9... Fix test failure on powerpc targets (*)
  19c22fb... ada: Fix crash on aliased variable with packed array type a (*)
  87bdd17... ada: String interpolation: report error without Extensions  (*)
  509cc70... ada: Fix incorrect tracebacks on Windows (*)
  a7ff045... ada: Crash on string interpolation with custom string types (*)
  7dd9c7d... ada: Implicit_Dereference aspect specification for subtype  (*)
  24c5396... ada: Eliminated-mode overflow check not eliminated (*)
  40903c7... ada: Update libraries with the limited flag (*)
  dce0d46... ada: Emit a warning on inheritly limited types (*)
  92a9b55... ada: First controlling parameter aspect (*)
  0020cae... ada: Fix style in lines starting with assignment operator (*)
  ff356c0... ada: Cleanup validity of boolean operators (*)
  f67d108... ada: Simplify validity checks for scalar parameters (*)
  8719b18... ada: Fix validity checks for named parameter associations (*)
  4522f1f... ada: First controlling parameter aspect (*)
  aa95cd9... ada: Error missing when 'access is applied to an interface  (*)
  8a41af7... ada: First controlling parameter aspect (*)
  a071fcd... fortran: Minor fix to -ffrontend-optimize description (*)
  afa9080... doc: Specifically link to GPL v3.0 for GM2 (*)
  0636de8... Remove unnecessary view_convert obsoleted by [PR86468]. (*)
  f6b10fe... testsuite: Fix vect-mod-var.c for division by 0 [PR116461] (*)
  2cd783b... Daily bump. (*)
  da043f9... testsuite: Fix gcc.dg/torture/pr116420.c for targets defaul (*)
  c937773... [PR rtl-optimization/116420] Fix interesting block bitmap D (*)
  8e0da56... libstdc++: Add some missing ranges feature-test macro tests (*)
  792adb8... Recompute TYPE_MODE and DECL_MODE for aggregate type for ac (*)
  a025081... RISC-V: Fix vector cfi notes for stack-clash protection (*)
  51761c5... libstdc++: Optimize std::projected (*)
  6202324... libstdc++: Implement P2997R1 changes to the indirect invoca (*)
  b552730... libstdc++: Implement P2609R3 changes to the indirect invoca (*)
  a98dd53... Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook (*)
  b07f8a3... fold: Fix `a * 1j` if a has side effects [PR116454] (*)
  4e905bd... fix single argument static_assert (*)
  313aa73... PR target/116365: Add user-friendly arguments to --param aa (*)
  76c2954... RISC-V: Enable -gvariable-location-views by default (*)
  bcb33b1... Do not emit a redundant DW_TAG_lexical_block for inlined su (*)
  9bbad36... PR tree-optimization/101390: Vectorize modulo operator (*)
  2349609... Dump aliases in -fcallgraph-info (*)
  c1aba5e... Makefile.tpl: fix w

[gcc/aoliva/heads/testbase] (222 commits) Daily bump.

2024-08-23 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 3ff1b91e7729... Daily bump.

It previously pointed to:

 4d2e8fcdaf32... Daily bump.

Diff:

Summary of changes (added commits):
---

  3ff1b91... Daily bump. (*)
  a523d1b... libstdc++: Update and clarify Doxygen version requirements  (*)
  5cfee93... libstdc++: Hide std::tuple internals from Doxygen docs (*)
  cd8e0ea... libstdc++: Improve Doxygen docs for std::allocator_traits s (*)
  5dce17e... RISC-V: Use encoded nelts when calling repeating_sequence_p (*)
  a9f5e23... ifcvt: Do not overwrite results in noce_convert_multiple_se (*)
  c9e2d0e... ifcvt: disallow call instructions in noce_convert_multiple_ (*)
  6e68c3d... rs6000: Fix PTImode handling in power8 swap optimization pa (*)
  cb51e0b... lto: Don't check obj.found for offload section (*)
  c429d50... libstdc++: Implement LWG 3746 for std::optional (*)
  952e67c... libstdc++: Optimize __try_use_facet for const types (*)
  8cf51d7... libstdc++: Fix std::allocator_traits::construct constraints (*)
  43b8153... libstdc++: Only use std::time_put in std::format for non-C  (*)
  591b719... libstdc++: Define operator== for hash table iterators [PR11 (*)
  125bab2... libstdc++: Fix std::random_shuffle for low RAND_MAX [PR8893 (*)
  de1923f... tree-optimization/116463 - complex lowering leaves around d (*)
  a35dd27... libstdc++: Make debug sequence members mutable [PR116369] (*)
  9115593... libstdc++: Use noexcept insted of throw() in src/c++11/debu (*)
  0bb2652... libstdc++: Simplify C++20 implementation of std::variant (*)
  b25b101... libstdc++: Make std::vector::reference constructor pr (*)
  f9f599a... Revert "Fortran: Fix class transformational intrinsic calls (*)
  0798887... Match: Support form 4 for unsigned integer .SAT_TRUNC (*)
  b2c1d7c... libcpp: bump padding size in _cpp_convert_input [PR116458] (*)
  96fe95b... optabs-query: Use opt_machine_mode for smallest_int_mode_fo (*)
  c22d57c... RISC-V: Expand vec abs without masking. (*)
  a8ae8f9... Fix test failure on powerpc targets (*)
  19c22fb... ada: Fix crash on aliased variable with packed array type a (*)
  87bdd17... ada: String interpolation: report error without Extensions  (*)
  509cc70... ada: Fix incorrect tracebacks on Windows (*)
  a7ff045... ada: Crash on string interpolation with custom string types (*)
  7dd9c7d... ada: Implicit_Dereference aspect specification for subtype  (*)
  24c5396... ada: Eliminated-mode overflow check not eliminated (*)
  40903c7... ada: Update libraries with the limited flag (*)
  dce0d46... ada: Emit a warning on inheritly limited types (*)
  92a9b55... ada: First controlling parameter aspect (*)
  0020cae... ada: Fix style in lines starting with assignment operator (*)
  ff356c0... ada: Cleanup validity of boolean operators (*)
  f67d108... ada: Simplify validity checks for scalar parameters (*)
  8719b18... ada: Fix validity checks for named parameter associations (*)
  4522f1f... ada: First controlling parameter aspect (*)
  aa95cd9... ada: Error missing when 'access is applied to an interface  (*)
  8a41af7... ada: First controlling parameter aspect (*)
  a071fcd... fortran: Minor fix to -ffrontend-optimize description (*)
  afa9080... doc: Specifically link to GPL v3.0 for GM2 (*)
  0636de8... Remove unnecessary view_convert obsoleted by [PR86468]. (*)
  f6b10fe... testsuite: Fix vect-mod-var.c for division by 0 [PR116461] (*)
  2cd783b... Daily bump. (*)
  da043f9... testsuite: Fix gcc.dg/torture/pr116420.c for targets defaul (*)
  c937773... [PR rtl-optimization/116420] Fix interesting block bitmap D (*)
  8e0da56... libstdc++: Add some missing ranges feature-test macro tests (*)
  792adb8... Recompute TYPE_MODE and DECL_MODE for aggregate type for ac (*)
  a025081... RISC-V: Fix vector cfi notes for stack-clash protection (*)
  51761c5... libstdc++: Optimize std::projected (*)
  6202324... libstdc++: Implement P2997R1 changes to the indirect invoca (*)
  b552730... libstdc++: Implement P2609R3 changes to the indirect invoca (*)
  a98dd53... Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook (*)
  b07f8a3... fold: Fix `a * 1j` if a has side effects [PR116454] (*)
  4e905bd... fix single argument static_assert (*)
  313aa73... PR target/116365: Add user-friendly arguments to --param aa (*)
  76c2954... RISC-V: Enable -gvariable-location-views by default (*)
  bcb33b1... Do not emit a redundant DW_TAG_lexical_block for inlined su (*)
  9bbad36... PR tree-optimization/101390: Vectorize modulo operator (*)
  2349609... Dump aliases in -fcallgraph-info (*)
  c1aba5e... Makefile.tpl: fix whitespace in licence header (*)
  d6a112a... Makefile.tpl: drop leftover intermodule cruft (*)
  6ea25c0... Align ix86_{move_max,store_max} with vectorizer. (*)
  f155534... Daily bump. (*)
  91f2139... RISC-V: Add testcases for unsigned vector .SAT_TRUNC form 3 (*)
  1e99e1b... RISC-V: Add testcases for unsigned vector .SAT_TRUNC form 2 (*)
  cdc9cd4... [PR r

[gcc(refs/users/aoliva/heads/testme)] Optimize initialization of small padded objects

2024-08-23 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ce140008fff6b1e62674be932e3e908232337192

commit ce140008fff6b1e62674be932e3e908232337192
Author: Alexandre Oliva 
Date:   Sat Aug 24 01:52:09 2024 -0300

Optimize initialization of small padded objects

When small objects containing padding bits (or bytes) are fully
initialized, we will often store them in registers, and setting
bitfields and other small fields will attempt to preserve the
uninitialized padding bits, which tends to be expensive.
Zero-initializing registers, OTOH, tends to be cheap.

So, if we're optimizing, zero-initialize such small padded objects
even if that's not needed for correctness.  We can't zero-initialize
all such padding objects, though: if there's no padding whatsoever,
and all fields are initialized with nonzero, the zero initialization
would be flagged as dead.  That's why we introduce machinery to detect
whether objects have padding bits.  I considered distinguishing
between bitfields, units and larger padding elements, but I didn't
pursue that distinction.

Since the object's zero-initialization subsumes fields'
zero-initialization, the empty string test in builtin-snprintf-6.c's
test_assign_aggregate would regress without the addition of
native_encode_constructor.


for  gcc/ChangeLog

* expr.cc (categorize_ctor_elements_1): Change p_complete to
int, to distinguish complete initialization in presence or
absence of uninitialized padding bits.
(categorize_ctor_elements): Likewise.  Adjust all callers...
* expr.h (categorize_ctor_elements): ... and declaration.
(type_has_padding_at_level_p): New.
* gimple-fold.cc (type_has_padding_at_level_p): New.
* fold-const.cc (native_encode_constructor): New.
(native_encode_expr): Call it.
* gimplify.cc (gimplify_init_constructor): Clear small
non-addressable non-volatile objects with padding or
other uninitialized fields as an optimization.

for  gcc/testsuite/ChangeLog

* gcc.dg/init-pad-1.c: New.

Diff:
---
 gcc/expr.cc   | 20 ++--
 gcc/expr.h|  3 ++-
 gcc/fold-const.cc | 36 
 gcc/gimple-fold.cc| 50 +++
 gcc/gimplify.cc   | 14 ++-
 gcc/testsuite/gcc.dg/init-pad-1.c | 18 ++
 6 files changed, 132 insertions(+), 9 deletions(-)

diff --git a/gcc/expr.cc b/gcc/expr.cc
index 8d17a5a39b4b..320be8b17a13 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7096,7 +7096,7 @@ count_type_elements (const_tree type, bool for_ctor_p)
 static bool
 categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
HOST_WIDE_INT *p_unique_nz_elts,
-   HOST_WIDE_INT *p_init_elts, bool *p_complete)
+   HOST_WIDE_INT *p_init_elts, int *p_complete)
 {
   unsigned HOST_WIDE_INT idx;
   HOST_WIDE_INT nz_elts, unique_nz_elts, init_elts, num_fields;
@@ -7218,7 +7218,10 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
 
   if (*p_complete && !complete_ctor_at_level_p (TREE_TYPE (ctor),
num_fields, elt_type))
-*p_complete = false;
+*p_complete = 0;
+  else if (*p_complete > 0
+  && type_has_padding_at_level_p (TREE_TYPE (ctor)))
+*p_complete = -1;
 
   *p_nz_elts += nz_elts;
   *p_unique_nz_elts += unique_nz_elts;
@@ -7239,7 +7242,10 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
  and place it in *P_ELT_COUNT.
* whether the constructor is complete -- in the sense that every
  meaningful byte is explicitly given a value --
- and place it in *P_COMPLETE.
+ and place it in *P_COMPLETE:
+ -  0 if any field is missing
+ -  1 if all fields are initialized, and there's no padding
+ - -1 if all fields are initialized, but there's padding
 
Return whether or not CTOR is a valid static constant initializer, the same
as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0".  */
@@ -7247,12 +7253,12 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
 bool
 categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
  HOST_WIDE_INT *p_unique_nz_elts,
- HOST_WIDE_INT *p_init_elts, bool *p_complete)
+ HOST_WIDE_INT *p_init_elts, int *p_complete)
 {
   *p_nz_elts = 0;
   *p_unique_nz_elts = 0;
   *p_init_elts = 0;
-  *p_complete = true;
+  *p_complete = 1;
 
   return categorize_ctor_elements_1 (ctor, p_nz_elts, p_unique_nz_elts,
 p_init_elts, p_complete);
@@ -7313,7 +7319,7 @@ mostly_zeros_p (const_tree exp)
   if (TREE_CODE (e

[gcc/aoliva/heads/testme] [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

2024-08-30 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 beba216fee9f... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

It previously pointed to:

 73bc0445c988... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  73bc044... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra


Summary of changes (added commits):
---

  beba216... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra


[gcc/aoliva/heads/testme] (186 commits) testsuite: introduce hostedlib effective target

2024-08-31 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 62b70aa09f1c... testsuite: introduce hostedlib effective target

It previously pointed to:

 beba216fee9f... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  beba216... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra
  ce14000... Optimize initialization of small padded objects


Summary of changes (added commits):
---

  62b70aa... testsuite: introduce hostedlib effective target
  673a448... Optimize initialization of small padded objects (*)
  08693e2... Daily bump. (*)
  b1765a5... c++: add fixed test [PR101099] (*)
  ffd56dc... c++: add fixed test [PR115616] (*)
  f93a38f... c++: fix used but not defined warning for friend (*)
  b222122... Fortran: default-initialization of derived-type function re (*)
  5020f8e... gdbhooks: Fix printing of vec with vl_ptr layout (*)
  3fb9072... Don't remove /usr/lib and /lib from when passing to the lin (*)
  4d2cbe2... middle-end: Remove integer_three_node [PR116537] (*)
  04d11de... expand: Small speed up expansion of __builtin_prefetch (*)
  87ce817... PR modula2/116181: m2rts fix -Wodr warning (*)
  d48273f... Avoid division by zero via constant_multiple_p (*)
  e7c7397... Do not bother with reassociation in SLP discovery for singl (*)
  b748e2e... c++: Allow standard attributes after closing square bracket (*)
  ab214ef... Check avx upper register for parallel. (*)
  350d627... Daily bump. (*)
  aff7f67... SARIF output: implement embedded URLs in messages (§3.11.6 (*)
  e31b617... pretty-print: reimplement pp_format with a new struct pp_to (*)
  68a0ca6... pretty-print: move class chunk_info into its own header (*)
  464a3d2... Use std::unique_ptr for optinfo_item (*)
  6bfeba1... Fortran: fix ICE with use with rename of namelist member [P (*)
  81c4798... hppa: Fix handling of unscaled index addresses on HP-UX (*)
  215c7e3... expand: Allow widdening optab when expanding popcount==1 [P (*)
  cdd5dd2... ada: Fix assertion failure on private limited with clause (*)
  d506247... ada: Fix internal error on concatenation of discriminant-de (*)
  a50584b... ada: Missing legality check when type completed (*)
  4994069... ada: Fix missing finalization for call to function returnin (*)
  c2e3326... ada: Print Insertion_Sloc in dmsg (*)
  bb7a166... ada: Use the same warning character in continuation message (*)
  ad4c549... ada: Restructure continuation message for pretty printing (*)
  f60b53c... ada: Improve Inspection_Point warning (*)
  4825bbf... ada: Avoid creating continuation messages without an intend (*)
  f872bba... ada: Parse the attributes of continuation messages correctl (*)
  446f415... ada: Use consistent type continuations messages (*)
  dbaf2c0... ada: Extract line fitting algorithm (*)
  299cd64... ada: Ensure validity checks for private scalar types (*)
  6a3ff84... ada: Display actual line length in line length check (*)
  a383d7b... ada: Proper handling for iterator associations in array agg (*)
  567e36c... ada: First controlling parameter aspect (*)
  6b4b5b4... ada: Update documentation for conditional when constructs (*)
  ac6d433... Allow subregs around constant displacements [PR116516] (*)
  00ec6bd... Make some smallest_int_mode_for_size calls cope with failur (*)
  07e5e05... AVR: target/115830 - Make better use of SREG.N and SREG.Z. (*)
  d9c54e9... c++: don't remove labels during coro-early-expand-ifns [PR1 (*)
  bd2ccc2... AVR: Outsource code for avr-specific passes to new avr-pass (*)
  4b729d2... testsuite: Fix up refactored scanltranstree.exp functions [ (*)
  4ff4875... RISC-V: Fix subreg of VLS modes larger than a vector [PR116 (*)
  3cb92be... i386: Support wide immediate constants in STV. (*)
  155da08... Write LF_MFUNC_ID types for CodeView struct member function (*)
  c5043d8... Record member functions in CodeView struct definitions (*)
  6a9932e... Record static data members in CodeView structs (*)
  310fd68... Handle scoping in CodeView LF_FUNC_ID types (*)
  3501226... Handle namespaced names for CodeView (*)
  6cd806a... Daily bump. (*)
  9f79c7d... c++: wrong error due to std::initializer_list opt [PR116476 (*)
  b8ef805... PR modula2/116181 remove ODR warnings from library interfac (*)
  3c89c41... expand: Add debug dump on the cost for `popcount==1` expand (*)
  b68561d... libstdc++: Fix autoconf check for O_NONBLOCK in  (*)
  51b0fef... libstdc++: Fix -Wunused-parameter warnings in Networking TS (*)
  0e2b3db... libstdc++: Fix -Wunused-variable warning in  (*)
  a59f1cc... libstdc++: Remove unused typedef in  (*)
  9740a1b... doc: Add Dhruv Matani to Contributors (*)
  c2ad7b2... libstdc++: Fix @file for target-specific opt_random.h (*)
  f6ed7a6... libstdc++: Fix @headername for bits/cpp_type_traits.h (*)
  898f013... AVR: Overhaul the avr-ifelse RTL optimizatio

[gcc/aoliva/heads/testbase] (185 commits) Optimize initialization of small padded objects

2024-08-31 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 673a448aa24e... Optimize initialization of small padded objects

It previously pointed to:

 3ff1b91e7729... Daily bump.

Diff:

Summary of changes (added commits):
---

  673a448... Optimize initialization of small padded objects (*)
  08693e2... Daily bump. (*)
  b1765a5... c++: add fixed test [PR101099] (*)
  ffd56dc... c++: add fixed test [PR115616] (*)
  f93a38f... c++: fix used but not defined warning for friend (*)
  b222122... Fortran: default-initialization of derived-type function re (*)
  5020f8e... gdbhooks: Fix printing of vec with vl_ptr layout (*)
  3fb9072... Don't remove /usr/lib and /lib from when passing to the lin (*)
  4d2cbe2... middle-end: Remove integer_three_node [PR116537] (*)
  04d11de... expand: Small speed up expansion of __builtin_prefetch (*)
  87ce817... PR modula2/116181: m2rts fix -Wodr warning (*)
  d48273f... Avoid division by zero via constant_multiple_p (*)
  e7c7397... Do not bother with reassociation in SLP discovery for singl (*)
  b748e2e... c++: Allow standard attributes after closing square bracket (*)
  ab214ef... Check avx upper register for parallel. (*)
  350d627... Daily bump. (*)
  aff7f67... SARIF output: implement embedded URLs in messages (§3.11.6 (*)
  e31b617... pretty-print: reimplement pp_format with a new struct pp_to (*)
  68a0ca6... pretty-print: move class chunk_info into its own header (*)
  464a3d2... Use std::unique_ptr for optinfo_item (*)
  6bfeba1... Fortran: fix ICE with use with rename of namelist member [P (*)
  81c4798... hppa: Fix handling of unscaled index addresses on HP-UX (*)
  215c7e3... expand: Allow widdening optab when expanding popcount==1 [P (*)
  cdd5dd2... ada: Fix assertion failure on private limited with clause (*)
  d506247... ada: Fix internal error on concatenation of discriminant-de (*)
  a50584b... ada: Missing legality check when type completed (*)
  4994069... ada: Fix missing finalization for call to function returnin (*)
  c2e3326... ada: Print Insertion_Sloc in dmsg (*)
  bb7a166... ada: Use the same warning character in continuation message (*)
  ad4c549... ada: Restructure continuation message for pretty printing (*)
  f60b53c... ada: Improve Inspection_Point warning (*)
  4825bbf... ada: Avoid creating continuation messages without an intend (*)
  f872bba... ada: Parse the attributes of continuation messages correctl (*)
  446f415... ada: Use consistent type continuations messages (*)
  dbaf2c0... ada: Extract line fitting algorithm (*)
  299cd64... ada: Ensure validity checks for private scalar types (*)
  6a3ff84... ada: Display actual line length in line length check (*)
  a383d7b... ada: Proper handling for iterator associations in array agg (*)
  567e36c... ada: First controlling parameter aspect (*)
  6b4b5b4... ada: Update documentation for conditional when constructs (*)
  ac6d433... Allow subregs around constant displacements [PR116516] (*)
  00ec6bd... Make some smallest_int_mode_for_size calls cope with failur (*)
  07e5e05... AVR: target/115830 - Make better use of SREG.N and SREG.Z. (*)
  d9c54e9... c++: don't remove labels during coro-early-expand-ifns [PR1 (*)
  bd2ccc2... AVR: Outsource code for avr-specific passes to new avr-pass (*)
  4b729d2... testsuite: Fix up refactored scanltranstree.exp functions [ (*)
  4ff4875... RISC-V: Fix subreg of VLS modes larger than a vector [PR116 (*)
  3cb92be... i386: Support wide immediate constants in STV. (*)
  155da08... Write LF_MFUNC_ID types for CodeView struct member function (*)
  c5043d8... Record member functions in CodeView struct definitions (*)
  6a9932e... Record static data members in CodeView structs (*)
  310fd68... Handle scoping in CodeView LF_FUNC_ID types (*)
  3501226... Handle namespaced names for CodeView (*)
  6cd806a... Daily bump. (*)
  9f79c7d... c++: wrong error due to std::initializer_list opt [PR116476 (*)
  b8ef805... PR modula2/116181 remove ODR warnings from library interfac (*)
  3c89c41... expand: Add debug dump on the cost for `popcount==1` expand (*)
  b68561d... libstdc++: Fix autoconf check for O_NONBLOCK in  (*)
  51b0fef... libstdc++: Fix -Wunused-parameter warnings in Networking TS (*)
  0e2b3db... libstdc++: Fix -Wunused-variable warning in  (*)
  a59f1cc... libstdc++: Remove unused typedef in  (*)
  9740a1b... doc: Add Dhruv Matani to Contributors (*)
  c2ad7b2... libstdc++: Fix @file for target-specific opt_random.h (*)
  f6ed7a6... libstdc++: Fix @headername for bits/cpp_type_traits.h (*)
  898f013... AVR: Overhaul the avr-ifelse RTL optimization pass. (*)
  6661944... Add gcc ka.po (*)
  15f857a... c++: ICE with ()-init and TARGET_EXPR eliding [PR116424] (*)
  abeecce... aarch64: Assume zero gather/scatter set-up cost for -mtune= (*)
  3e27ea2... aarch64: Fix gather x32/x64 selection (*)
  035c196... aarch64: Add a test for zeroing <64bits>x2_t structures (*)
  3c9338b... Tweak documentation of ASM_INPUT_P (*)
  bdcd

[gcc r15-3328] Optimize initialization of small padded objects

2024-08-31 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:673a448aa24efedd5ac140ebf7bfe652d7a6a846

commit r15-3328-g673a448aa24efedd5ac140ebf7bfe652d7a6a846
Author: Alexandre Oliva 
Date:   Sat Aug 31 06:03:12 2024 -0300

Optimize initialization of small padded objects

When small objects containing padding bits (or bytes) are fully
initialized, we will often store them in registers, and setting
bitfields and other small fields will attempt to preserve the
uninitialized padding bits, which tends to be expensive.
Zero-initializing registers, OTOH, tends to be cheap.

So, if we're optimizing, zero-initialize such small padded objects
even if that's not needed for correctness.  We can't zero-initialize
all such padding objects, though: if there's no padding whatsoever,
and all fields are initialized with nonzero, the zero initialization
would be flagged as dead.  That's why we introduce machinery to detect
whether objects have padding bits.  I considered distinguishing
between bitfields, units and larger padding elements, but I didn't
pursue that distinction.

Since the object's zero-initialization subsumes fields'
zero-initialization, the empty string test in builtin-snprintf-6.c's
test_assign_aggregate would regress without the addition of
native_encode_constructor.


for  gcc/ChangeLog

* expr.cc (categorize_ctor_elements_1): Change p_complete to
int, to distinguish complete initialization in presence or
absence of uninitialized padding bits.
(categorize_ctor_elements): Likewise.  Adjust all callers...
* expr.h (categorize_ctor_elements): ... and declaration.
(type_has_padding_at_level_p): New.
* gimple-fold.cc (type_has_padding_at_level_p): New.
* fold-const.cc (native_encode_constructor): New.
(native_encode_expr): Call it.
* gimplify.cc (gimplify_init_constructor): Clear small
non-addressable non-volatile objects with padding or
other uninitialized fields as an optimization.

for  gcc/testsuite/ChangeLog

* gcc.dg/init-pad-1.c: New.

Diff:
---
 gcc/expr.cc   | 20 ++--
 gcc/expr.h|  3 ++-
 gcc/fold-const.cc | 36 
 gcc/gimple-fold.cc| 50 +++
 gcc/gimplify.cc   | 14 ++-
 gcc/testsuite/gcc.dg/init-pad-1.c | 18 ++
 6 files changed, 132 insertions(+), 9 deletions(-)

diff --git a/gcc/expr.cc b/gcc/expr.cc
index 8d17a5a39b4b..320be8b17a13 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7096,7 +7096,7 @@ count_type_elements (const_tree type, bool for_ctor_p)
 static bool
 categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
HOST_WIDE_INT *p_unique_nz_elts,
-   HOST_WIDE_INT *p_init_elts, bool *p_complete)
+   HOST_WIDE_INT *p_init_elts, int *p_complete)
 {
   unsigned HOST_WIDE_INT idx;
   HOST_WIDE_INT nz_elts, unique_nz_elts, init_elts, num_fields;
@@ -7218,7 +7218,10 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
 
   if (*p_complete && !complete_ctor_at_level_p (TREE_TYPE (ctor),
num_fields, elt_type))
-*p_complete = false;
+*p_complete = 0;
+  else if (*p_complete > 0
+  && type_has_padding_at_level_p (TREE_TYPE (ctor)))
+*p_complete = -1;
 
   *p_nz_elts += nz_elts;
   *p_unique_nz_elts += unique_nz_elts;
@@ -7239,7 +7242,10 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
  and place it in *P_ELT_COUNT.
* whether the constructor is complete -- in the sense that every
  meaningful byte is explicitly given a value --
- and place it in *P_COMPLETE.
+ and place it in *P_COMPLETE:
+ -  0 if any field is missing
+ -  1 if all fields are initialized, and there's no padding
+ - -1 if all fields are initialized, but there's padding
 
Return whether or not CTOR is a valid static constant initializer, the same
as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0".  */
@@ -7247,12 +7253,12 @@ categorize_ctor_elements_1 (const_tree ctor, 
HOST_WIDE_INT *p_nz_elts,
 bool
 categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
  HOST_WIDE_INT *p_unique_nz_elts,
- HOST_WIDE_INT *p_init_elts, bool *p_complete)
+ HOST_WIDE_INT *p_init_elts, int *p_complete)
 {
   *p_nz_elts = 0;
   *p_unique_nz_elts = 0;
   *p_init_elts = 0;
-  *p_complete = true;
+  *p_complete = 1;
 
   return categorize_ctor_elements_1 (ctor, p_nz_elts, p_unique_nz_elts,
 p_init_elts, p_complete);
@@ -7313,7 +7319,7 @@ mostly_zeros_p (const_tree exp)
   if (TR

[gcc r15-3384] [testsuite] add linkonly to dg-additional-sources [PR115295]

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:9223d1715918e4e8e7a59471b228f815b4a3467c

commit r15-3384-g9223d1715918e4e8e7a59471b228f815b4a3467c
Author: Alexandre Oliva 
Date:   Mon Sep 2 11:31:51 2024 -0300

[testsuite] add linkonly to dg-additional-sources [PR115295]

The D testsuite shows it was a mistake to assume that
dg-additional-sources are never to be used for compilation tests.
Even if an output file is specified for compilation, extra module
files can be named and used in the compilation without being flagged
as errors.

Introduce a 'linkonly' flag for dg-additional-sources, and use it in
pr95401.cc and other vector tests that default to run, so that its
additional sources get discarded when vector tests downgrade to
compile-only.  This reverts previous workarounds for this very
circumstance, that relied on being able to run vector tests anyway,
even after failing to detect runtime or hardware vector support.


for  gcc/ChangeLog

PR d/115295
* doc/sourcebuild.texi (dg-additional-sources): Add linkonly.

for  gcc/testsuite/ChangeLog

PR d/115295
* g++.dg/vect/pr95401.cc: Add linkonly to dg-additional-sources.
* g++.dg/vect/pr68762-1.cc: Likewise.
* g++.dg/vect/simd-clone-3.cc: Likewise.
* g++.dg/vect/simd-clone-5.cc: Likewise.
* gcc.dg/vect/vect-simd-clone-10.c: Likewise.  Drop dg-do run.
* gcc.dg/vect/vect-simd-clone-12.c: Likewise.  Likewise.
* lib/gcc-defs.exp (additional_sources_omit_on_compile): New.
(dg-additional-sources): Add to it on linkonly.
(dg-additional-files-options): Omit select sources on compile.

Diff:
---
 gcc/doc/sourcebuild.texi   |  9 ---
 gcc/testsuite/g++.dg/vect/pr68762-1.cc |  2 +-
 gcc/testsuite/g++.dg/vect/pr95401.cc   |  2 +-
 gcc/testsuite/g++.dg/vect/simd-clone-3.cc  |  2 +-
 gcc/testsuite/g++.dg/vect/simd-clone-5.cc  |  2 +-
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c |  4 +--
 gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c |  4 +--
 gcc/testsuite/lib/gcc-defs.exp | 35 --
 8 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 0636fc0567c5..7c7094dc5a92 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1328,15 +1328,16 @@ to @var{var_value} before execution of the program 
created by the test.
 Specify additional files, other than source files, that must be copied
 to the system where the compiler runs.
 
-@item @{ dg-additional-sources "@var{filelist}" [@{ target @var{selector} @}] 
@}
+@item @{ dg-additional-sources "@var{filelist}" [@{ \[linkonly\] \[target 
@var{selector}\] @}] @}
 Specify additional source files to appear in the compile line
 following the main test file.
 If the directive includes the optional @samp{@{ @var{selector} @}}
 then the additional sources are only added if the target system
 matches the @var{selector}.
-Additional sources are generally used only in @samp{link} and @samp{run}
-tests; they are reported as unsupported and discarded in other kinds of
-tests that direct the compiler to output to a single file.
+If @samp{linkonly} is specified, additional sources are used only in
+@samp{link} and @samp{run} tests; they are reported as unsupported and
+discarded in other kinds of tests that direct the compiler to output to
+a single file.
 @end table
 
 @subsubsection Add checks at the end of a test
diff --git a/gcc/testsuite/g++.dg/vect/pr68762-1.cc 
b/gcc/testsuite/g++.dg/vect/pr68762-1.cc
index 118a301ab90d..53cc6e4c6dfa 100644
--- a/gcc/testsuite/g++.dg/vect/pr68762-1.cc
+++ b/gcc/testsuite/g++.dg/vect/pr68762-1.cc
@@ -2,7 +2,7 @@
 // { dg-require-effective-target vect_simd_clones }
 // { dg-additional-options "-fopenmp-simd -fno-inline" }
 // { dg-additional-options "-mavx" { target avx_runtime } }
-// { dg-additional-sources "pr68762-2.cc" }
+// { dg-additional-sources "pr68762-2.cc" linkonly }
 
 #include "pr68762.h"
 
diff --git a/gcc/testsuite/g++.dg/vect/pr95401.cc 
b/gcc/testsuite/g++.dg/vect/pr95401.cc
index 6a56dab09572..8b1be4f24252 100644
--- a/gcc/testsuite/g++.dg/vect/pr95401.cc
+++ b/gcc/testsuite/g++.dg/vect/pr95401.cc
@@ -1,5 +1,5 @@
 // { dg-additional-options "-mavx2 -O3" { target avx2_runtime } }
-// { dg-additional-sources pr95401a.cc }
+// { dg-additional-sources pr95401a.cc linkonly }
 
 extern int var_9;
 extern unsigned var_14;
diff --git a/gcc/testsuite/g++.dg/vect/simd-clone-3.cc 
b/gcc/testsuite/g++.dg/vect/simd-clone-3.cc
index 1057a7eb5f6a..4dd9d15d1a3b 100644
--- a/gcc/testsuite/g++.dg/vect/simd-clone-3.cc
+++ b/gcc/testsuite/g++.dg/vect/simd-clone-3.cc
@@ -1,7 +1,7 @@
 // { dg-require-effective-target vect_simd_clones }
 // { dg-additional-options "-fopenmp-simd -fno-inline" }
 // { dg-additional-options "-mavx" { target 

[gcc/aoliva/heads/testbase] (58 commits) [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 af1500dd8c00... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

It previously pointed to:

 673a448aa24e... Optimize initialization of small padded objects

Diff:

Summary of changes (added commits):
---

  af1500d... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra (*)
  410061b... [libstdc++] [testsuite] avoid async.cc loss of precision [P (*)
  9223d17... [testsuite] add linkonly to dg-additional-sources [PR115295 (*)
  b9bf0c3... amdgcn: Remove TARGET_GCN5_PLUS (*)
  023641d... amdgcn: Remove TARGET_GCN3 (*)
  57af002... amdgcn: remove gfx803 "Fiji" support (*)
  78dc2e2... PR modula2/116557 Remove physical address from the GPL head (*)
  4bf758b... libsupc++: Fix handling of m68k extended real in  (*)
  e4d3e7f... testsuite: Rename scanltranstree.exp -> scanltrans.exp (*)
  2865719... Rename gimple_asm_input_p to gimple_asm_basic_p (*)
  a4b6c6a... Rename ASM_INPUT_P to ASM_BASIC_P (*)
  5cbfb3a... lto/lto.cc: Fix build with not HAVE_WORKING_FORK (*)
  6640a59... lto-wrapper: Honor -save-temps for ltrans' makefile (*)
  571d045... ada: Diagnose too large size clause on floating-point type (*)
  1c9a6d8... ada: Create usage entry for -gnatw_l (*)
  2df253f... ada: Fix standard output stream for gnatcmd output (*)
  91f0a3a... ada: Fix minor issues in -gnaty0's documentation (*)
  a004c28... ada: Documentation for generic type inference (*)
  34437eb... ada: Small fixes for FreeBSD (*)
  cb690aa... ada: Also reset scope for some nested declaration (*)
  905ab32... ada: Cleanup expansion of object declarations (*)
  78acc6d... ada: Remove repeated guards in validity checks (*)
  25d51fb... ranger: Fix up range computation for CLZ [PR116486] (*)
  9aaedfc... load and store-lanes with SLP (*)
  464067a... lower SLP load permutation to interleaving (*)
  eca320b... [PATCH] RISC-V: Optimize the cost of the DFmode register mo (*)
  0562976... [committed][PR rtl-optimization/116544] Fix test for promot (*)
  f77435a... i386: Support vec_cmp for V8BF/V16BF/V32BF in AVX10.2 (*)
  e19f65b... i386: Support vectorized BF16 sqrt with AVX10.2 instruction (*)
  29ef601... i386: Support vectorized BF16 smaxmin with AVX10.2 instruct (*)
  6d294fb... i386: Support vectorized BF16 FMA with AVX10.2 instructions (*)
  f82fa0d... i386: Support vectorized BF16 add/sub/mul/div with AVX10.2  (*)
  3b1dece... i386: Optimize generate insn for AVX10.2 compare (*)
  86f5031... i386: Optimize ordered and nonequal (*)
  b1f9fbb... i386: Auto vectorize sdot_prod, usdot_prod, udot_prod with  (*)
  5239902... RISC-V: Add testcases for unsigned scalar quad and oct .SAT (*)
  ea81e21... RISC-V: Add testcases for unsigned scalar quad and oct .SAT (*)
  56ed1df... RISC-V: Add testcases for form 4 of unsigned vector .SAT_AD (*)
  72f3e90... RISC-V: Add testcases for form 3 of unsigned vector .SAT_AD (*)
  e96d4bf... RISC-V: Refactor gen zero_extend rtx for SAT_* when expand  (*)
  880834d... Daily bump. (*)
  592a335... slsr: Use simple_dce_from_worklist in SLSR [PR116554] (*)
  f22788c... testsuite: Prune compilation messages for modules tests (*)
  49fd9b3... Daily bump. (*)
  bac00c3... i386: Support read-modify-write memory operands in STV. (*)
  2ac27bd... libobjc: Add cast to void* to disable warning for casting b (*)
  df89afb... AVR: Run pass avr-fuse-add a second time after pass_cprop_h (*)
  60fc550... AVR: Tidy pass avr-fuse-add. (*)
  7f27d1f... testsuite, c++, coroutines: Avoid 'unused' warnings [NFC]. (*)
  2c27189... testsuite, c++, coroutines: Correct a test intent. (*)
  049a927... c++, coroutines: Make and use a frame access helper. (*)
  b7e9f36... hppa: Enable PA 2.0 symbolic operands on ELF32 targets (*)
  ceda727... phiopt: Ignore some nop statements in heursics [PR116098] (*)
  457805c... testsuite: Change what is being tested for pr66726-2.c (*)
  79b5b50... Fortran: downgrade use associated namelist group name to le (*)
  afd9558... c++: Add unsequenced C++ testcase (*)
  dd346b6... c: Add support for unsequenced and reproducible attributes (*)
  dc476e5... AVR: Don't print a space after , when printing instructions (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testbase' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc/aoliva/heads/testme] (60 commits) more hostedlib notes

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 07051d45ce80... more hostedlib notes

It previously pointed to:

 62b70aa09f1c... testsuite: introduce hostedlib effective target

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  62b70aa... testsuite: introduce hostedlib effective target


Summary of changes (added commits):
---

  07051d4... more hostedlib notes
  9abd783... testsuite: introduce hostedlib effective target
  af1500d... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra (*)
  410061b... [libstdc++] [testsuite] avoid async.cc loss of precision [P (*)
  9223d17... [testsuite] add linkonly to dg-additional-sources [PR115295 (*)
  b9bf0c3... amdgcn: Remove TARGET_GCN5_PLUS (*)
  023641d... amdgcn: Remove TARGET_GCN3 (*)
  57af002... amdgcn: remove gfx803 "Fiji" support (*)
  78dc2e2... PR modula2/116557 Remove physical address from the GPL head (*)
  4bf758b... libsupc++: Fix handling of m68k extended real in  (*)
  e4d3e7f... testsuite: Rename scanltranstree.exp -> scanltrans.exp (*)
  2865719... Rename gimple_asm_input_p to gimple_asm_basic_p (*)
  a4b6c6a... Rename ASM_INPUT_P to ASM_BASIC_P (*)
  5cbfb3a... lto/lto.cc: Fix build with not HAVE_WORKING_FORK (*)
  6640a59... lto-wrapper: Honor -save-temps for ltrans' makefile (*)
  571d045... ada: Diagnose too large size clause on floating-point type (*)
  1c9a6d8... ada: Create usage entry for -gnatw_l (*)
  2df253f... ada: Fix standard output stream for gnatcmd output (*)
  91f0a3a... ada: Fix minor issues in -gnaty0's documentation (*)
  a004c28... ada: Documentation for generic type inference (*)
  34437eb... ada: Small fixes for FreeBSD (*)
  cb690aa... ada: Also reset scope for some nested declaration (*)
  905ab32... ada: Cleanup expansion of object declarations (*)
  78acc6d... ada: Remove repeated guards in validity checks (*)
  25d51fb... ranger: Fix up range computation for CLZ [PR116486] (*)
  9aaedfc... load and store-lanes with SLP (*)
  464067a... lower SLP load permutation to interleaving (*)
  eca320b... [PATCH] RISC-V: Optimize the cost of the DFmode register mo (*)
  0562976... [committed][PR rtl-optimization/116544] Fix test for promot (*)
  f77435a... i386: Support vec_cmp for V8BF/V16BF/V32BF in AVX10.2 (*)
  e19f65b... i386: Support vectorized BF16 sqrt with AVX10.2 instruction (*)
  29ef601... i386: Support vectorized BF16 smaxmin with AVX10.2 instruct (*)
  6d294fb... i386: Support vectorized BF16 FMA with AVX10.2 instructions (*)
  f82fa0d... i386: Support vectorized BF16 add/sub/mul/div with AVX10.2  (*)
  3b1dece... i386: Optimize generate insn for AVX10.2 compare (*)
  86f5031... i386: Optimize ordered and nonequal (*)
  b1f9fbb... i386: Auto vectorize sdot_prod, usdot_prod, udot_prod with  (*)
  5239902... RISC-V: Add testcases for unsigned scalar quad and oct .SAT (*)
  ea81e21... RISC-V: Add testcases for unsigned scalar quad and oct .SAT (*)
  56ed1df... RISC-V: Add testcases for form 4 of unsigned vector .SAT_AD (*)
  72f3e90... RISC-V: Add testcases for form 3 of unsigned vector .SAT_AD (*)
  e96d4bf... RISC-V: Refactor gen zero_extend rtx for SAT_* when expand  (*)
  880834d... Daily bump. (*)
  592a335... slsr: Use simple_dce_from_worklist in SLSR [PR116554] (*)
  f22788c... testsuite: Prune compilation messages for modules tests (*)
  49fd9b3... Daily bump. (*)
  bac00c3... i386: Support read-modify-write memory operands in STV. (*)
  2ac27bd... libobjc: Add cast to void* to disable warning for casting b (*)
  df89afb... AVR: Run pass avr-fuse-add a second time after pass_cprop_h (*)
  60fc550... AVR: Tidy pass avr-fuse-add. (*)
  7f27d1f... testsuite, c++, coroutines: Avoid 'unused' warnings [NFC]. (*)
  2c27189... testsuite, c++, coroutines: Correct a test intent. (*)
  049a927... c++, coroutines: Make and use a frame access helper. (*)
  b7e9f36... hppa: Enable PA 2.0 symbolic operands on ELF32 targets (*)
  ceda727... phiopt: Ignore some nop statements in heursics [PR116098] (*)
  457805c... testsuite: Change what is being tested for pr66726-2.c (*)
  79b5b50... Fortran: downgrade use associated namelist group name to le (*)
  afd9558... c++: Add unsequenced C++ testcase (*)
  dd346b6... c: Add support for unsequenced and reproducible attributes (*)
  dc476e5... AVR: Don't print a space after , when printing instructions (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testme' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc(refs/users/aoliva/heads/testme)] more hostedlib notes

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:07051d45ce803cf70272fcbfce71828598c1d7c8

commit 07051d45ce803cf70272fcbfce71828598c1d7c8
Author: Alexandre Oliva 
Date:   Sat Aug 31 14:54:41 2024 -0300

more hostedlib notes

Diff:
---
 gcc/testsuite/c-c++-common/goacc/kernels-counter-vars-function-scope.c  | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-2.c   | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-3.c   | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-data-2.c  | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit-2.c   | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-data-enter-exit.c | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-data-update.c | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-data.c| 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-g.c   | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c| 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop-n.c   | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-loop.c | 1 +
 gcc/testsuite/c-c++-common/goacc/kernels-one-counter-var.c  | 1 +
 .../c-c++-common/goacc/kernels-parallel-loop-data-enter-exit.c  | 1 +
 gcc/testsuite/c-c++-common/gomp/pr103642.c  | 1 +
 gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c | 2 ++
 gcc/testsuite/c-c++-common/simulate-thread/bitfields-4.c| 1 +
 gcc/testsuite/c-c++-common/tm/malloc.c  | 1 +
 gcc/testsuite/g++.dg/abi/mangle36.C | 1 +
 gcc/testsuite/g++.dg/abi/mangle40.C | 1 +
 gcc/testsuite/g++.dg/abi/mangle41.C | 1 +
 gcc/testsuite/g++.dg/cdce3.C| 1 +
 gcc/testsuite/g++.dg/contracts/contracts-post7.C| 1 +
 gcc/testsuite/g++.dg/contracts/pr110159.C   | 1 +
 gcc/testsuite/g++.dg/contracts/pr115434.C   | 1 +
 .../g++.dg/coroutines/coro-bad-gro-00-class-gro-scalar-return.C | 2 ++
 .../g++.dg/coroutines/coro-bad-gro-01-void-gro-non-class-coro.C | 2 ++
 gcc/testsuite/g++.dg/coroutines/pr110635.C  | 1 +
 gcc/testsuite/g++.dg/coroutines/pr110871.C  | 2 ++
 gcc/testsuite/g++.dg/coroutines/pr110872.C  | 1 +
 gcc/testsuite/g++.dg/coroutines/symmetric-transfer-00-basic.C   | 1 +
 gcc/testsuite/g++.dg/coroutines/torture/co-yield-03-tmpl-nondependent.C | 1 +
 gcc/testsuite/g++.dg/cpp/pr80005.C  | 1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-std-function.C | 1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this8.C| 1 +
 gcc/testsuite/g++.dg/cpp0x/pr70887.C| 1 +
 gcc/testsuite/g++.dg/cpp0x/udlit-extended-id-1.C| 2 ++
 gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C | 1 +
 gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic2.C   | 1 +
 gcc/testsuite/g++.dg/cpp1z/constexpr-asm-1.C| 1 +
 gcc/testsuite/g++.dg/cpp1z/constexpr-asm-3.C| 1 +
 gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C | 1 +
 gcc/testsuite/g++.dg/cpp23/ext-floating12.C | 1 +
 gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C | 1 +
 gcc/testsuite/g++.dg/cpp26/constexpr-new2.C | 1 +
 gcc/testsuite/g++.dg/cpp26/constexpr-voidptr1.C | 1 +
 gcc/testsuite/g++.dg/cpp26/feat-cxx26.C | 1 +
 gcc/testsuite/g++.dg/cpp2a/destroying-delete5.C | 1 +
 gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C | 1 +
 gcc/testsuite/g++.dg/diagnostic/missing-header-pr110164.C   | 1 +
 gcc/testsuite/g++.dg/expr/anew1.C   | 2 ++
 gcc/testsuite/g++.dg/expr/anew2.C   | 2 ++
 gcc/testsuite/g++.dg/expr/anew3.C   | 2 ++
 gcc/testsuite/g++.dg/expr/anew4.C   | 2 ++
 gcc/testsuite/g++.dg/ext/builtin10.C| 1 +
 gcc/testsuite/g++.dg/ext/cleanup-10.C   | 1 +
 gcc/testsuite/g++.dg/ext/cleanup-11.C   | 1 +
 gcc/testsuite/g++.dg/ext/cleanup-5.C| 1 +
 gcc/testsuite/g++.dg/ext/cleanup-8.C| 1 +
 gcc/testsuite/g++.dg/ext/cleanup-9.C| 1 +
 gcc/testsuite/g++.dg/ext/is_invocabl

[gcc/aoliva/heads/testme] more hostedlib notes

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 352f61e0d8d1... more hostedlib notes

It previously pointed to:

 07051d45ce80... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  07051d4... more hostedlib notes


Summary of changes (added commits):
---

  352f61e... more hostedlib notes


[gcc/aoliva/heads/testme] more hostedlib notes

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 93208984e9f2... more hostedlib notes

It previously pointed to:

 352f61e0d8d1... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  352f61e... more hostedlib notes


Summary of changes (added commits):
---

  9320898... more hostedlib notes


[gcc/aoliva/heads/testme] more hostedlib notes

2024-09-02 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 4c3d24ebc5a1... more hostedlib notes

It previously pointed to:

 93208984e9f2... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  9320898... more hostedlib notes


Summary of changes (added commits):
---

  4c3d24e... more hostedlib notes


[gcc/aoliva/heads/testme] more hostedlib notes

2024-09-03 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 62adc720792b... more hostedlib notes

It previously pointed to:

 4c3d24ebc5a1... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  4c3d24e... more hostedlib notes


Summary of changes (added commits):
---

  62adc72... more hostedlib notes


[gcc/aoliva/heads/testme] more hostedlib notes

2024-09-03 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 97ab3254903... more hostedlib notes

It previously pointed to:

 62adc720792... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  62adc72... more hostedlib notes


Summary of changes (added commits):
---

  97ab325... more hostedlib notes


[gcc/aoliva/heads/testme] testsuite: introduce hostedlib effective target

2024-09-03 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 6af8ecc3949... testsuite: introduce hostedlib effective target

It previously pointed to:

 97ab3254903... more hostedlib notes

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  97ab325... more hostedlib notes
  9abd783... testsuite: introduce hostedlib effective target


Summary of changes (added commits):
---

  6af8ecc... testsuite: introduce hostedlib effective target


[gcc/aoliva/heads/testbase] (512 commits) Update gcc uk.po

2024-09-06 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 d4d7c4e21984... Update gcc uk.po

It previously pointed to:

 af1500dd8c00... [libstdc++-v3] [testsuite] improve future/*/poll.cc calibra

Diff:

Summary of changes (added commits):
---

  d4d7c4e... Update gcc uk.po (*)
  aedf6f8... Daily bump. (*)
  fe66863... c++: vtable referring to "unavailable" virtual fn [PR116606 (*)
  6abedee... ipa: Don't disable function parameter analysis for fat LTO (*)
  2490951... libsanitizer: On aarch64 use hint #34 in prologue of libsan (*)
  73afc3e... lower-bitint: Fix up __builtin_{add,sub}_overflow{,_p} biti (*)
  6fb41c2... Don't call clean_symbol_name in create_tmp_var_name [PR1162 (*)
  040b979... testsuite: remove -fwrapv from signbit-5.c (*)
  0c4a95e... Daily bump. (*)
  a054ba5... libstdc++: Fix error handling in fs::hard_link_count for Wi (*)
  35c9814... libstdc++: Fix overwriting files with fs::copy_file on Wind (*)
  ec1bcd1... libstdc++: Fix fs::hard_link_count behaviour on MinGW [PR11 (*)
  ee37d75... libstdc++: Specialize std::disable_sized_sentinel_for for s (*)
  4696026... libstdc++: Add missing feature-test macro in various header (*)
  3b8a67b... libstdc++: Fix std::variant to reject array types [PR116381 (*)
  9899be7... aarch64: Fix ls64 intrinsic availability (*)
  8485606... aarch64: Fix memtag intrinsic availability (*)
  0a3a0d4... aarch64: Fix tme intrinsic availability (*)
  422c3f1... aarch64: Move check_required_extensions (*)
  c6e04d1... aarch64: Refactor check_required_extensions (*)
  0562522... lto: Don't check obj.found for offload section (*)
  66eb7b7... Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook (*)
  5c1955f... Daily bump. (*)
  59157c0... i386: Fix vfpclassph non-optimizied intrin (*)
  2ac3806... Daily bump. (*)
  ba9a3f1... Check avx upper register for parallel. (*)
  db4d810... Daily bump. (*)
  a2e32a8... Daily bump. (*)
  657bf4a... Daily bump. (*)
  5999dd8... Fortran: fix ICE with use with rename of namelist member [P (*)
  552c7c1... Daily bump. (*)
  d3c14d4... Daily bump. (*)
  4d6c0c0... Add gcc ka.po (*)
  f5b3dae... i386: testsuite: Adapt fentryname3.c for r14-811 change [PR (*)
  377c3e9... i386: testsuite: Add -no-pie for pr113689-1.c [PR70150] (*)
  87aea23... Daily bump. (*)
  90b1232... Update gcc zh_CN.po (*)
  75892d9... MIPS: Include missing mips16.S in libgcc/lib1funcs.S (*)
  ef9c53b... Daily bump. (*)
  b414466... Daily bump. (*)
  5b75e1c... Daily bump. (*)
  8de3153... Daily bump. (*)
  27dc153... Align ix86_{move_max,store_max} with vectorizer. (*)
  ffd458d... Daily bump. (*)
  5146af5... Daily bump. (*)
  25812d8... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281] (*)
  76ac167... Daily bump. (*)
  52da858... c++: fix ICE in convert_nontype_argument [PR116384] (*)
  af97b5e... testsuite: Prune warning about size of enums (*)
  1fad6ad... Daily bump. (*)
  c725748... AVR: ad target/116407 - Fix linker error "relocation trunca (*)
  919c42b... AVR: target/116407 - Fix linker error "relocation truncated (*)
  f4ce098... Daily bump. (*)
  f3d9c12... AVR: target/116390 - Fix an avrtiny asm out template. (*)
  0296001... Daily bump. (*)
  507b4e1... AVR: target/85624 - Use HImode for clrmemqi alignment. (*)
  edf95a4... testsuite: Verify -fshort-enums and -fno-short-enums in pr3 (*)
  5c1f687... testsuite: Add -fno-short-enums to pr97315-1.C (*)
  345d145... testsuite: Add -fwrapv to signbit-5.c (*)
  45a771d... i386: Fix some vex insns that prohibit egpr (*)
  86dacfb... aarch64: Add another use of force_subreg [PR115464] (*)
  32b2129... aarch64: Fix invalid nested subregs [PR115464] (*)
  4e7735a... Move ix86_align_loops into a separate pass and insert the p (*)
  ccca8df... Daily bump. (*)
  63c51e0... c++/coroutines: fix passing *this to promise type, again [P (*)
  d9bd361... [PATCH] RISC-V: Fix unresolved mcpu-[67].c tests (*)
  8c98f06... RISC-V: Make full-vec-move1.c test robust for optimization (*)
  7268985... Daily bump. (*)
  e903ada... s390: Fix high-level builtins vec_gfmsum{,_accum}_128 (*)
  5a63e19... Daily bump. (*)
  7d9bb37... Add -mcpu=power11 support. (*)
  f688431... Daily bump. (*)
  6bfd78c... Daily bump. (*)
  534ffe7... Daily bump. (*)
  6f1e687... Daily bump. (*)
  b0dd13e... i386: Fix up __builtin_ia32_b{extr{,i}_u{32,64},zhi_{s,d}i} (*)
  897cd79... Daily bump. (*)
  9ca1d7a... AVR: target/116295 - Fix unrecognizable insn with __flash r (*)
  a9255df... Daily bump. (*)
  49e8eee... Daily bump. (*)
  b1102f7... c++: alias and non-type template parm [PR116223] (*)
  987fc81... c++: parse error with -std=c++14 -fconcepts [PR116071] (*)
  ba26c47... hppa: Fix (plus (plus (mult (a) (mem_shadd_constant)) (b))  (*)
  f2b5ca6... wide-int: Fix up mul_internal overflow checking [PR116224] (*)
  3fe5720... libquadmath: Fix up libquadmath/math/sqrtq.c compilation in (*)
  cad2693... fortran: Fix up pasto in gfc_get_array_descr_info (*)
  ba45573... sh: Don't call make_ins

[gcc/aoliva/heads/testme] (513 commits) testsuite: introduce hostedlib effective target

2024-09-06 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 f65e763abf41... testsuite: introduce hostedlib effective target

It previously pointed to:

 6af8ecc3949a... testsuite: introduce hostedlib effective target

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  6af8ecc... testsuite: introduce hostedlib effective target


Summary of changes (added commits):
---

  f65e763... testsuite: introduce hostedlib effective target
  d4d7c4e... Update gcc uk.po (*)
  aedf6f8... Daily bump. (*)
  fe66863... c++: vtable referring to "unavailable" virtual fn [PR116606 (*)
  6abedee... ipa: Don't disable function parameter analysis for fat LTO (*)
  2490951... libsanitizer: On aarch64 use hint #34 in prologue of libsan (*)
  73afc3e... lower-bitint: Fix up __builtin_{add,sub}_overflow{,_p} biti (*)
  6fb41c2... Don't call clean_symbol_name in create_tmp_var_name [PR1162 (*)
  040b979... testsuite: remove -fwrapv from signbit-5.c (*)
  0c4a95e... Daily bump. (*)
  a054ba5... libstdc++: Fix error handling in fs::hard_link_count for Wi (*)
  35c9814... libstdc++: Fix overwriting files with fs::copy_file on Wind (*)
  ec1bcd1... libstdc++: Fix fs::hard_link_count behaviour on MinGW [PR11 (*)
  ee37d75... libstdc++: Specialize std::disable_sized_sentinel_for for s (*)
  4696026... libstdc++: Add missing feature-test macro in various header (*)
  3b8a67b... libstdc++: Fix std::variant to reject array types [PR116381 (*)
  9899be7... aarch64: Fix ls64 intrinsic availability (*)
  8485606... aarch64: Fix memtag intrinsic availability (*)
  0a3a0d4... aarch64: Fix tme intrinsic availability (*)
  422c3f1... aarch64: Move check_required_extensions (*)
  c6e04d1... aarch64: Refactor check_required_extensions (*)
  0562522... lto: Don't check obj.found for offload section (*)
  66eb7b7... Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook (*)
  5c1955f... Daily bump. (*)
  59157c0... i386: Fix vfpclassph non-optimizied intrin (*)
  2ac3806... Daily bump. (*)
  ba9a3f1... Check avx upper register for parallel. (*)
  db4d810... Daily bump. (*)
  a2e32a8... Daily bump. (*)
  657bf4a... Daily bump. (*)
  5999dd8... Fortran: fix ICE with use with rename of namelist member [P (*)
  552c7c1... Daily bump. (*)
  d3c14d4... Daily bump. (*)
  4d6c0c0... Add gcc ka.po (*)
  f5b3dae... i386: testsuite: Adapt fentryname3.c for r14-811 change [PR (*)
  377c3e9... i386: testsuite: Add -no-pie for pr113689-1.c [PR70150] (*)
  87aea23... Daily bump. (*)
  90b1232... Update gcc zh_CN.po (*)
  75892d9... MIPS: Include missing mips16.S in libgcc/lib1funcs.S (*)
  ef9c53b... Daily bump. (*)
  b414466... Daily bump. (*)
  5b75e1c... Daily bump. (*)
  8de3153... Daily bump. (*)
  27dc153... Align ix86_{move_max,store_max} with vectorizer. (*)
  ffd458d... Daily bump. (*)
  5146af5... Daily bump. (*)
  25812d8... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281] (*)
  76ac167... Daily bump. (*)
  52da858... c++: fix ICE in convert_nontype_argument [PR116384] (*)
  af97b5e... testsuite: Prune warning about size of enums (*)
  1fad6ad... Daily bump. (*)
  c725748... AVR: ad target/116407 - Fix linker error "relocation trunca (*)
  919c42b... AVR: target/116407 - Fix linker error "relocation truncated (*)
  f4ce098... Daily bump. (*)
  f3d9c12... AVR: target/116390 - Fix an avrtiny asm out template. (*)
  0296001... Daily bump. (*)
  507b4e1... AVR: target/85624 - Use HImode for clrmemqi alignment. (*)
  edf95a4... testsuite: Verify -fshort-enums and -fno-short-enums in pr3 (*)
  5c1f687... testsuite: Add -fno-short-enums to pr97315-1.C (*)
  345d145... testsuite: Add -fwrapv to signbit-5.c (*)
  45a771d... i386: Fix some vex insns that prohibit egpr (*)
  86dacfb... aarch64: Add another use of force_subreg [PR115464] (*)
  32b2129... aarch64: Fix invalid nested subregs [PR115464] (*)
  4e7735a... Move ix86_align_loops into a separate pass and insert the p (*)
  ccca8df... Daily bump. (*)
  63c51e0... c++/coroutines: fix passing *this to promise type, again [P (*)
  d9bd361... [PATCH] RISC-V: Fix unresolved mcpu-[67].c tests (*)
  8c98f06... RISC-V: Make full-vec-move1.c test robust for optimization (*)
  7268985... Daily bump. (*)
  e903ada... s390: Fix high-level builtins vec_gfmsum{,_accum}_128 (*)
  5a63e19... Daily bump. (*)
  7d9bb37... Add -mcpu=power11 support. (*)
  f688431... Daily bump. (*)
  6bfd78c... Daily bump. (*)
  534ffe7... Daily bump. (*)
  6f1e687... Daily bump. (*)
  b0dd13e... i386: Fix up __builtin_ia32_b{extr{,i}_u{32,64},zhi_{s,d}i} (*)
  897cd79... Daily bump. (*)
  9ca1d7a... AVR: target/116295 - Fix unrecognizable insn with __flash r (*)
  a9255df... Daily bump. (*)
  49e8eee... Daily bump. (*)
  b1102f7... c++: alias and non-type template parm [PR116223] (*)
  987fc81... c++: parse error with -std=c++14 -fconcepts [PR116071] (*)
  ba26c47... hppa: Fix (plus (plus (mult (a) (mem_shadd

[gcc/aoliva/heads/testme] testsuite: introduce hostedlib effective target

2024-09-06 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 fb5b60dab71e... testsuite: introduce hostedlib effective target

It previously pointed to:

 f65e763abf41... testsuite: introduce hostedlib effective target

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  f65e763... testsuite: introduce hostedlib effective target


Summary of changes (added commits):
---

  fb5b60d... testsuite: introduce hostedlib effective target


[gcc/aoliva/heads/testme] testsuite: introduce hostedlib effective target

2024-09-06 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 38cc6007421e... testsuite: introduce hostedlib effective target

It previously pointed to:

 fb5b60dab71e... testsuite: introduce hostedlib effective target

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  fb5b60d... testsuite: introduce hostedlib effective target


Summary of changes (added commits):
---

  38cc600... testsuite: introduce hostedlib effective target


[gcc(refs/users/aoliva/heads/testme)] assorted improvements for fold_truth_andor_1

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:5c5b83b5ad497638c9bf250d2ea33d67d758cc77

commit 5c5b83b5ad497638c9bf250d2ea33d67d758cc77
Author: Alexandre Oliva 
Date:   Tue Sep 29 04:08:46 2020 -0300

assorted improvements for fold_truth_andor_1

This patch introduces various improvements to the logic that merges
field compares.

Before the patch, we could merge:

  (a.x1 EQNE b.x1)  ANDOR  (a.y1 EQNE b.y1)

into something like:

  (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK)

if both of A's fields live within the same alignment boundaries, and
so do B's, at the same relative positions.  Constants may be used
instead of the object B.

The initial goal of this patch was to enable such combinations when a
field crossed alignment boundaries, e.g. for packed types.  We can't
generally access such fields with a single memory access, so when we
come across such a compare, we will attempt to combine each access
separately.

Some merging opportunities were missed because of right-shifts,
compares expressed as e.g. ((a.x1 ^ b.x1) & MASK) EQNE 0, and
narrowing conversions, especially after earlier merges.  This patch
introduces handlers for several cases involving these.

Other merging opportunities were missed because of association.  The
existing logic would only succeed in merging a pair of consecutive
compares, or e.g. B with C in (A ANDOR B) ANDOR C, not even trying
e.g. C and D in (A ANDOR (B ANDOR C)) ANDOR D.  I've generalized the
handling of the rightmost compare in the left-hand operand, going for
the leftmost compare in the right-hand operand, and then onto trying
to merge compares pairwise, one from each operand, even if they are
not consecutive, taking care to avoid merging operations with
intervening side effects, including volatile accesses.

When it is the second of a non-consecutive pair of compares that first
accesses a word, we may merge the first compare with part of the
second compare that refers to the same word, keeping the compare of
the remaining bits at the spot where the second compare used to be.

Handling compares with non-constant fields was somewhat generalized,
now handling non-adjacent fields.  When a field of one object crosses
an alignment boundary but the other doesn't, we issue the same load in
both compares; gimple optimizers will later turn it into a single
load, without our having to handle SAVE_EXPRs at this point.

The logic for issuing split loads and compares, and ordering them, is
now shared between all cases of compares with constants and with
another object.

The -Wno-error for toplev.o on rs6000 is because of toplev.c's:

  if ((flag_sanitize & SANITIZE_ADDRESS)
  && !FRAME_GROWS_DOWNWARD)

and rs6000.h's:

#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0   \
  || (flag_sanitize & SANITIZE_ADDRESS) != 0)

The mutually exclusive conditions involving flag_sanitize are now
noticed and reported by fold-const.c's:

  warning (0,
   "% of mutually exclusive equal-tests"
   " is always 0");

This patch enables over 12k compare-merging opportunities that we used
to miss in a GCC bootstrap.


for  gcc/ChangeLog

* fold-const.cc (prepare_xor): New.
(decode_field_reference): Handle xor, shift, and narrowing
conversions.
(all_ones_mask_p): Remove.
(compute_split_boundary_from_align): New.
(build_split_load, reuse_split_load): New.
(fold_truth_andor_1): Add recursion to combine pairs of
non-neighboring compares.  Handle xor compared with zero.
Handle fields straddling across alignment boundaries.
Generalize handling of non-constant rhs.
(fold_truth_andor): Leave sub-expression handling to the
recursion above.
* config/rs6000/t-rs6000 (toplev.o-warn): Disable errors.

for  gcc/testsuite/ChangeLog

* gcc.dg/field-merge-1.c: New.
* gcc.dg/field-merge-2.c: New.
* gcc.dg/field-merge-3.c: New.
* gcc.dg/field-merge-4.c: New.
* gcc.dg/field-merge-5.c: New.

Diff:
---
 gcc/config/rs6000/t-rs6000   |   4 +
 gcc/fold-const.cc| 818 ---
 gcc/testsuite/gcc.dg/field-merge-1.c |  64 +++
 gcc/testsuite/gcc.dg/field-merge-2.c |  31 ++
 gcc/testsuite/gcc.dg/field-merge-3.c |  36 ++
 gcc/testsuite/gcc.dg/field-merge-4.c |  40 ++
 gcc/testsuite/gcc.dg/field-merge-5.c |  40 ++
 7 files changed, 881 insertions(+), 152 deletions(-)

diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 155788de40a3..a83968d663a6 

[gcc(refs/users/aoliva/heads/testme)] testsuite: a few more hostedlib adjustments

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:6af7fe931d949dbf453fed41d2198abe2abd766c

commit 6af7fe931d949dbf453fed41d2198abe2abd766c
Author: Alexandre Oliva 
Date:   Thu Sep 12 20:03:53 2024 -0300

testsuite: a few more hostedlib adjustments

This adjusts some recently-added tests that won't compile without a
hostedlib libstdc++, missed in the patch that just went in, and also
an old test that I'd missed because it also failed in my baseline.


for  gcc/testsuite/ChangeLog

* g++.dg/coroutines/pr108620.C: Skip if !hostedlib because of
unavailable headers.
* g++.dg/other/profile1.C: Likewise.
* g+.dg/ext/pragma-unroll-lambda-lto.C: Skip if !hostedlib
because of unavailable declarations.

Diff:
---
 gcc/testsuite/g++.dg/coroutines/pr108620.C  | 2 ++
 gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C | 1 +
 gcc/testsuite/g++.dg/other/profile1.C   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr108620.C 
b/gcc/testsuite/g++.dg/coroutines/pr108620.C
index e8016b9f8a23..22bf0c18bac4 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr108620.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr108620.C
@@ -1,3 +1,5 @@
+// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
+
 // https://gcc.gnu.org/PR108620
 #include 
 #include 
diff --git a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C 
b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
index 144c4c326924..64cdf90f34d3 100644
--- a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
+++ b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
@@ -1,5 +1,6 @@
 // { dg-do link { target c++11 } }
 // { dg-options "-O2 -flto -fdump-rtl-loop2_unroll" }
+// { dg-skip-if "requires hosted libstdc++ for cstdlib rand" { ! hostedlib } }
 
 #include 
 
diff --git a/gcc/testsuite/g++.dg/other/profile1.C 
b/gcc/testsuite/g++.dg/other/profile1.C
index a4bf6b3d0fea..99844373189e 100644
--- a/gcc/testsuite/g++.dg/other/profile1.C
+++ b/gcc/testsuite/g++.dg/other/profile1.C
@@ -2,6 +2,7 @@
 // { dg-do run }
 // { dg-require-profiling "" }
 // { dg-options "-fnon-call-exceptions -fprofile-arcs" }
+// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
 
 #include 


[gcc/aoliva/heads/testme] (2 commits) assorted improvements for fold_truth_andor_1

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 66212571a719... assorted improvements for fold_truth_andor_1

It previously pointed to:

 6af7fe931d94... testsuite: a few more hostedlib adjustments

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  6af7fe9... testsuite: a few more hostedlib adjustments
  5c5b83b... assorted improvements for fold_truth_andor_1


Summary of changes (added commits):
---

  6621257... assorted improvements for fold_truth_andor_1
  90eb457... testsuite: a few more hostedlib adjustments


[gcc(refs/users/aoliva/heads/testme)] testsuite: a few more hostedlib adjustments

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:90eb457e05f73d5bd81beb3419b5803bb68491b1

commit 90eb457e05f73d5bd81beb3419b5803bb68491b1
Author: Alexandre Oliva 
Date:   Thu Sep 12 20:03:53 2024 -0300

testsuite: a few more hostedlib adjustments

This adjusts some recently-added tests that won't compile without a
hostedlib libstdc++, missed in the patch that just went in, and also
an old test that I'd missed because it also failed in my baseline.


for  gcc/testsuite/ChangeLog

* g++.dg/coroutines/pr108620.C: Skip if !hostedlib because of
unavailable headers.
* g++.dg/other/profile1.C: Likewise.
* g+.dg/ext/pragma-unroll-lambda-lto.C: Skip if !hostedlib
because of unavailable declarations.

Diff:
---
 gcc/testsuite/g++.dg/coroutines/pr108620.C  | 2 ++
 gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C | 1 +
 gcc/testsuite/g++.dg/other/profile1.C   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr108620.C 
b/gcc/testsuite/g++.dg/coroutines/pr108620.C
index e8016b9f8a23..22bf0c18bac4 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr108620.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr108620.C
@@ -1,3 +1,5 @@
+// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
+
 // https://gcc.gnu.org/PR108620
 #include 
 #include 
diff --git a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C 
b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
index 144c4c326924..64cdf90f34d3 100644
--- a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
+++ b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
@@ -1,5 +1,6 @@
 // { dg-do link { target c++11 } }
 // { dg-options "-O2 -flto -fdump-rtl-loop2_unroll" }
+// { dg-skip-if "requires hosted libstdc++ for cstdlib rand" { ! hostedlib } }
 
 #include 
 
diff --git a/gcc/testsuite/g++.dg/other/profile1.C 
b/gcc/testsuite/g++.dg/other/profile1.C
index a4bf6b3d0fea..99844373189e 100644
--- a/gcc/testsuite/g++.dg/other/profile1.C
+++ b/gcc/testsuite/g++.dg/other/profile1.C
@@ -2,6 +2,7 @@
 // { dg-do run }
 // { dg-require-profiling "" }
 // { dg-options "-fnon-call-exceptions -fprofile-arcs" }
+// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
 
 #include 


[gcc(refs/users/aoliva/heads/testme)] assorted improvements for fold_truth_andor_1

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:66212571a719e4cfcedb59103eb8fd7dc52e84f8

commit 66212571a719e4cfcedb59103eb8fd7dc52e84f8
Author: Alexandre Oliva 
Date:   Tue Sep 29 04:08:46 2020 -0300

assorted improvements for fold_truth_andor_1

This patch introduces various improvements to the logic that merges
field compares.

Before the patch, we could merge:

  (a.x1 EQNE b.x1)  ANDOR  (a.y1 EQNE b.y1)

into something like:

  (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK)

if both of A's fields live within the same alignment boundaries, and
so do B's, at the same relative positions.  Constants may be used
instead of the object B.

The initial goal of this patch was to enable such combinations when a
field crossed alignment boundaries, e.g. for packed types.  We can't
generally access such fields with a single memory access, so when we
come across such a compare, we will attempt to combine each access
separately.

Some merging opportunities were missed because of right-shifts,
compares expressed as e.g. ((a.x1 ^ b.x1) & MASK) EQNE 0, and
narrowing conversions, especially after earlier merges.  This patch
introduces handlers for several cases involving these.

Other merging opportunities were missed because of association.  The
existing logic would only succeed in merging a pair of consecutive
compares, or e.g. B with C in (A ANDOR B) ANDOR C, not even trying
e.g. C and D in (A ANDOR (B ANDOR C)) ANDOR D.  I've generalized the
handling of the rightmost compare in the left-hand operand, going for
the leftmost compare in the right-hand operand, and then onto trying
to merge compares pairwise, one from each operand, even if they are
not consecutive, taking care to avoid merging operations with
intervening side effects, including volatile accesses.

When it is the second of a non-consecutive pair of compares that first
accesses a word, we may merge the first compare with part of the
second compare that refers to the same word, keeping the compare of
the remaining bits at the spot where the second compare used to be.

Handling compares with non-constant fields was somewhat generalized,
now handling non-adjacent fields.  When a field of one object crosses
an alignment boundary but the other doesn't, we issue the same load in
both compares; gimple optimizers will later turn it into a single
load, without our having to handle SAVE_EXPRs at this point.

The logic for issuing split loads and compares, and ordering them, is
now shared between all cases of compares with constants and with
another object.

The -Wno-error for toplev.o on rs6000 is because of toplev.c's:

  if ((flag_sanitize & SANITIZE_ADDRESS)
  && !FRAME_GROWS_DOWNWARD)

and rs6000.h's:

#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0   \
  || (flag_sanitize & SANITIZE_ADDRESS) != 0)

The mutually exclusive conditions involving flag_sanitize are now
noticed and reported by fold-const.c's:

  warning (0,
   "% of mutually exclusive equal-tests"
   " is always 0");

This patch enables over 12k compare-merging opportunities that we used
to miss in a GCC bootstrap.


for  gcc/ChangeLog

* fold-const.cc (prepare_xor): New.
(decode_field_reference): Handle xor, shift, and narrowing
conversions.
(all_ones_mask_p): Remove.
(compute_split_boundary_from_align): New.
(build_split_load, reuse_split_load): New.
(fold_truth_andor_1): Add recursion to combine pairs of
non-neighboring compares.  Handle xor compared with zero.
Handle fields straddling across alignment boundaries.
Generalize handling of non-constant rhs.
(fold_truth_andor): Leave sub-expression handling to the
recursion above.
* config/rs6000/t-rs6000 (toplev.o-warn): Disable errors.

for  gcc/testsuite/ChangeLog

* gcc.dg/field-merge-1.c: New.
* gcc.dg/field-merge-2.c: New.
* gcc.dg/field-merge-3.c: New.
* gcc.dg/field-merge-4.c: New.
* gcc.dg/field-merge-5.c: New.

Diff:
---
 gcc/config/rs6000/t-rs6000   |   4 +
 gcc/fold-const.cc| 818 ---
 gcc/testsuite/gcc.dg/field-merge-1.c |  64 +++
 gcc/testsuite/gcc.dg/field-merge-2.c |  31 ++
 gcc/testsuite/gcc.dg/field-merge-3.c |  36 ++
 gcc/testsuite/gcc.dg/field-merge-4.c |  40 ++
 gcc/testsuite/gcc.dg/field-merge-5.c |  40 ++
 7 files changed, 881 insertions(+), 152 deletions(-)

diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 155788de40a3..a83968d663a6 

[gcc(refs/users/aoliva/heads/testme)] rework truth_andor folding into tree-ssa-ifcombine

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:e4f6196e7a16de0ceb4b9f4b68993a1f8454a7fc

commit e4f6196e7a16de0ceb4b9f4b68993a1f8454a7fc
Author: Alexandre Oliva 
Date:   Tue Sep 29 12:55:20 2020 -0300

rework truth_andor folding into tree-ssa-ifcombine

Diff:
---
 gcc/fold-const.cc | 1048 +
 gcc/gimple-fold.cc| 1149 +
 gcc/tree-ssa-ifcombine.cc |7 +-
 3 files changed, 1170 insertions(+), 1034 deletions(-)

diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 81814de5b04b..19824e6a477f 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -137,7 +137,6 @@ static tree range_successor (tree);
 static tree fold_range_test (location_t, enum tree_code, tree, tree, tree);
 static tree fold_cond_expr_with_comparison (location_t, tree, enum tree_code,
tree, tree, tree, tree);
-static tree unextend (tree, int, int, tree);
 static tree extract_muldiv (tree, tree, enum tree_code, tree, bool *);
 static tree extract_muldiv_1 (tree, tree, enum tree_code, tree, bool *);
 static tree fold_binary_op_with_conditional_arg (location_t,
@@ -4695,7 +4694,7 @@ invert_truthvalue_loc (location_t loc, tree arg)
is the original memory reference used to preserve the alias set of
the access.  */
 
-static tree
+tree
 make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type,
HOST_WIDE_INT bitsize, poly_int64 bitpos,
int unsignedp, int reversep)
@@ -4945,212 +4944,6 @@ optimize_bit_field_compare (location_t loc, enum 
tree_code code,
   return lhs;
 }
 
-/* If *R_ARG is a constant zero, and L_ARG is a possibly masked
-   BIT_XOR_EXPR, return 1 and set *r_arg to l_arg.
-   Otherwise, return 0.
-
-   The returned value should be passed to decode_field_reference for it
-   to handle l_arg, and then doubled for r_arg.  */
-static int
-prepare_xor (tree l_arg, tree *r_arg)
-{
-  int ret = 0;
-
-  if (!integer_zerop (*r_arg))
-return ret;
-
-  tree exp = l_arg;
-  STRIP_NOPS (exp);
-
-  if (TREE_CODE (exp) == BIT_AND_EXPR)
-{
-  tree and_mask = TREE_OPERAND (exp, 1);
-  exp = TREE_OPERAND (exp, 0);
-  STRIP_NOPS (exp); STRIP_NOPS (and_mask);
-  if (TREE_CODE (and_mask) != INTEGER_CST)
-   return ret;
-}
-
-  if (TREE_CODE (exp) == BIT_XOR_EXPR)
-{
-  *r_arg = l_arg;
-  return 1;
-}
-
-  return ret;
-}
-
-/* Subroutine for fold_truth_andor_1: decode a field reference.
-
-   If EXP is a comparison reference, we return the innermost reference.
-
-   *PBITSIZE is set to the number of bits in the reference, *PBITPOS is
-   set to the starting bit number.
-
-   If the innermost field can be completely contained in a mode-sized
-   unit, *PMODE is set to that mode.  Otherwise, it is set to VOIDmode.
-
-   *PVOLATILEP is set to 1 if the any expression encountered is volatile;
-   otherwise it is not changed.
-
-   *PUNSIGNEDP is set to the signedness of the field.
-
-   *PREVERSEP is set to the storage order of the field.
-
-   *PMASK is set to the mask used.  This is either contained in a
-   BIT_AND_EXPR or derived from the width of the field.
-
-   *PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any.
-
-   XOR_WHICH is 1 or 2 if EXP was found to be a (possibly masked)
-   BIT_XOR_EXPR compared with zero.  We're to take the first or second
-   operand thereof if so.  It should be zero otherwise.
-
-   Return 0 if this is not a component reference or is one that we can't
-   do anything with.  */
-
-static tree
-decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
-   HOST_WIDE_INT *pbitpos, machine_mode *pmode,
-   int *punsignedp, int *preversep, int *pvolatilep,
-   tree *pmask, tree *pand_mask, int xor_which)
-{
-  tree exp = *exp_;
-  tree outer_type = 0;
-  tree and_mask = 0;
-  tree mask, inner, offset;
-  tree unsigned_type;
-  unsigned int precision;
-  HOST_WIDE_INT shiftrt = 0;
-
-  /* All the optimizations using this function assume integer fields.
- There are problems with FP fields since the type_for_size call
- below can fail for, e.g., XFmode.  */
-  if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
-return NULL_TREE;
-
-  /* We are interested in the bare arrangement of bits, so strip everything
- that doesn't affect the machine mode.  However, record the type of the
- outermost expression if it may matter below.  */
-  if (CONVERT_EXPR_P (exp)
-  || TREE_CODE (exp) == NON_LVALUE_EXPR)
-outer_type = TREE_TYPE (exp);
-  STRIP_NOPS (exp);
-
-  if (TREE_CODE (exp) == BIT_AND_EXPR)
-{
-  and_mask = TREE_OPERAND (exp, 1);
-  exp = TREE_OPERAND (exp, 0);
-  STRIP_NOPS (exp); STRIP_NOPS (and_mask);
-  if (TREE_CODE (and_mask) != INTEGER_CST)
-   return NULL_TREE;
-}
-
-  if (xor_which)
-{
-  gcc_checking_assert (TREE_CODE (exp) == BIT_XOR_EXPR);
-  

[gcc(refs/users/aoliva/heads/testme)] check for mergeable loads, choose insertion points accordingly

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:163a7691962e2a60402d2b75fb2243bfd33b3595

commit 163a7691962e2a60402d2b75fb2243bfd33b3595
Author: Alexandre Oliva 
Date:   Thu Jul 27 05:15:20 2023 -0300

check for mergeable loads, choose insertion points accordingly

Diff:
---
 gcc/gimple-fold.cc | 253 ++---
 1 file changed, 219 insertions(+), 34 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 64426bd76977..85a0ec028030 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -69,6 +69,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "varasm.h"
 #include "internal-fn.h"
 #include "gimple-range.h"
+#include "tree-ssa-loop-niter.h" // stmt_dominates_stmt_p
 
 /* ??? Move this to some header, it's defined in fold-const.c.  */
 extern tree
@@ -7395,7 +7396,7 @@ maybe_fold_comparisons_from_match_pd (tree type, enum 
tree_code code,
Same as ssa_is_replaceable_p, except that we don't insist it has a
single use.  */
 
-bool
+static bool
 ssa_is_substitutable_p (gimple *stmt)
 {
 #if 0
@@ -7476,9 +7477,10 @@ is_cast_p (tree *name)
   if (gimple_num_ops (def) != 2)
break;
 
-  if (get_gimple_rhs_class (gimple_expr_code (def))
- == GIMPLE_SINGLE_RHS)
+  if (gimple_assign_single_p (def))
{
+ if (gimple_assign_load_p (def))
+   break;
  *name = gimple_assign_rhs1 (def);
  continue;
}
@@ -7515,8 +7517,7 @@ is_binop_p (enum tree_code code, tree *name)
  return 0;
 
case 2:
- if (get_gimple_rhs_class (gimple_expr_code (def))
- == GIMPLE_SINGLE_RHS)
+ if (gimple_assign_single_p (def) && !gimple_assign_load_p (def))
{
  *name = gimple_assign_rhs1 (def);
  continue;
@@ -7524,7 +7525,7 @@ is_binop_p (enum tree_code code, tree *name)
  return 0;
 
case 3:
- ;
+ break;
}
 
   if (gimple_assign_rhs_code (def) != code)
@@ -7569,6 +7570,26 @@ prepare_xor (tree l_arg, tree *r_arg)
   return ret;
 }
 
+/* If EXP is a SSA_NAME whose DEF is a load stmt, set *LOAD to it and
+   return its RHS, otherwise return EXP.  */
+
+static tree
+follow_load (tree exp, gimple **load)
+{
+  if (TREE_CODE (exp) == SSA_NAME
+  && !SSA_NAME_IS_DEFAULT_DEF (exp))
+{
+  gimple *def = SSA_NAME_DEF_STMT (exp);
+  if (gimple_assign_load_p (def))
+   {
+ *load = def;
+ exp = gimple_assign_rhs1 (def);
+   }
+}
+
+  return exp;
+}
+
 /* Subroutine for fold_truth_andor_1: decode a field reference.
 
If EXP is a comparison reference, we return the innermost reference.
@@ -7595,6 +7616,9 @@ prepare_xor (tree l_arg, tree *r_arg)
BIT_XOR_EXPR compared with zero.  We're to take the first or second
operand thereof if so.  It should be zero otherwise.
 
+   *LOAD is set to the load stmt of the innermost reference, if any,
+   *and NULL otherwise.
+
Return 0 if this is not a component reference or is one that we can't
do anything with.  */
 
@@ -7602,7 +7626,8 @@ static tree
 decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
HOST_WIDE_INT *pbitpos, machine_mode *pmode,
int *punsignedp, int *preversep, int *pvolatilep,
-   tree *pmask, tree *pand_mask, int xor_which)
+   tree *pmask, tree *pand_mask, int xor_which,
+   gimple **load)
 {
   tree exp = *exp_;
   tree outer_type = 0;
@@ -7612,11 +7637,13 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   unsigned int precision;
   HOST_WIDE_INT shiftrt = 0;
 
+  *load = NULL;
+
   /* All the optimizations using this function assume integer fields.
  There are problems with FP fields since the type_for_size call
  below can fail for, e.g., XFmode.  */
   if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
-return 0;
+return NULL_TREE;
 
   /* We are interested in the bare arrangement of bits, so strip everything
  that doesn't affect the machine mode.  However, record the type of the
@@ -7626,7 +7653,7 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   if ((and_mask = is_binop_p (BIT_AND_EXPR, &exp)))
 {
   if (TREE_CODE (and_mask) != INTEGER_CST)
-   return 0;
+   return NULL_TREE;
 }
 
   if (xor_which)
@@ -7644,16 +7671,18 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   if (tree shift = is_binop_p (RSHIFT_EXPR, &exp))
 {
   if (TREE_CODE (shift) != INTEGER_CST || !tree_fits_shwi_p (shift))
-   return 0;
+   return NULL_TREE;
   shiftrt = tree_to_shwi (shift);
   if (shiftrt <= 0)
-   return 0;
+   return NULL_TREE;
 }
 
   if (tree t = is_cast_p (&exp))
 if (!outer_type)
   outer_type = t;
 
+  exp = follow_load (exp, load);
+
   poly_int64 poly_bitsize, poly_bitpos;
   inner = ge

[gcc(refs/users/aoliva/heads/testme)] fold truth-and only in ifcombine

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:1494b67efaa0c4c3ebd46b7fcaee5a3389124d4b

commit 1494b67efaa0c4c3ebd46b7fcaee5a3389124d4b
Author: Alexandre Oliva 
Date:   Fri Aug 18 00:51:23 2023 -0300

fold truth-and only in ifcombine

Diff:
---
 gcc/gimple-fold.cc|  2 ++
 gcc/tree-ssa-ifcombine.cc | 24 +---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 85a0ec028030..5b7d83edbea9 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8738,12 +8738,14 @@ maybe_fold_and_comparisons (tree type,
 op2b, outer_cond_bb))
 return t;
 
+#if 0
   if (tree t = fold_truth_andor_maybe_separate (UNKNOWN_LOCATION,
TRUTH_ANDIF_EXPR, type,
code2, op2a, op2b,
code1, op1a, op1b,
NULL))
 return t;
+#endif
 
   return NULL_TREE;
 }
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 79a4bdd363b9..61480e5fa894 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -399,6 +399,14 @@ update_profile_after_ifcombine (basic_block inner_cond_bb,
   outer2->probability = profile_probability::never ();
 }
 
+/* FIXME: move to a header file.  */
+extern tree
+fold_truth_andor_maybe_separate (location_t loc,
+enum tree_code code, tree truth_type,
+enum tree_code lcode, tree ll_arg, tree lr_arg,
+enum tree_code rcode, tree rl_arg, tree rr_arg,
+tree *separatep);
+
 /* If-convert on a and pattern with a common else block.  The inner
if is specified by its INNER_COND_BB, the outer by OUTER_COND_BB.
inner_inv, outer_inv and result_inv indicate whether the conditions
@@ -576,7 +584,7 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
   else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
   && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
 {
-  tree t;
+  tree t, ts = NULL_TREE;
   enum tree_code inner_cond_code = gimple_cond_code (inner_cond);
   enum tree_code outer_cond_code = gimple_cond_code (outer_cond);
 
@@ -599,7 +607,17 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
outer_cond_code,
gimple_cond_lhs (outer_cond),
gimple_cond_rhs (outer_cond),
-   gimple_bb (outer_cond
+   gimple_bb (outer_cond)))
+ && !(t = ts = (fold_truth_andor_maybe_separate
+(UNKNOWN_LOCATION, TRUTH_ANDIF_EXPR,
+ boolean_type_node,
+ outer_cond_code,
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond),
+ inner_cond_code,
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ NULL
{
  {
  tree t1, t2;
@@ -636,7 +654,7 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
  NULL, true, GSI_SAME_STMT);
 }
   /* ??? Fold should avoid this.  */
-  else if (!is_gimple_condexpr_for_cond (t))
+  else if (ts && !is_gimple_condexpr_for_cond (t))
goto gimplify_after_fold;
   if (result_inv)
t = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (t), t);


[gcc(refs/users/aoliva/heads/testme)] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:d82778e46cecd7879b647471b126fa156e6672f2

commit d82778e46cecd7879b647471b126fa156e6672f2
Author: Alexandre Oliva 
Date:   Fri Sep 13 02:13:50 2024 -0300

relax ifcombine to accept vuses

Diff:
---
 gcc/tree-ssa-ifcombine.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 61480e5fa894..7678c87e0170 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
   enum tree_code rhs_code;
   if (gimple_has_side_effects (stmt)
  || gimple_could_trap_p (stmt)
- || gimple_vuse (stmt)
+ /* || gimple_vuse (stmt) */
  /* We need to rewrite stmts with undefined overflow to use
 unsigned arithmetic but cannot do so for signed division.  */
  || ((ass = dyn_cast  (stmt))


[gcc/aoliva/heads/testme] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 70860fa4cab8... relax ifcombine to accept vuses

It previously pointed to:

 d82778e46cec... relax ifcombine to accept vuses

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  d82778e... relax ifcombine to accept vuses


Summary of changes (added commits):
---

  70860fa... relax ifcombine to accept vuses


[gcc(refs/users/aoliva/heads/testme)] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:70860fa4cab8ad90645027582ac5775716495819

commit 70860fa4cab8ad90645027582ac5775716495819
Author: Alexandre Oliva 
Date:   Fri Sep 13 02:13:50 2024 -0300

relax ifcombine to accept vuses

Diff:
---
 gcc/config/i386/t-i386| 2 ++
 gcc/tree-ssa-ifcombine.cc | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index bf4ae109af98..1b904787ec62 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -79,3 +79,5 @@ s-i386-bt: $(srcdir)/config/i386/i386-builtin-types.awk \
$(AWK) -f $^ > tmp-bt.inc
$(SHELL) $(srcdir)/../move-if-change tmp-bt.inc i386-builtin-types.inc
$(STAMP) $@
+
+insn-attrtab.o-warn = -Wno-error
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 61480e5fa894..7678c87e0170 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
   enum tree_code rhs_code;
   if (gimple_has_side_effects (stmt)
  || gimple_could_trap_p (stmt)
- || gimple_vuse (stmt)
+ /* || gimple_vuse (stmt) */
  /* We need to rewrite stmts with undefined overflow to use
 unsigned arithmetic but cannot do so for signed division.  */
  || ((ass = dyn_cast  (stmt))


[gcc/aoliva/heads/testme] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 cfc10ee04079... relax ifcombine to accept vuses

It previously pointed to:

 70860fa4cab8... relax ifcombine to accept vuses

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  70860fa... relax ifcombine to accept vuses


Summary of changes (added commits):
---

  cfc10ee... relax ifcombine to accept vuses


[gcc(refs/users/aoliva/heads/testme)] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:cfc10ee040798637c72487435d0ab8668e05c386

commit cfc10ee040798637c72487435d0ab8668e05c386
Author: Alexandre Oliva 
Date:   Fri Sep 13 02:13:50 2024 -0300

relax ifcombine to accept vuses

Diff:
---
 gcc/config/i386/t-i386   |  2 ++
 gcc/testsuite/gcc.dg/field-merge-6.c | 25 +
 gcc/tree-ssa-ifcombine.cc|  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index bf4ae109af98..1b904787ec62 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -79,3 +79,5 @@ s-i386-bt: $(srcdir)/config/i386/i386-builtin-types.awk \
$(AWK) -f $^ > tmp-bt.inc
$(SHELL) $(srcdir)/../move-if-change tmp-bt.inc i386-builtin-types.inc
$(STAMP) $@
+
+insn-attrtab.o-warn = -Wno-error
diff --git a/gcc/testsuite/gcc.dg/field-merge-6.c 
b/gcc/testsuite/gcc.dg/field-merge-6.c
new file mode 100644
index ..c42bed927c66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/field-merge-6.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+/* { dg-shouldfail } */
+
+struct s {
+  char a, b;
+  struct s *p;
+};
+
+struct s a = { 0, 1, 0 };
+struct s b = { 0, 0, &a };
+
+int f () {
+  /* Check that the third compare won't be pulled ahead of the second one and
+ prevent the NULL pointer dereference that should cause the execution to
+ fail.  */
+  return (a->a != b->a
+ || b->p->b != a->p->a
+ || a->b != b->b);
+}
+
+int main() {
+  f ();
+  return 0;
+}
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 61480e5fa894..7678c87e0170 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
   enum tree_code rhs_code;
   if (gimple_has_side_effects (stmt)
  || gimple_could_trap_p (stmt)
- || gimple_vuse (stmt)
+ /* || gimple_vuse (stmt) */
  /* We need to rewrite stmts with undefined overflow to use
 unsigned arithmetic but cannot do so for signed division.  */
  || ((ass = dyn_cast  (stmt))


[gcc/aoliva/heads/testme] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 0d90ad11fb42... relax ifcombine to accept vuses

It previously pointed to:

 cfc10ee04079... relax ifcombine to accept vuses

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  cfc10ee... relax ifcombine to accept vuses


Summary of changes (added commits):
---

  0d90ad1... relax ifcombine to accept vuses


[gcc(refs/users/aoliva/heads/testme)] relax ifcombine to accept vuses

2024-09-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0d90ad11fb42573a4186c69117edc892f6fb9151

commit 0d90ad11fb42573a4186c69117edc892f6fb9151
Author: Alexandre Oliva 
Date:   Fri Sep 13 02:13:50 2024 -0300

relax ifcombine to accept vuses

Diff:
---
 gcc/config/i386/t-i386   |  2 ++
 gcc/testsuite/gcc.dg/field-merge-6.c | 25 +
 gcc/tree-ssa-ifcombine.cc|  2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index bf4ae109af98..1b904787ec62 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -79,3 +79,5 @@ s-i386-bt: $(srcdir)/config/i386/i386-builtin-types.awk \
$(AWK) -f $^ > tmp-bt.inc
$(SHELL) $(srcdir)/../move-if-change tmp-bt.inc i386-builtin-types.inc
$(STAMP) $@
+
+insn-attrtab.o-warn = -Wno-error
diff --git a/gcc/testsuite/gcc.dg/field-merge-6.c 
b/gcc/testsuite/gcc.dg/field-merge-6.c
new file mode 100644
index ..4b09623f138a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/field-merge-6.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+/* { dg-shouldfail } */
+
+struct s {
+  char a, b;
+  struct s *p;
+};
+
+struct s a = { 0, 1, 0 };
+struct s b = { 0, 0, &a };
+
+int f () {
+  /* Check that the third compare won't be pulled ahead of the second one and
+ prevent the NULL pointer dereference that should cause the execution to
+ fail.  */
+  return (a.a != b.a
+ || b.p->b != a.p->a
+ || a.b != b.b);
+}
+
+int main() {
+  f ();
+  return 0;
+}
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 61480e5fa894..7678c87e0170 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
   enum tree_code rhs_code;
   if (gimple_has_side_effects (stmt)
  || gimple_could_trap_p (stmt)
- || gimple_vuse (stmt)
+ /* || gimple_vuse (stmt) */
  /* We need to rewrite stmts with undefined overflow to use
 unsigned arithmetic but cannot do so for signed division.  */
  || ((ass = dyn_cast  (stmt))


[gcc r15-3636] testsuite: a few more hostedlib adjustments

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:b56bd542942ba7bd2020d5824e57d819974bc071

commit r15-3636-gb56bd542942ba7bd2020d5824e57d819974bc071
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:42:41 2024 -0300

testsuite: a few more hostedlib adjustments

This adjusts some recently-added tests that won't compile without a
hostedlib libstdc++, missed in the patch that just went in, and also
an old test that I'd missed because it also failed in my baseline.


for  gcc/testsuite/ChangeLog

* g++.dg/coroutines/pr108620.C: Skip if !hostedlib because of
unavailable headers.
* g++.dg/other/profile1.C: Likewise.
* g++.dg/ext/pragma-unroll-lambda-lto.C: Skip if !hostedlib
because of unavailable declarations.

Diff:
---
 gcc/testsuite/g++.dg/coroutines/pr108620.C  | 2 ++
 gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C | 1 +
 gcc/testsuite/g++.dg/other/profile1.C   | 1 +
 3 files changed, 4 insertions(+)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr108620.C 
b/gcc/testsuite/g++.dg/coroutines/pr108620.C
index e8016b9f8a23..22bf0c18bac4 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr108620.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr108620.C
@@ -1,3 +1,5 @@
+// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
+
 // https://gcc.gnu.org/PR108620
 #include 
 #include 
diff --git a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C 
b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
index 144c4c326924..64cdf90f34d3 100644
--- a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
+++ b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda-lto.C
@@ -1,5 +1,6 @@
 // { dg-do link { target c++11 } }
 // { dg-options "-O2 -flto -fdump-rtl-loop2_unroll" }
+// { dg-skip-if "requires hosted libstdc++ for cstdlib rand" { ! hostedlib } }
 
 #include 
 
diff --git a/gcc/testsuite/g++.dg/other/profile1.C 
b/gcc/testsuite/g++.dg/other/profile1.C
index a4bf6b3d0fea..99844373189e 100644
--- a/gcc/testsuite/g++.dg/other/profile1.C
+++ b/gcc/testsuite/g++.dg/other/profile1.C
@@ -2,6 +2,7 @@
 // { dg-do run }
 // { dg-require-profiling "" }
 // { dg-options "-fnon-call-exceptions -fprofile-arcs" }
+// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } }
 
 #include 


[gcc/aoliva/heads/testbase] (19 commits) testsuite: a few more hostedlib adjustments

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 b56bd542942b... testsuite: a few more hostedlib adjustments

It previously pointed to:

 4308c343b8ea... testsuite: introduce hostedlib effective target

Diff:

Summary of changes (added commits):
---

  b56bd54... testsuite: a few more hostedlib adjustments (*)
  d53c5bc... Daily bump. (*)
  4ffca99... AVR: Detect more skip opportunities. (*)
  8ed8c34... Fix factor_out_conditional_operation heuristics for constan (*)
  b55f5e3... AVR: Use avr_byte instead of simplify_gen_subreg (QImode, . (*)
  4ee6923... c++: -fimplicit-constexpr diagnostic improvement [PR116696] (*)
  9998846... Fortran: Fixes to OpenMP 'interop' directive parsing suppor (*)
  508ef58... gcn/mkoffload.cc: Use #embed for including the generated EL (*)
  b7b6773... c++: Don't emit deprecated/unavailable attribute diagnostic (*)
  4963eb7... libcpp: Fix up UB in finish_embed (*)
  46c2538... s390: Fix TF to FPRX2 conversion [PR115860] (*)
  1a71ff3... s390: Fix AQ and AR constraints (*)
  5938e06... libstdc++: Do not use use memmove for 1-element ranges [PR1 (*)
  494d3c3... AVR: Rework avr_out_compare. (*)
  1ec1677... AVR: Tweak 32-bit EQ and NE comparisons. (*)
  be59aaf... AVR: avr.cc - Reorder functions to require less forward dec (*)
  45e7cc9... Match: Remove unnecessary types_match for case 1 of signed  (*)
  5d9486c... Fix endianness issue on unsigned_21.f90. (*)
  3d021a0... Daily bump. (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testbase' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc/aoliva/heads/testme] (24 commits) relax ifcombine to accept vuses

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 7b7dfff4b174... relax ifcombine to accept vuses

It previously pointed to:

 0d90ad11fb42... relax ifcombine to accept vuses

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  0d90ad1... relax ifcombine to accept vuses
  1494b67... fold truth-and only in ifcombine
  163a769... check for mergeable loads, choose insertion points accordin
  e4f6196... rework truth_andor folding into tree-ssa-ifcombine
  6621257... assorted improvements for fold_truth_andor_1
  90eb457... testsuite: a few more hostedlib adjustments


Summary of changes (added commits):
---

  7b7dfff... relax ifcombine to accept vuses
  e731ae8... fold truth-and only in ifcombine
  fbf1f80... check for mergeable loads, choose insertion points accordin
  b4b872b... rework truth_andor folding into tree-ssa-ifcombine
  8aa412b... assorted improvements for fold_truth_andor_1
  b56bd54... testsuite: a few more hostedlib adjustments (*)
  d53c5bc... Daily bump. (*)
  4ffca99... AVR: Detect more skip opportunities. (*)
  8ed8c34... Fix factor_out_conditional_operation heuristics for constan (*)
  b55f5e3... AVR: Use avr_byte instead of simplify_gen_subreg (QImode, . (*)
  4ee6923... c++: -fimplicit-constexpr diagnostic improvement [PR116696] (*)
  9998846... Fortran: Fixes to OpenMP 'interop' directive parsing suppor (*)
  508ef58... gcn/mkoffload.cc: Use #embed for including the generated EL (*)
  b7b6773... c++: Don't emit deprecated/unavailable attribute diagnostic (*)
  4963eb7... libcpp: Fix up UB in finish_embed (*)
  46c2538... s390: Fix TF to FPRX2 conversion [PR115860] (*)
  1a71ff3... s390: Fix AQ and AR constraints (*)
  5938e06... libstdc++: Do not use use memmove for 1-element ranges [PR1 (*)
  494d3c3... AVR: Rework avr_out_compare. (*)
  1ec1677... AVR: Tweak 32-bit EQ and NE comparisons. (*)
  be59aaf... AVR: avr.cc - Reorder functions to require less forward dec (*)
  45e7cc9... Match: Remove unnecessary types_match for case 1 of signed  (*)
  5d9486c... Fix endianness issue on unsigned_21.f90. (*)
  3d021a0... Daily bump. (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testme' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc(refs/users/aoliva/heads/testme)] assorted improvements for fold_truth_andor_1

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8aa412b62ba7275d5d0f861ef8e0306d5023b028

commit 8aa412b62ba7275d5d0f861ef8e0306d5023b028
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:42:56 2024 -0300

assorted improvements for fold_truth_andor_1

This patch introduces various improvements to the logic that merges
field compares.

Before the patch, we could merge:

  (a.x1 EQNE b.x1)  ANDOR  (a.y1 EQNE b.y1)

into something like:

  (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK)

if both of A's fields live within the same alignment boundaries, and
so do B's, at the same relative positions.  Constants may be used
instead of the object B.

The initial goal of this patch was to enable such combinations when a
field crossed alignment boundaries, e.g. for packed types.  We can't
generally access such fields with a single memory access, so when we
come across such a compare, we will attempt to combine each access
separately.

Some merging opportunities were missed because of right-shifts,
compares expressed as e.g. ((a.x1 ^ b.x1) & MASK) EQNE 0, and
narrowing conversions, especially after earlier merges.  This patch
introduces handlers for several cases involving these.

Other merging opportunities were missed because of association.  The
existing logic would only succeed in merging a pair of consecutive
compares, or e.g. B with C in (A ANDOR B) ANDOR C, not even trying
e.g. C and D in (A ANDOR (B ANDOR C)) ANDOR D.  I've generalized the
handling of the rightmost compare in the left-hand operand, going for
the leftmost compare in the right-hand operand, and then onto trying
to merge compares pairwise, one from each operand, even if they are
not consecutive, taking care to avoid merging operations with
intervening side effects, including volatile accesses.

When it is the second of a non-consecutive pair of compares that first
accesses a word, we may merge the first compare with part of the
second compare that refers to the same word, keeping the compare of
the remaining bits at the spot where the second compare used to be.

Handling compares with non-constant fields was somewhat generalized,
now handling non-adjacent fields.  When a field of one object crosses
an alignment boundary but the other doesn't, we issue the same load in
both compares; gimple optimizers will later turn it into a single
load, without our having to handle SAVE_EXPRs at this point.

The logic for issuing split loads and compares, and ordering them, is
now shared between all cases of compares with constants and with
another object.

The -Wno-error for toplev.o on rs6000 is because of toplev.c's:

  if ((flag_sanitize & SANITIZE_ADDRESS)
  && !FRAME_GROWS_DOWNWARD)

and rs6000.h's:

#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0   \
  || (flag_sanitize & SANITIZE_ADDRESS) != 0)

The mutually exclusive conditions involving flag_sanitize are now
noticed and reported by fold-const.c's:

  warning (0,
   "% of mutually exclusive equal-tests"
   " is always 0");

This patch enables over 12k compare-merging opportunities that we used
to miss in a GCC bootstrap.


for  gcc/ChangeLog

* fold-const.cc (prepare_xor): New.
(decode_field_reference): Handle xor, shift, and narrowing
conversions.
(all_ones_mask_p): Remove.
(compute_split_boundary_from_align): New.
(build_split_load, reuse_split_load): New.
(fold_truth_andor_1): Add recursion to combine pairs of
non-neighboring compares.  Handle xor compared with zero.
Handle fields straddling across alignment boundaries.
Generalize handling of non-constant rhs.
(fold_truth_andor): Leave sub-expression handling to the
recursion above.
* config/rs6000/t-rs6000 (toplev.o-warn): Disable errors.

for  gcc/testsuite/ChangeLog

* gcc.dg/field-merge-1.c: New.
* gcc.dg/field-merge-2.c: New.
* gcc.dg/field-merge-3.c: New.
* gcc.dg/field-merge-4.c: New.
* gcc.dg/field-merge-5.c: New.

Diff:
---
 gcc/config/rs6000/t-rs6000   |   4 +
 gcc/fold-const.cc| 818 ---
 gcc/testsuite/gcc.dg/field-merge-1.c |  64 +++
 gcc/testsuite/gcc.dg/field-merge-2.c |  31 ++
 gcc/testsuite/gcc.dg/field-merge-3.c |  36 ++
 gcc/testsuite/gcc.dg/field-merge-4.c |  40 ++
 gcc/testsuite/gcc.dg/field-merge-5.c |  40 ++
 7 files changed, 881 insertions(+), 152 deletions(-)

diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 155788de40a3..a83968d663a6 

[gcc(refs/users/aoliva/heads/testme)] rework truth_andor folding into tree-ssa-ifcombine

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:b4b872b2195b448b3e1bcd28c3e28d59618580a2

commit b4b872b2195b448b3e1bcd28c3e28d59618580a2
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:43:00 2024 -0300

rework truth_andor folding into tree-ssa-ifcombine

Diff:
---
 gcc/fold-const.cc | 1048 +
 gcc/gimple-fold.cc| 1149 +
 gcc/tree-ssa-ifcombine.cc |7 +-
 3 files changed, 1170 insertions(+), 1034 deletions(-)

diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 81814de5b04b..19824e6a477f 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -137,7 +137,6 @@ static tree range_successor (tree);
 static tree fold_range_test (location_t, enum tree_code, tree, tree, tree);
 static tree fold_cond_expr_with_comparison (location_t, tree, enum tree_code,
tree, tree, tree, tree);
-static tree unextend (tree, int, int, tree);
 static tree extract_muldiv (tree, tree, enum tree_code, tree, bool *);
 static tree extract_muldiv_1 (tree, tree, enum tree_code, tree, bool *);
 static tree fold_binary_op_with_conditional_arg (location_t,
@@ -4695,7 +4694,7 @@ invert_truthvalue_loc (location_t loc, tree arg)
is the original memory reference used to preserve the alias set of
the access.  */
 
-static tree
+tree
 make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type,
HOST_WIDE_INT bitsize, poly_int64 bitpos,
int unsignedp, int reversep)
@@ -4945,212 +4944,6 @@ optimize_bit_field_compare (location_t loc, enum 
tree_code code,
   return lhs;
 }
 
-/* If *R_ARG is a constant zero, and L_ARG is a possibly masked
-   BIT_XOR_EXPR, return 1 and set *r_arg to l_arg.
-   Otherwise, return 0.
-
-   The returned value should be passed to decode_field_reference for it
-   to handle l_arg, and then doubled for r_arg.  */
-static int
-prepare_xor (tree l_arg, tree *r_arg)
-{
-  int ret = 0;
-
-  if (!integer_zerop (*r_arg))
-return ret;
-
-  tree exp = l_arg;
-  STRIP_NOPS (exp);
-
-  if (TREE_CODE (exp) == BIT_AND_EXPR)
-{
-  tree and_mask = TREE_OPERAND (exp, 1);
-  exp = TREE_OPERAND (exp, 0);
-  STRIP_NOPS (exp); STRIP_NOPS (and_mask);
-  if (TREE_CODE (and_mask) != INTEGER_CST)
-   return ret;
-}
-
-  if (TREE_CODE (exp) == BIT_XOR_EXPR)
-{
-  *r_arg = l_arg;
-  return 1;
-}
-
-  return ret;
-}
-
-/* Subroutine for fold_truth_andor_1: decode a field reference.
-
-   If EXP is a comparison reference, we return the innermost reference.
-
-   *PBITSIZE is set to the number of bits in the reference, *PBITPOS is
-   set to the starting bit number.
-
-   If the innermost field can be completely contained in a mode-sized
-   unit, *PMODE is set to that mode.  Otherwise, it is set to VOIDmode.
-
-   *PVOLATILEP is set to 1 if the any expression encountered is volatile;
-   otherwise it is not changed.
-
-   *PUNSIGNEDP is set to the signedness of the field.
-
-   *PREVERSEP is set to the storage order of the field.
-
-   *PMASK is set to the mask used.  This is either contained in a
-   BIT_AND_EXPR or derived from the width of the field.
-
-   *PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any.
-
-   XOR_WHICH is 1 or 2 if EXP was found to be a (possibly masked)
-   BIT_XOR_EXPR compared with zero.  We're to take the first or second
-   operand thereof if so.  It should be zero otherwise.
-
-   Return 0 if this is not a component reference or is one that we can't
-   do anything with.  */
-
-static tree
-decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
-   HOST_WIDE_INT *pbitpos, machine_mode *pmode,
-   int *punsignedp, int *preversep, int *pvolatilep,
-   tree *pmask, tree *pand_mask, int xor_which)
-{
-  tree exp = *exp_;
-  tree outer_type = 0;
-  tree and_mask = 0;
-  tree mask, inner, offset;
-  tree unsigned_type;
-  unsigned int precision;
-  HOST_WIDE_INT shiftrt = 0;
-
-  /* All the optimizations using this function assume integer fields.
- There are problems with FP fields since the type_for_size call
- below can fail for, e.g., XFmode.  */
-  if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
-return NULL_TREE;
-
-  /* We are interested in the bare arrangement of bits, so strip everything
- that doesn't affect the machine mode.  However, record the type of the
- outermost expression if it may matter below.  */
-  if (CONVERT_EXPR_P (exp)
-  || TREE_CODE (exp) == NON_LVALUE_EXPR)
-outer_type = TREE_TYPE (exp);
-  STRIP_NOPS (exp);
-
-  if (TREE_CODE (exp) == BIT_AND_EXPR)
-{
-  and_mask = TREE_OPERAND (exp, 1);
-  exp = TREE_OPERAND (exp, 0);
-  STRIP_NOPS (exp); STRIP_NOPS (and_mask);
-  if (TREE_CODE (and_mask) != INTEGER_CST)
-   return NULL_TREE;
-}
-
-  if (xor_which)
-{
-  gcc_checking_assert (TREE_CODE (exp) == BIT_XOR_EXPR);
-  

[gcc(refs/users/aoliva/heads/testme)] check for mergeable loads, choose insertion points accordingly

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:fbf1f8007325adf2d4b70f3b5a26d5c666c815e3

commit fbf1f8007325adf2d4b70f3b5a26d5c666c815e3
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:43:06 2024 -0300

check for mergeable loads, choose insertion points accordingly

Diff:
---
 gcc/gimple-fold.cc | 253 ++---
 1 file changed, 219 insertions(+), 34 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 64426bd76977..85a0ec028030 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -69,6 +69,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "varasm.h"
 #include "internal-fn.h"
 #include "gimple-range.h"
+#include "tree-ssa-loop-niter.h" // stmt_dominates_stmt_p
 
 /* ??? Move this to some header, it's defined in fold-const.c.  */
 extern tree
@@ -7395,7 +7396,7 @@ maybe_fold_comparisons_from_match_pd (tree type, enum 
tree_code code,
Same as ssa_is_replaceable_p, except that we don't insist it has a
single use.  */
 
-bool
+static bool
 ssa_is_substitutable_p (gimple *stmt)
 {
 #if 0
@@ -7476,9 +7477,10 @@ is_cast_p (tree *name)
   if (gimple_num_ops (def) != 2)
break;
 
-  if (get_gimple_rhs_class (gimple_expr_code (def))
- == GIMPLE_SINGLE_RHS)
+  if (gimple_assign_single_p (def))
{
+ if (gimple_assign_load_p (def))
+   break;
  *name = gimple_assign_rhs1 (def);
  continue;
}
@@ -7515,8 +7517,7 @@ is_binop_p (enum tree_code code, tree *name)
  return 0;
 
case 2:
- if (get_gimple_rhs_class (gimple_expr_code (def))
- == GIMPLE_SINGLE_RHS)
+ if (gimple_assign_single_p (def) && !gimple_assign_load_p (def))
{
  *name = gimple_assign_rhs1 (def);
  continue;
@@ -7524,7 +7525,7 @@ is_binop_p (enum tree_code code, tree *name)
  return 0;
 
case 3:
- ;
+ break;
}
 
   if (gimple_assign_rhs_code (def) != code)
@@ -7569,6 +7570,26 @@ prepare_xor (tree l_arg, tree *r_arg)
   return ret;
 }
 
+/* If EXP is a SSA_NAME whose DEF is a load stmt, set *LOAD to it and
+   return its RHS, otherwise return EXP.  */
+
+static tree
+follow_load (tree exp, gimple **load)
+{
+  if (TREE_CODE (exp) == SSA_NAME
+  && !SSA_NAME_IS_DEFAULT_DEF (exp))
+{
+  gimple *def = SSA_NAME_DEF_STMT (exp);
+  if (gimple_assign_load_p (def))
+   {
+ *load = def;
+ exp = gimple_assign_rhs1 (def);
+   }
+}
+
+  return exp;
+}
+
 /* Subroutine for fold_truth_andor_1: decode a field reference.
 
If EXP is a comparison reference, we return the innermost reference.
@@ -7595,6 +7616,9 @@ prepare_xor (tree l_arg, tree *r_arg)
BIT_XOR_EXPR compared with zero.  We're to take the first or second
operand thereof if so.  It should be zero otherwise.
 
+   *LOAD is set to the load stmt of the innermost reference, if any,
+   *and NULL otherwise.
+
Return 0 if this is not a component reference or is one that we can't
do anything with.  */
 
@@ -7602,7 +7626,8 @@ static tree
 decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
HOST_WIDE_INT *pbitpos, machine_mode *pmode,
int *punsignedp, int *preversep, int *pvolatilep,
-   tree *pmask, tree *pand_mask, int xor_which)
+   tree *pmask, tree *pand_mask, int xor_which,
+   gimple **load)
 {
   tree exp = *exp_;
   tree outer_type = 0;
@@ -7612,11 +7637,13 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   unsigned int precision;
   HOST_WIDE_INT shiftrt = 0;
 
+  *load = NULL;
+
   /* All the optimizations using this function assume integer fields.
  There are problems with FP fields since the type_for_size call
  below can fail for, e.g., XFmode.  */
   if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
-return 0;
+return NULL_TREE;
 
   /* We are interested in the bare arrangement of bits, so strip everything
  that doesn't affect the machine mode.  However, record the type of the
@@ -7626,7 +7653,7 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   if ((and_mask = is_binop_p (BIT_AND_EXPR, &exp)))
 {
   if (TREE_CODE (and_mask) != INTEGER_CST)
-   return 0;
+   return NULL_TREE;
 }
 
   if (xor_which)
@@ -7644,16 +7671,18 @@ decode_field_reference (location_t loc, tree *exp_, 
HOST_WIDE_INT *pbitsize,
   if (tree shift = is_binop_p (RSHIFT_EXPR, &exp))
 {
   if (TREE_CODE (shift) != INTEGER_CST || !tree_fits_shwi_p (shift))
-   return 0;
+   return NULL_TREE;
   shiftrt = tree_to_shwi (shift);
   if (shiftrt <= 0)
-   return 0;
+   return NULL_TREE;
 }
 
   if (tree t = is_cast_p (&exp))
 if (!outer_type)
   outer_type = t;
 
+  exp = follow_load (exp, load);
+
   poly_int64 poly_bitsize, poly_bitpos;
   inner = ge

[gcc(refs/users/aoliva/heads/testme)] fold truth-and only in ifcombine

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:e731ae8c98953fb898a938ee0a0be19e2ea906d7

commit e731ae8c98953fb898a938ee0a0be19e2ea906d7
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:43:10 2024 -0300

fold truth-and only in ifcombine

Diff:
---
 gcc/gimple-fold.cc|  2 ++
 gcc/tree-ssa-ifcombine.cc | 24 +---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc
index 85a0ec028030..5b7d83edbea9 100644
--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8738,12 +8738,14 @@ maybe_fold_and_comparisons (tree type,
 op2b, outer_cond_bb))
 return t;
 
+#if 0
   if (tree t = fold_truth_andor_maybe_separate (UNKNOWN_LOCATION,
TRUTH_ANDIF_EXPR, type,
code2, op2a, op2b,
code1, op1a, op1b,
NULL))
 return t;
+#endif
 
   return NULL_TREE;
 }
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 79a4bdd363b9..61480e5fa894 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -399,6 +399,14 @@ update_profile_after_ifcombine (basic_block inner_cond_bb,
   outer2->probability = profile_probability::never ();
 }
 
+/* FIXME: move to a header file.  */
+extern tree
+fold_truth_andor_maybe_separate (location_t loc,
+enum tree_code code, tree truth_type,
+enum tree_code lcode, tree ll_arg, tree lr_arg,
+enum tree_code rcode, tree rl_arg, tree rr_arg,
+tree *separatep);
+
 /* If-convert on a and pattern with a common else block.  The inner
if is specified by its INNER_COND_BB, the outer by OUTER_COND_BB.
inner_inv, outer_inv and result_inv indicate whether the conditions
@@ -576,7 +584,7 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
   else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
   && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
 {
-  tree t;
+  tree t, ts = NULL_TREE;
   enum tree_code inner_cond_code = gimple_cond_code (inner_cond);
   enum tree_code outer_cond_code = gimple_cond_code (outer_cond);
 
@@ -599,7 +607,17 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
outer_cond_code,
gimple_cond_lhs (outer_cond),
gimple_cond_rhs (outer_cond),
-   gimple_bb (outer_cond
+   gimple_bb (outer_cond)))
+ && !(t = ts = (fold_truth_andor_maybe_separate
+(UNKNOWN_LOCATION, TRUTH_ANDIF_EXPR,
+ boolean_type_node,
+ outer_cond_code,
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond),
+ inner_cond_code,
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ NULL
{
  {
  tree t1, t2;
@@ -636,7 +654,7 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
inner_inv,
  NULL, true, GSI_SAME_STMT);
 }
   /* ??? Fold should avoid this.  */
-  else if (!is_gimple_condexpr_for_cond (t))
+  else if (ts && !is_gimple_condexpr_for_cond (t))
goto gimplify_after_fold;
   if (result_inv)
t = fold_build1 (TRUTH_NOT_EXPR, TREE_TYPE (t), t);


[gcc(refs/users/aoliva/heads/testme)] relax ifcombine to accept vuses

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7b7dfff4b174765248fcf275dc8fde9c78352ad8

commit 7b7dfff4b174765248fcf275dc8fde9c78352ad8
Author: Alexandre Oliva 
Date:   Fri Sep 13 21:43:15 2024 -0300

relax ifcombine to accept vuses

Diff:
---
 gcc/config/i386/t-i386   |  2 ++
 gcc/testsuite/gcc.dg/field-merge-6.c | 26 ++
 gcc/tree-ssa-ifcombine.cc|  2 +-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index bf4ae109af98..1b904787ec62 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -79,3 +79,5 @@ s-i386-bt: $(srcdir)/config/i386/i386-builtin-types.awk \
$(AWK) -f $^ > tmp-bt.inc
$(SHELL) $(srcdir)/../move-if-change tmp-bt.inc i386-builtin-types.inc
$(STAMP) $@
+
+insn-attrtab.o-warn = -Wno-error
diff --git a/gcc/testsuite/gcc.dg/field-merge-6.c 
b/gcc/testsuite/gcc.dg/field-merge-6.c
new file mode 100644
index ..7fd48a138d14
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/field-merge-6.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+/* { dg-shouldfail } */
+
+/* Check that the third compare won't be pulled ahead of the second one and
+   prevent, which would prevent the NULL pointer dereference that should cause
+   the execution to fail.  */
+
+struct s {
+  char a, b;
+  int *p;
+};
+
+struct s a = { 0, 1, 0 };
+struct s b = { 0, 0, 0 };
+
+int f () {
+  return (a.a != b.a
+ || *b.p != *a.p
+ || a.b != b.b);
+}
+
+int main() {
+  f ();
+  return 0;
+}
diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 61480e5fa894..7678c87e0170 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
   enum tree_code rhs_code;
   if (gimple_has_side_effects (stmt)
  || gimple_could_trap_p (stmt)
- || gimple_vuse (stmt)
+ /* || gimple_vuse (stmt) */
  /* We need to rewrite stmts with undefined overflow to use
 unsigned arithmetic but cannot do so for signed division.  */
  || ((ass = dyn_cast  (stmt))


[gcc(refs/users/aoliva/heads/testme)] support noncontiguous ifcombine

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:4f6753de737fb45d78634c35c4c50a546357f70d

commit 4f6753de737fb45d78634c35c4c50a546357f70d
Author: Alexandre Oliva 
Date:   Sat Sep 14 03:40:26 2024 -0300

support noncontiguous ifcombine

Diff:
---
 gcc/tree-ssa-ifcombine.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 7678c87e0170..eb4317bebdfb 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -798,10 +798,10 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
if (a && b)
 ;
  This requires a single predecessor of the inner cond_bb.  */
-  if (single_pred_p (inner_cond_bb)
-  && bb_no_side_effects_p (inner_cond_bb))
+  for (basic_block bb = inner_cond_bb;
+   single_pred_p (bb) && bb_no_side_effects_p (bb); )
 {
-  basic_block outer_cond_bb = single_pred (inner_cond_bb);
+  basic_block outer_cond_bb = bb = single_pred (bb);
 
   if (tree_ssa_ifcombine_bb_1 (inner_cond_bb, outer_cond_bb,
   then_bb, else_bb, inner_cond_bb))


[gcc(refs/users/aoliva/heads/testme)] support noncontiguous ifcombine

2024-09-13 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8a7e9581280c41f3c18cba7fafe110b4108a07a7

commit 8a7e9581280c41f3c18cba7fafe110b4108a07a7
Author: Alexandre Oliva 
Date:   Sat Sep 14 03:40:26 2024 -0300

support noncontiguous ifcombine

Diff:
---
 gcc/tree-ssa-ifcombine.cc | 33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index eb4317bebdfb..b52d343feb91 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -782,13 +782,13 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, 
basic_block outer_cond_bb,
if-conversion helper.  We start with BB as the innermost
worker basic-block.  Returns true if a transformation was done.  */
 
-static bool
+static basic_block
 tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
 {
   basic_block then_bb = NULL, else_bb = NULL;
 
   if (!recognize_if_then_else (inner_cond_bb, &then_bb, &else_bb))
-return false;
+return NULL;
 
   /* Recognize && and || of two conditions with a common
  then/else block which entry edges we can merge.  That is:
@@ -805,7 +805,7 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
 
   if (tree_ssa_ifcombine_bb_1 (inner_cond_bb, outer_cond_bb,
   then_bb, else_bb, inner_cond_bb))
-   return true;
+   return bb;
 
   if (forwarder_block_to (else_bb, then_bb))
{
@@ -817,7 +817,7 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
 edge from outer_cond_bb and the forwarder block.  */
  if (tree_ssa_ifcombine_bb_1 (inner_cond_bb, outer_cond_bb, else_bb,
   then_bb, else_bb))
-   return true;
+   return bb;
}
   else if (forwarder_block_to (then_bb, else_bb))
{
@@ -829,11 +829,11 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb)
 edge from outer_cond_bb and the forwarder block.  */
  if (tree_ssa_ifcombine_bb_1 (inner_cond_bb, outer_cond_bb, else_bb,
   then_bb, then_bb))
-   return true;
+   return bb;
}
 }
 
-  return false;
+  return NULL;
 }
 
 /* Main entry for the tree if-conversion pass.  */
@@ -884,12 +884,14 @@ pass_tree_ifcombine::execute (function *fun)
  inner ones, and also that we do not try to visit a removed
  block.  This is opposite of PHI-OPT, because we cascade the
  combining rather than cascading PHIs. */
+  basic_block seen = NULL;
+  bool changed = false;
   for (i = n_basic_blocks_for_fn (fun) - NUM_FIXED_BLOCKS - 1; i >= 0; i--)
 {
   basic_block bb = bbs[i];
 
   if (safe_is_a  (*gsi_last_bb (bb)))
-   if (tree_ssa_ifcombine_bb (bb))
+   if (basic_block outer_bb = tree_ssa_ifcombine_bb (bb))
  {
/* Clear range info from all stmts in BB which is now executed
   conditional on a always true/false condition.  */
@@ -908,7 +910,24 @@ pass_tree_ifcombine::execute (function *fun)
  rewrite_to_defined_overflow (&gsi);
  }
cfg_changed |= true;
+   if (seen)
+ changed |= true;
+   else
+ seen = bb;
+   /* Go back and check whether the modified outer_bb can be further
+  optimized.  ??? How could it?  */
+   do
+ i++;
+   while (bbs[i] != outer_bb);
+   continue;
  }
+
+  if (bb == seen)
+   {
+ gcc_assert (!changed);
+ seen = NULL;
+ changed = false;
+   }
 }
 
   free (bbs);


[gcc/aoliva/heads/testme] (2 commits) [libstdc++] [testsuite] no libatomic for vxworks

2024-06-24 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 441c8117368... [libstdc++] [testsuite] no libatomic for vxworks

It previously pointed to:

 7c42cd96b6b... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  7c42cd9... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]


Summary of changes (added commits):
---

  441c811... [libstdc++] [testsuite] no libatomic for vxworks
  82ef090... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]


[gcc(refs/users/aoliva/heads/testme)] [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

2024-06-24 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:82ef09057697f0df8557570673a59e501dd49316

commit 82ef09057697f0df8557570673a59e501dd49316
Author: Alexandre Oliva 
Date:   Thu Jun 20 07:26:40 2024 -0300

[testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

The test was too optimistic, alas.  We used to vectorize shifts by
clamping the shift counts below the bit width of the types (e.g. at 15
for 16-bit vector elements), but (uint16_t)32768 >> (uint16_t)16 is
well defined (because of promotion to 32-bit int) and must yield 0,
not 1 (as before the fix).

Unfortunately, in the gimple model of vector units, such large shift
counts wouldn't be well-defined, so we won't vectorize such shifts any
more, unless we can tell they're in range or undefined.

So the test that expected the vectorization we no longer performed
needs to be adjusted.  Instead of nobbling the test, Richard Earnshaw
suggested annotating the test with the expected ranges so as to enable
the optimization, and Christophe Lyon suggested a further
simplification.


Co-Authored-By: Richard Earnshaw 

for  gcc/testsuite/ChangeLog

PR tree-optimization/113281
* gcc.target/arm/simd/mve-vshr.c: Add expected ranges.

Diff:
---
 gcc/testsuite/gcc.target/arm/simd/mve-vshr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c 
b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
index 8c7adef9ed8..03078de49c6 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
@@ -9,6 +9,8 @@
   void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * 
__restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
 int i; \
 for (i=0; i= (unsigned)(BITS))  \
+   __builtin_unreachable();\
   dest[i] = a[i] OP b[i];  \
 }  \
 }


[gcc r15-1639] [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

2024-06-25 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:54d2339c9f87f702e02e571a5460e11c19e1c02f

commit r15-1639-g54d2339c9f87f702e02e571a5460e11c19e1c02f
Author: Alexandre Oliva 
Date:   Wed Jun 26 02:08:18 2024 -0300

[testsuite] [arm] [vect] adjust mve-vshr test [PR113281]

The test was too optimistic, alas.  We used to vectorize shifts by
clamping the shift counts below the bit width of the types (e.g. at 15
for 16-bit vector elements), but (uint16_t)32768 >> (uint16_t)16 is
well defined (because of promotion to 32-bit int) and must yield 0,
not 1 (as before the fix).

Unfortunately, in the gimple model of vector units, such large shift
counts wouldn't be well-defined, so we won't vectorize such shifts any
more, unless we can tell they're in range or undefined.

So the test that expected the vectorization we no longer performed
needs to be adjusted.  Instead of nobbling the test, Richard Earnshaw
suggested annotating the test with the expected ranges so as to enable
the optimization, and Christophe Lyon suggested a further
simplification.


Co-Authored-By: Richard Earnshaw 

for  gcc/testsuite/ChangeLog

PR tree-optimization/113281
* gcc.target/arm/simd/mve-vshr.c: Add expected ranges.

Diff:
---
 gcc/testsuite/gcc.target/arm/simd/mve-vshr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c 
b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
index 8c7adef9ed8..03078de49c6 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vshr.c
@@ -9,6 +9,8 @@
   void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * 
__restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
 int i; \
 for (i=0; i= (unsigned)(BITS))  \
+   __builtin_unreachable();\
   dest[i] = a[i] OP b[i];  \
 }  \
 }


[gcc r15-1640] [libstdc++] [testsuite] no libatomic for vxworks

2024-06-25 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:eed2027843409bf3afd03053d95760bdacb8fbf6

commit r15-1640-geed2027843409bf3afd03053d95760bdacb8fbf6
Author: Alexandre Oliva 
Date:   Wed Jun 26 02:08:27 2024 -0300

[libstdc++] [testsuite] no libatomic for vxworks

libatomic hasn't been ported to vxworks.  Most of the stdatomic.h and
 underlying requirements are provided by builtins and libgcc,
and the vxworks libc already provides remaining __atomic symbols, so
porting libatomic doesn't seem to make sense.

However, some of the target arch-only tests in
add_options_for_libatomic cover vxworks targets, so we end up
attempting to link libatomic in, even though it's not there.
Preempt those too-broad tests.


Co-Authored-By: Marc Poulhiès 

for  libstdc++-v3/ChangeLog

* testsuite/lib/dg-options.exp (add_options_for_libatomic):
None for *-*-vxworks*.

Diff:
---
 libstdc++-v3/testsuite/lib/dg-options.exp | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp 
b/libstdc++-v3/testsuite/lib/dg-options.exp
index 84f9e3ebc73..0d77fb029b0 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -338,6 +338,11 @@ proc atomic_link_flags { paths } {
 }
 
 proc add_options_for_libatomic { flags } {
+# We don't (need to) build libatomic for vxworks.  Don't try to
+# link it in, even on arches that support libatomic.
+if { [istarget *-*-vxworks*] } {
+   return $flags
+}
 if { [istarget hppa*-*-hpux*]
 || ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
 || [istarget riscv*-*-*]


[gcc/aoliva/heads/testbase] (143 commits) optab: Add isnormal_optab for isnormal builtin

2024-06-26 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 5a10ac0e592... optab: Add isnormal_optab for isnormal builtin

It previously pointed to:

 301927d9335... ada: Reference to nonexistent operator in reduction express

Diff:

Summary of changes (added commits):
---

  5a10ac0... optab: Add isnormal_optab for isnormal builtin (*)
  680eda8... optab: Add isfinite_optab for isfinite builtin (*)
  eed2027... [libstdc++] [testsuite] no libatomic for vxworks (*)
  54d2339... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281] (*)
  aac00d0... Optimize a < 0 ? -1 : 0 to (signed)a >> 31. (*)
  01f8b10... [PATCH 11/11] Handle subroutine types in CodeView (*)
  009b329... [PATCH 10/11] Handle bitfields for CodeView (*)
  3800a78... diagnostics: introduce diagnostic-global-context.cc (*)
  d681c52... diagnostics: eliminate various implicit uses of global_dc (*)
  1796790... testsuite: use check-jsonschema for validating .sarif files (*)
  9fe669c... Daily bump. (*)
  737449e... c++: decltype of capture proxy of ref [PR115504] (*)
  3e64a68... [PATCH 09/11] Handle arrays for CodeView (*)
  0a5f559... [PATCH 08/11] Handle unions for CodeView. (*)
  7d413a8... libstdc++: Simplify std::valarray initialization helpers (*)
  0381445... modula2: tidyup remove unused procedures and unused paramet (*)
  9d8021d... libstdc++: Replace viewcvs links in docs with cgit links (*)
  fc382a3... c++: ICE with __has_unique_object_representations [PR115476 (*)
  b1e828d... [PATCH v2 3/3] RISC-V: cmpmem for RISCV with V extension (*)
  d16355c... PR modula2/115540 gcc/m2/mc-boot-ch/Gtermios.cc error retur (*)
  1ea95cc... Add param for bb limit to invoke fast_vrp. (*)
  ed6ffc4... c++: ICE with generic lambda and pack expansion [PR115425] (*)
  71f484d... c++: ICE with __dynamic_cast redecl [PR115501] (*)
  3b9b8d6... ira: Scale save/restore costs of callee save registers with (*)
  9f168b4... PR modula2/115536 Expression is evaluated incorrectly when  (*)
  7c28228... [committed] Fix fr30-elf newlib build failure with late-com (*)
  b87e19a... late-combine: Honor targetm.cannot_copy_insn_p (*)
  06ebb7c... c++: alias CTAD and copy deduction guide [PR115198] (*)
  e3915c1... c++: using non-dep array var of unknown bound [PR115358] (*)
  21f1073... Fix PR c/115587, uninitialized variable in c_parser_omp_loo (*)
  3587bfa... GORI cleanups (*)
  d27049a... doc: gccint: Fix typos in jump_table_data description (*)
  b621506... Add a debug counter for late-combine (*)
  7107574... libatomic: Add rcpc3 128-bit atomic operations for AArch64 (*)
  d4db77c... SPARC: fix internal error with -mv8plus on 64-bit Linux (*)
  7048005... rs6000: Properly default-disable late-combine passes [PR106 (*)
  b694bf4... Revert one of the force_subreg changes (*)
  17b368b... MIPS: Implement vcond_mask optabs for MSA (*)
  0b45643... MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPI (*)
  30db579... aarch64: Add DLL import/export to AArch64 target (*)
  ed20fee... Adjust DLL import/export implementation for AArch64 (*)
  337632e... aarch64: Add selectany attribute handling (*)
  a86d7e1... Rename functions for reuse in AArch64 (*)
  63512c7... Extract ix86 dllimport implementation to mingw (*)
  104d06c... Move mingw_* declarations to the mingw folder (*)
  777cc6a... c: Fix ICE related to incomplete structures in C23 [PR11493 (*)
  4f86d2a... [PATCH 07/11] Handle structs and classes for CodeView (*)
  41ff74a... [committed][RISC-V] Fix some of the testsuite fallout from  (*)
  55947b3... Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode (*)
  7eddf6e... vms: Replace use of LONG_DOUBLE_TYPE_SIZE (*)
  bcd1b7a... rust: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE (*)
  fafd878... go: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE (*)
  f774721... c-family: Add Warning property to Wnrvo option [PR115624] (*)
  4c8b085... Make transitive relations an oracle option (*)
  c3be325... Daily bump. (*)
  a424318... [PATCH v2 2/3] RISC-V: setmem for RISCV with V extension (*)
  580c37f... RISC-V: Add dg-remove-option for z* extensions (*)
  f02c70d... Fortran: fix passing of optional dummy as actual to optiona (*)
  d8b05ae... PR tree-optimization/113673: Avoid load merging when potent (*)
  c43c74f... tree-optimization/115602 - SLP CSE results in cycles (*)
  2f83ea8... tree-optimization/115528 - fix vect alignment analysis for  (*)
  0de0476... Fix MinGW option -mcrtdll= (*)
  a6f7e3c... Regenerate common.opt.urls (*)
  792f97b... Add a late-combine pass [PR106594] (*)
  5185274... rtl-ssa: Rework _ignoring interfaces (*)
  ae13af2... tree-optimization/115599 - reassoc qsort comparator issue (*)
  6274f10... rs6000: Eliminate unnecessary byte swaps for duplicated con (*)
  ea8061f... fwprop: invoke change_is_worthwhile to judge if a replaceme (*)
  d820db3... [PATCH 06/11] Handle enums for CodeView (*)
  29fec9e... [PATCH 05/11] Handle const and varible modifiers for CodeVi (*)
  35cca2c... [PATCH

[gcc/aoliva/heads/testme] (144 commits) [libstdc++] [testsuite] defer to check_vect_support* [PR115

2024-06-26 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 c6581064248... [libstdc++] [testsuite] defer to check_vect_support* [PR115

It previously pointed to:

 441c8117368... [libstdc++] [testsuite] no libatomic for vxworks

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  441c811... [libstdc++] [testsuite] no libatomic for vxworks
  82ef090... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281]


Summary of changes (added commits):
---

  c658106... [libstdc++] [testsuite] defer to check_vect_support* [PR115
  5a10ac0... optab: Add isnormal_optab for isnormal builtin (*)
  680eda8... optab: Add isfinite_optab for isfinite builtin (*)
  eed2027... [libstdc++] [testsuite] no libatomic for vxworks (*)
  54d2339... [testsuite] [arm] [vect] adjust mve-vshr test [PR113281] (*)
  aac00d0... Optimize a < 0 ? -1 : 0 to (signed)a >> 31. (*)
  01f8b10... [PATCH 11/11] Handle subroutine types in CodeView (*)
  009b329... [PATCH 10/11] Handle bitfields for CodeView (*)
  3800a78... diagnostics: introduce diagnostic-global-context.cc (*)
  d681c52... diagnostics: eliminate various implicit uses of global_dc (*)
  1796790... testsuite: use check-jsonschema for validating .sarif files (*)
  9fe669c... Daily bump. (*)
  737449e... c++: decltype of capture proxy of ref [PR115504] (*)
  3e64a68... [PATCH 09/11] Handle arrays for CodeView (*)
  0a5f559... [PATCH 08/11] Handle unions for CodeView. (*)
  7d413a8... libstdc++: Simplify std::valarray initialization helpers (*)
  0381445... modula2: tidyup remove unused procedures and unused paramet (*)
  9d8021d... libstdc++: Replace viewcvs links in docs with cgit links (*)
  fc382a3... c++: ICE with __has_unique_object_representations [PR115476 (*)
  b1e828d... [PATCH v2 3/3] RISC-V: cmpmem for RISCV with V extension (*)
  d16355c... PR modula2/115540 gcc/m2/mc-boot-ch/Gtermios.cc error retur (*)
  1ea95cc... Add param for bb limit to invoke fast_vrp. (*)
  ed6ffc4... c++: ICE with generic lambda and pack expansion [PR115425] (*)
  71f484d... c++: ICE with __dynamic_cast redecl [PR115501] (*)
  3b9b8d6... ira: Scale save/restore costs of callee save registers with (*)
  9f168b4... PR modula2/115536 Expression is evaluated incorrectly when  (*)
  7c28228... [committed] Fix fr30-elf newlib build failure with late-com (*)
  b87e19a... late-combine: Honor targetm.cannot_copy_insn_p (*)
  06ebb7c... c++: alias CTAD and copy deduction guide [PR115198] (*)
  e3915c1... c++: using non-dep array var of unknown bound [PR115358] (*)
  21f1073... Fix PR c/115587, uninitialized variable in c_parser_omp_loo (*)
  3587bfa... GORI cleanups (*)
  d27049a... doc: gccint: Fix typos in jump_table_data description (*)
  b621506... Add a debug counter for late-combine (*)
  7107574... libatomic: Add rcpc3 128-bit atomic operations for AArch64 (*)
  d4db77c... SPARC: fix internal error with -mv8plus on 64-bit Linux (*)
  7048005... rs6000: Properly default-disable late-combine passes [PR106 (*)
  b694bf4... Revert one of the force_subreg changes (*)
  17b368b... MIPS: Implement vcond_mask optabs for MSA (*)
  0b45643... MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPI (*)
  30db579... aarch64: Add DLL import/export to AArch64 target (*)
  ed20fee... Adjust DLL import/export implementation for AArch64 (*)
  337632e... aarch64: Add selectany attribute handling (*)
  a86d7e1... Rename functions for reuse in AArch64 (*)
  63512c7... Extract ix86 dllimport implementation to mingw (*)
  104d06c... Move mingw_* declarations to the mingw folder (*)
  777cc6a... c: Fix ICE related to incomplete structures in C23 [PR11493 (*)
  4f86d2a... [PATCH 07/11] Handle structs and classes for CodeView (*)
  41ff74a... [committed][RISC-V] Fix some of the testsuite fallout from  (*)
  55947b3... Replace {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE with new hook mode (*)
  7eddf6e... vms: Replace use of LONG_DOUBLE_TYPE_SIZE (*)
  bcd1b7a... rust: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE (*)
  fafd878... go: Replace uses of {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE (*)
  f774721... c-family: Add Warning property to Wnrvo option [PR115624] (*)
  4c8b085... Make transitive relations an oracle option (*)
  c3be325... Daily bump. (*)
  a424318... [PATCH v2 2/3] RISC-V: setmem for RISCV with V extension (*)
  580c37f... RISC-V: Add dg-remove-option for z* extensions (*)
  f02c70d... Fortran: fix passing of optional dummy as actual to optiona (*)
  d8b05ae... PR tree-optimization/113673: Avoid load merging when potent (*)
  c43c74f... tree-optimization/115602 - SLP CSE results in cycles (*)
  2f83ea8... tree-optimization/115528 - fix vect alignment analysis for  (*)
  0de0476... Fix MinGW option -mcrtdll= (*)
  a6f7e3c... Regenerate common.opt.urls (*)
  792f97b... Add a late-combine pass [PR106594] (*)
  5185274... rtl-ssa: Rework _ignoring interfaces (*)
  ae13af2... tree-optimization/115599 

[gcc(refs/users/aoliva/heads/testme)] [i386] drop static decls moved to mingw/winnt-dll.cc

2024-06-26 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:6668cf365efd5eba5efc39313f0cdabb8f9eb658

commit 6668cf365efd5eba5efc39313f0cdabb8f9eb658
Author: Alexandre Oliva 
Date:   Wed Jun 26 07:04:58 2024 -0300

[i386] drop static decls moved to mingw/winnt-dll.cc

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

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index b0ef1bf08e0..1f71ed04be6 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -104,8 +104,6 @@ along with GCC; see the file COPYING3.  If not see
 /* This file should be included last.  */
 #include "target-def.h"
 
-static rtx legitimize_dllimport_symbol (rtx, bool);
-static rtx legitimize_pe_coff_extern_decl (rtx, bool);
 static void ix86_print_operand_address_as (FILE *, rtx, addr_space_t, bool);
 static void ix86_emit_restore_reg_using_pop (rtx, bool = false);


[gcc r12-10585] [libstdc++] [testsuite] defer to check_vect_support* [PR115454]

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:95ca5f458251e21123e45ec52c38d629d39cd0e4

commit r12-10585-g95ca5f458251e21123e45ec52c38d629d39cd0e4
Author: Alexandre Oliva 
Date:   Thu Jun 27 08:44:54 2024 -0300

[libstdc++] [testsuite] defer to check_vect_support* [PR115454]

The newly-added testcase overrides the default dg-do action set by
check_vect_support_and_set_flags (in libstdc++-dg/conformance.exp), so
it attempts to run the test even if runtime vector support is not
available.

Remove the explicit dg-do directive, so that the default is honored,
and the test is run if vector support is found, and only compiled
otherwise.


for  libstdc++-v3/ChangeLog

PR libstdc++/115454
* testsuite/experimental/simd/pr115454_find_last_set.cc: Defer
to check_vect_support_and_set_flags's default dg-do action.

(cherry picked from commit 95faa1bea7bdc7f92fcccb3543bfcbc8184c5e5b)

Diff:
---
 libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc 
b/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
index 25a713b4e94..4ade8601f27 100644
--- a/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc
@@ -1,5 +1,4 @@
 // { dg-options "-std=gnu++17" }
-// { dg-do run { target *-*-* } }
 // { dg-require-effective-target c++17 }
 // { dg-additional-options "-march=x86-64-v4" { target avx512f_runtime } }
 // { dg-require-cmath "" }


[gcc/aoliva/heads/testbase] (51 commits) libstdc++: Fix std::codecvt for e

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 73ad57c244c... libstdc++: Fix std::codecvt for e

It previously pointed to:

 5a10ac0e592... optab: Add isnormal_optab for isnormal builtin

Diff:

Summary of changes (added commits):
---

  73ad57c... libstdc++: Fix std::codecvt for e (*)
  95faa1b... [libstdc++] [testsuite] defer to check_vect_support* [PR115 (*)
  bcdbb85... Avoid global bitmap space in ranger. (*)
  dafa750... libstdc++: Fix std::format for chrono::duration with unsign (*)
  8fd84bc... libstdc++: Add debug assertions to std::vector [PR103 (*)
  cfc9fa3... libstdc++: Enable more debug assertions during constant eva (*)
  5c8b7fc... ada: Remove last uses of System.Address_Operations in runti (*)
  fdbc04d... ada: Reject ambiguous function calls in interpolated string (*)
  d4c9907... ada: Add missing dimension information for target names (*)
  432b8a3... ada: Fix array-manipulating code in Mdll (*)
  089bb07... ada: Bug using user defined string literals with interpolat (*)
  60ca710... ada: Overridden operation field not correctly set for contr (*)
  3cb7e22... ada: Implement first half of Generalized Finalization (*)
  9449524... i386: Refactor vcvttps2qq/vcvtqq2ps patterns. (*)
  4385dc9... vect: support direct conversion under x86-64-v3. (*)
  e5f8a39... vect: Support v4hi -> v4qi. (*)
  c320a7e... vect: generate suitable convert insn for int -> int, float  (*)
  b55798c... RISC-V: Add testcases for vector truncate after .SAT_SUB (*)
  2280e88... LoongArch: NFC: Dedup and sort the comment in loongarch_pri (*)
  94aade0... LoongArch: Tweak IOR rtx_cost for bstrins (*)
  b8153b5... Fix wrong cost of MEM when addr is a lea. (*)
  212441e... Internal-fn: Support new IFN SAT_TRUNC for unsigned scalar  (*)
  f2476a2... Vect: Support truncate after .SAT_SUB pattern in zip (*)
  c7cb0dd... tree-optimization/115652 - amend last fix (*)
  b7ba067... tree-optimization/115493 - complete previous fix (*)
  9c56dc7... Daily bump. (*)
  0731985... libstdc++: Add script to update docs for a new release bran (*)
  6eff233... libstdc++: Remove duplicate test (*)
  e65b662... libstdc++: Increase timeouts for PSTL tests in debug mode [ (*)
  003ce8a... libstdc++: Work around some PSTL test failures for debug mo (*)
  0ca8d56... libstdc++: Fix std::chrono::tzdb to work with vanguard form (*)
  629257b... tree-optimization/115629 - missed tail merging (*)
  86a3dbe... RISC-V: Update testcase comments to point to PSABI rather t (*)
  aa89e86... RISC-V: Consolidate amo testcase variants (*)
  08498f8... RISC-V: Rename amo testcases (*)
  e499aee... rs6000, change altivec*-runnable.c test file names (*)
  0699de2... rs6000, altivec-2-runnable.c update the require-effective-t (*)
  4bf719b... rs6000, altivec-1-runnable.c update the require-effective-t (*)
  47b68cd... [committed] Remove compromised sh test (*)
  03a3dff... [committed][RISC-V] Fix expected output for thead store pai (*)
  f80db54... tree-optimization/115652 - adjust insertion gsi for SLP (*)
  7a9b535... Record edge true/false value for gcov (*)
  0bf0021... Use the term MC/DC in help for gcov --conditions (*)
  229bf66... Add section on MC/DC in gcov manual (*)
  19f630e... Use auto_vec for memory release on return (*)
  ad20ad7... arm: make arm_predict_doloop_p reject loops with calls (*)
  7fada36... [aarch64] Add support for -mcpu=grace (*)
  f4e847b... i386: Remove declaration of unused functions (*)
  812c70b... rs6000: Fix wrong RTL patterns for vector merge high/low sh (*)
  62520e4... rs6000: Fix wrong RTL patterns for vector merge high/low ch (*)
  453b1d2... tree-optimization/115646 - ICE with pow shrink-wrapping fro (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testbase' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc/aoliva/heads/testme] (55 commits) Avoid dropping bits from num/den in fixed-point types

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 dec24e79d4e... Avoid dropping bits from num/den in fixed-point types

It previously pointed to:

 6668cf365ef... [i386] drop static decls moved to mingw/winnt-dll.cc

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  6668cf3... [i386] drop static decls moved to mingw/winnt-dll.cc
  c658106... [libstdc++] [testsuite] defer to check_vect_support* [PR115


Summary of changes (added commits):
---

  dec24e7... Avoid dropping bits from num/den in fixed-point types
  9235979... Map unpacked type to packed deduped type for debug info
  c0c2a61... make_type_from_size: fix compare for type reuse
  d16dbd4... Follow only proper TYPE_DEBUG_TYPE
  73ad57c... libstdc++: Fix std::codecvt for e (*)
  95faa1b... [libstdc++] [testsuite] defer to check_vect_support* [PR115 (*)
  bcdbb85... Avoid global bitmap space in ranger. (*)
  dafa750... libstdc++: Fix std::format for chrono::duration with unsign (*)
  8fd84bc... libstdc++: Add debug assertions to std::vector [PR103 (*)
  cfc9fa3... libstdc++: Enable more debug assertions during constant eva (*)
  5c8b7fc... ada: Remove last uses of System.Address_Operations in runti (*)
  fdbc04d... ada: Reject ambiguous function calls in interpolated string (*)
  d4c9907... ada: Add missing dimension information for target names (*)
  432b8a3... ada: Fix array-manipulating code in Mdll (*)
  089bb07... ada: Bug using user defined string literals with interpolat (*)
  60ca710... ada: Overridden operation field not correctly set for contr (*)
  3cb7e22... ada: Implement first half of Generalized Finalization (*)
  9449524... i386: Refactor vcvttps2qq/vcvtqq2ps patterns. (*)
  4385dc9... vect: support direct conversion under x86-64-v3. (*)
  e5f8a39... vect: Support v4hi -> v4qi. (*)
  c320a7e... vect: generate suitable convert insn for int -> int, float  (*)
  b55798c... RISC-V: Add testcases for vector truncate after .SAT_SUB (*)
  2280e88... LoongArch: NFC: Dedup and sort the comment in loongarch_pri (*)
  94aade0... LoongArch: Tweak IOR rtx_cost for bstrins (*)
  b8153b5... Fix wrong cost of MEM when addr is a lea. (*)
  212441e... Internal-fn: Support new IFN SAT_TRUNC for unsigned scalar  (*)
  f2476a2... Vect: Support truncate after .SAT_SUB pattern in zip (*)
  c7cb0dd... tree-optimization/115652 - amend last fix (*)
  b7ba067... tree-optimization/115493 - complete previous fix (*)
  9c56dc7... Daily bump. (*)
  0731985... libstdc++: Add script to update docs for a new release bran (*)
  6eff233... libstdc++: Remove duplicate test (*)
  e65b662... libstdc++: Increase timeouts for PSTL tests in debug mode [ (*)
  003ce8a... libstdc++: Work around some PSTL test failures for debug mo (*)
  0ca8d56... libstdc++: Fix std::chrono::tzdb to work with vanguard form (*)
  629257b... tree-optimization/115629 - missed tail merging (*)
  86a3dbe... RISC-V: Update testcase comments to point to PSABI rather t (*)
  aa89e86... RISC-V: Consolidate amo testcase variants (*)
  08498f8... RISC-V: Rename amo testcases (*)
  e499aee... rs6000, change altivec*-runnable.c test file names (*)
  0699de2... rs6000, altivec-2-runnable.c update the require-effective-t (*)
  4bf719b... rs6000, altivec-1-runnable.c update the require-effective-t (*)
  47b68cd... [committed] Remove compromised sh test (*)
  03a3dff... [committed][RISC-V] Fix expected output for thead store pai (*)
  f80db54... tree-optimization/115652 - adjust insertion gsi for SLP (*)
  7a9b535... Record edge true/false value for gcov (*)
  0bf0021... Use the term MC/DC in help for gcov --conditions (*)
  229bf66... Add section on MC/DC in gcov manual (*)
  19f630e... Use auto_vec for memory release on return (*)
  ad20ad7... arm: make arm_predict_doloop_p reject loops with calls (*)
  7fada36... [aarch64] Add support for -mcpu=grace (*)
  f4e847b... i386: Remove declaration of unused functions (*)
  812c70b... rs6000: Fix wrong RTL patterns for vector merge high/low sh (*)
  62520e4... rs6000: Fix wrong RTL patterns for vector merge high/low ch (*)
  453b1d2... tree-optimization/115646 - ICE with pow shrink-wrapping fro (*)

(*) This commit already exists in another branch.
Because the reference `refs/users/aoliva/heads/testme' matches
your hooks.email-new-commits-only configuration,
no separate email is sent for this commit.


[gcc(refs/users/aoliva/heads/testme)] Follow only proper TYPE_DEBUG_TYPE

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:d16dbd45239df22a2adfffcc248c7958224d2e04

commit d16dbd45239df22a2adfffcc248c7958224d2e04
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:10:29 2024 -0300

Follow only proper TYPE_DEBUG_TYPE

TYPE_DEBUG_TYPE's storage is shared with other sorts of references to
types, so it shouldn't be accessed unless TYPE_CAN_HAVE_DEBUG_TYPE_P
holds.


for  gcc/ada/ChangeLog

* gcc-interface/misc.cc (gnat_get_array_descr_info): Only follow
TYPE_DEBUG_TYPE if TYPE_CAN_HAVE_DEBUG_TYPE_P.

Diff:
---
 gcc/ada/gcc-interface/misc.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 4f6f6774fe7..f77629ce70b 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -967,7 +967,8 @@ gnat_get_array_descr_info (const_tree const_type,
 
   while (true)
{
- if (TYPE_DEBUG_TYPE (source_element_type))
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (source_element_type)
+ && TYPE_DEBUG_TYPE (source_element_type))
source_element_type = TYPE_DEBUG_TYPE (source_element_type);
  else if (TYPE_IS_PADDING_P (source_element_type))
source_element_type


[gcc(refs/users/aoliva/heads/testme)] make_type_from_size: fix compare for type reuse

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:c0c2a6152c78b54f3cc6737b667bf1aa53929713

commit c0c2a6152c78b54f3cc6737b667bf1aa53929713
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:01 2024 -0300

make_type_from_size: fix compare for type reuse

When make_type_from_size is called with a biased type, for an entity
that isn't explicitly biased, we may refrain from reusing the given
type because it doesn't seem to match, and then proceed to create an
exact copy of that type.

Compute earlier the biased status of the expected type, early enough
for the suitability check of the given type.  Modify for_biased
instead of biased_p, so that biased_p remains with the given type's
status for the comparison.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (make_type_from_size): Fix type reuse
by combining biased_p and for_biased earlier.  Hold the
combination in for_biased, adjusting later uses.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 0eb9af8d4a2..d8d42f57b89 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1383,6 +1383,11 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   biased_p = (TREE_CODE (type) == INTEGER_TYPE
  && TYPE_BIASED_REPRESENTATION_P (type));
 
+  /* FOR_BIASED initially refers to the entity's representation,
+not to its type's.  The type we're to return must take both
+into account.  */
+  for_biased |= biased_p;
+
   /* Integer types with precision 0 are forbidden.  */
   if (size == 0)
size = 1;
@@ -1394,12 +1399,10 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
  || size > (Enable_128bit_Types ? 128 : LONG_LONG_TYPE_SIZE))
break;
 
-  biased_p |= for_biased;
-
   /* The type should be an unsigned type if the original type is unsigned
 or if the lower bound is constant and non-negative or if the type is
 biased, see E_Signed_Integer_Subtype case of gnat_to_gnu_entity.  */
-  if (type_unsigned_for_rm (type) || biased_p)
+  if (type_unsigned_for_rm (type) || for_biased)
new_type = make_unsigned_type (size);
   else
new_type = make_signed_type (size);
@@ -1409,7 +1412,7 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   /* Copy the name to show that it's essentially the same type and
 not a subrange type.  */
   TYPE_NAME (new_type) = TYPE_NAME (type);
-  TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p;
+  TYPE_BIASED_REPRESENTATION_P (new_type) = for_biased;
   SET_TYPE_RM_SIZE (new_type, bitsize_int (size));
   return new_type;


[gcc(refs/users/aoliva/heads/testme)] Map unpacked type to packed deduped type for debug info

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:92359793fc3d8c94a6704e518555807227b21bea

commit 92359793fc3d8c94a6704e518555807227b21bea
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:27 2024 -0300

Map unpacked type to packed deduped type for debug info

Avoid creating unnecessary copies of types in make_type_from_size.
Cache the packed version of a biased type in TYPE_DEBUG_TYPE, so as to
map the unpacked type to it.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (make_type_from_size): Cache packed
variant, and map unpacked type to it in debug info.

for  gcc/testsuite/ChangeLog

* gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias.

Diff:
---
 gcc/ada/gcc-interface/utils.cc  | 19 +++
 gcc/testsuite/gnat.dg/bias1.adb |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index d8d42f57b89..daf8d7ccdc5 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1399,6 +1399,15 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
  || size > (Enable_128bit_Types ? 128 : LONG_LONG_TYPE_SIZE))
break;
 
+  /* If we've already created this type, the base type is supposed
+to map to it.  Check that it is what we expect.  */
+  if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
+ && (new_type = TYPE_DEBUG_TYPE (type))
+ && TYPE_PRECISION (new_type) == size
+ && ((TREE_CODE (new_type) == INTEGER_TYPE
+  && TYPE_BIASED_REPRESENTATION_P (new_type)) == for_biased))
+   return new_type;
+
   /* The type should be an unsigned type if the original type is unsigned
 or if the lower bound is constant and non-negative or if the type is
 biased, see E_Signed_Integer_Subtype case of gnat_to_gnu_entity.  */
@@ -1414,6 +1423,16 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   TYPE_NAME (new_type) = TYPE_NAME (type);
   TYPE_BIASED_REPRESENTATION_P (new_type) = for_biased;
   SET_TYPE_RM_SIZE (new_type, bitsize_int (size));
+
+  /* Enable us to avoid creating the same narrower type multiple
+times, and avoid duplication in debug information, by mapping
+the wider type to the narrower version.  If biasing is
+different, we use the narrower type for debug information.  */
+  if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
+ && !TYPE_DEBUG_TYPE (type)
+ && biased_p == for_biased)
+   SET_TYPE_DEBUG_TYPE (type, new_type);
+
   return new_type;
 
 case RECORD_TYPE:
diff --git a/gcc/testsuite/gnat.dg/bias1.adb b/gcc/testsuite/gnat.dg/bias1.adb
index 016a159b692..d9a00a1aa45 100644
--- a/gcc/testsuite/gnat.dg/bias1.adb
+++ b/gcc/testsuite/gnat.dg/bias1.adb
@@ -1,6 +1,7 @@
 --  { dg-do compile }
 --  { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" }
 --  { dg-final { scan-assembler "DW_AT_GNU_bias" } }
+--  { dg-final { scan-assembler-times "-7.*DW_AT_GNU_bias" 1 } }
 
 procedure Bias1 is
type Small is range -7 .. -4;
@@ -31,4 +32,4 @@ procedure Bias1 is
 
 begin
null;
-end Bias1;
\ No newline at end of file
+end Bias1;


[gcc(refs/users/aoliva/heads/testme)] Avoid dropping bits from num/den in fixed-point types

2024-06-27 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:dec24e79d4efe7f5b34c62b68ead75b9910e1a3b

commit dec24e79d4efe7f5b34c62b68ead75b9910e1a3b
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:54 2024 -0300

Avoid dropping bits from num/den in fixed-point types

We used to use an unsigned 128-bit type to hold the numerator and
denominator used to represent the delta of a fixed-point type in debug
information, but there are cases in which that was not enough, and
more significant bits silently overflowed and got omitted from debug
information.

Introduce a mode in which UI_to_gnu selects a wide-enough unsigned
type, and use that to convert numerator and denominator.


for  gcc/ada/ChangeLog

* gcc-interface/cuintp.cc (UI_To_gnu): Add mode that selects a
wide enough unsigned type.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Use it for
numerator and denominator of fixed-point types.

Diff:
---
 gcc/ada/gcc-interface/cuintp.cc | 47 ++---
 gcc/ada/gcc-interface/decl.cc   | 15 +
 2 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/gcc-interface/cuintp.cc b/gcc/ada/gcc-interface/cuintp.cc
index cdf6c019750..ad345096282 100644
--- a/gcc/ada/gcc-interface/cuintp.cc
+++ b/gcc/ada/gcc-interface/cuintp.cc
@@ -35,6 +35,7 @@
 #include "tree.h"
 #include "inchash.h"
 #include "fold-const.h"
+#include "stor-layout.h"
 
 #include "ada.h"
 #include "types.h"
@@ -67,7 +68,8 @@ build_cst_from_int (tree type, HOST_WIDE_INT low)
 /* Similar to UI_To_Int, but return a GCC INTEGER_CST or REAL_CST node,
depending on whether TYPE is an integral or real type.  Overflow is tested
by the constant-folding used to build the node.  TYPE is the GCC type of
-   the resulting node.  */
+   the resulting node.  If TYPE is NULL, an unsigned integer type wide enough
+   to hold the entire constant is selected.  */
 
 tree
 UI_To_gnu (Uint Input, tree type)
@@ -77,8 +79,10 @@ UI_To_gnu (Uint Input, tree type)
  any such possible value for intermediate computations and then rely on a
  conversion back to TYPE to perform the bias adjustment when need be.  */
   tree comp_type
-= TREE_CODE (type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)
-  ? get_base_type (type) : type;
+= (!type ? gnat_type_for_size (32, 0)
+   : (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type))
+   ? get_base_type (type) : type);
   tree gnu_ret;
 
   if (Input <= Uint_Direct_Last)
@@ -88,6 +92,7 @@ UI_To_gnu (Uint Input, tree type)
   Int Idx = (*Uints_Ptr)[Input - Uint_Table_Start].Loc;
   Pos Length = (*Uints_Ptr)[Input - Uint_Table_Start].Length;
   Int First = (*Udigits_Ptr)[Idx];
+  tree_code code = First < 0 ? MINUS_EXPR : PLUS_EXPR;
   tree gnu_base;
 
   gcc_assert (Length > 0);
@@ -99,26 +104,34 @@ UI_To_gnu (Uint Input, tree type)
 convert the final result back to the incoming type later on.  */
   if (!SCALAR_FLOAT_TYPE_P (comp_type) && TYPE_PRECISION (comp_type) < 32)
comp_type = gnat_type_for_size (32, 0);
+  else if (!type && TYPE_UNSIGNED (comp_type))
+   /* Choose a signed type, so that we can detect overflow.  */
+   comp_type = make_signed_type (TYPE_PRECISION (comp_type));
 
   gnu_base = build_cst_from_int (comp_type, Base);
 
   gnu_ret = build_cst_from_int (comp_type, First);
-  if (First < 0)
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (MINUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
-  else
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
+  for (Idx++, Length--; Length; Idx++, Length--)
+   for (;;)
+ {
+   tree next_ret = fold_build2 (code, comp_type,
+fold_build2 (MULT_EXPR, comp_type,
+ gnu_ret, gnu_base),
+build_cst_from_int
+(comp_type, (*Udigits_Ptr)[Idx]));
+   if (!TREE_OVERFLOW (next_ret) || type)
+ {
+   gnu_ret = next_ret;
+   break;
+ }
+   comp_type = make_signed_type (TYPE_PRECISION (comp_type) * 2);
+   gnu_base = convert (comp_type, gnu_base);
+   gnu_ret = 

[gcc/aoliva/heads/testme] (5 commits) make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 8f9705aadea... make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

It previously pointed to:

 dec24e79d4e... Avoid dropping bits from num/den in fixed-point types

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  dec24e7... Avoid dropping bits from num/den in fixed-point types
  9235979... Map unpacked type to packed deduped type for debug info
  c0c2a61... make_type_from_size: fix compare for type reuse
  d16dbd4... Follow only proper TYPE_DEBUG_TYPE


Summary of changes (added commits):
---

  8f9705a... make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops
  2e886d9... Map unpacked type to packed deduped type for debug info
  cdfb1ef... make_type_from_size: fix compare for type reuse
  0803a2d... Follow only proper TYPE_DEBUG_TYPE
  d47c7fe... Avoid dropping bits from num/den in fixed-point types


[gcc(refs/users/aoliva/heads/testme)] Avoid dropping bits from num/den in fixed-point types

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:d47c7fee5148a9ec1226bba9bc85ab9a3366e7e2

commit d47c7fee5148a9ec1226bba9bc85ab9a3366e7e2
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:54 2024 -0300

Avoid dropping bits from num/den in fixed-point types

We used to use an unsigned 128-bit type to hold the numerator and
denominator used to represent the delta of a fixed-point type in debug
information, but there are cases in which that was not enough, and
more significant bits silently overflowed and got omitted from debug
information.

Introduce a mode in which UI_to_gnu selects a wide-enough unsigned
type, and use that to convert numerator and denominator.


for  gcc/ada/ChangeLog

* gcc-interface/cuintp.cc (UI_To_gnu): Add mode that selects a
wide enough unsigned type.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Use it for
numerator and denominator of fixed-point types.

Diff:
---
 gcc/ada/gcc-interface/cuintp.cc | 47 ++---
 gcc/ada/gcc-interface/decl.cc   | 15 +
 2 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/gcc-interface/cuintp.cc b/gcc/ada/gcc-interface/cuintp.cc
index cdf6c019750..ad345096282 100644
--- a/gcc/ada/gcc-interface/cuintp.cc
+++ b/gcc/ada/gcc-interface/cuintp.cc
@@ -35,6 +35,7 @@
 #include "tree.h"
 #include "inchash.h"
 #include "fold-const.h"
+#include "stor-layout.h"
 
 #include "ada.h"
 #include "types.h"
@@ -67,7 +68,8 @@ build_cst_from_int (tree type, HOST_WIDE_INT low)
 /* Similar to UI_To_Int, but return a GCC INTEGER_CST or REAL_CST node,
depending on whether TYPE is an integral or real type.  Overflow is tested
by the constant-folding used to build the node.  TYPE is the GCC type of
-   the resulting node.  */
+   the resulting node.  If TYPE is NULL, an unsigned integer type wide enough
+   to hold the entire constant is selected.  */
 
 tree
 UI_To_gnu (Uint Input, tree type)
@@ -77,8 +79,10 @@ UI_To_gnu (Uint Input, tree type)
  any such possible value for intermediate computations and then rely on a
  conversion back to TYPE to perform the bias adjustment when need be.  */
   tree comp_type
-= TREE_CODE (type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)
-  ? get_base_type (type) : type;
+= (!type ? gnat_type_for_size (32, 0)
+   : (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type))
+   ? get_base_type (type) : type);
   tree gnu_ret;
 
   if (Input <= Uint_Direct_Last)
@@ -88,6 +92,7 @@ UI_To_gnu (Uint Input, tree type)
   Int Idx = (*Uints_Ptr)[Input - Uint_Table_Start].Loc;
   Pos Length = (*Uints_Ptr)[Input - Uint_Table_Start].Length;
   Int First = (*Udigits_Ptr)[Idx];
+  tree_code code = First < 0 ? MINUS_EXPR : PLUS_EXPR;
   tree gnu_base;
 
   gcc_assert (Length > 0);
@@ -99,26 +104,34 @@ UI_To_gnu (Uint Input, tree type)
 convert the final result back to the incoming type later on.  */
   if (!SCALAR_FLOAT_TYPE_P (comp_type) && TYPE_PRECISION (comp_type) < 32)
comp_type = gnat_type_for_size (32, 0);
+  else if (!type && TYPE_UNSIGNED (comp_type))
+   /* Choose a signed type, so that we can detect overflow.  */
+   comp_type = make_signed_type (TYPE_PRECISION (comp_type));
 
   gnu_base = build_cst_from_int (comp_type, Base);
 
   gnu_ret = build_cst_from_int (comp_type, First);
-  if (First < 0)
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (MINUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
-  else
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
+  for (Idx++, Length--; Length; Idx++, Length--)
+   for (;;)
+ {
+   tree next_ret = fold_build2 (code, comp_type,
+fold_build2 (MULT_EXPR, comp_type,
+ gnu_ret, gnu_base),
+build_cst_from_int
+(comp_type, (*Udigits_Ptr)[Idx]));
+   if (!TREE_OVERFLOW (next_ret) || type)
+ {
+   gnu_ret = next_ret;
+   break;
+ }
+   comp_type = make_signed_type (TYPE_PRECISION (comp_type) * 2);
+   gnu_base = convert (comp_type, gnu_base);
+   gnu_ret = 

[gcc(refs/users/aoliva/heads/testme)] Follow only proper TYPE_DEBUG_TYPE

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0803a2d3d173cf0153d9c6777b42f54d2a193d96

commit 0803a2d3d173cf0153d9c6777b42f54d2a193d96
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:10:29 2024 -0300

Follow only proper TYPE_DEBUG_TYPE

TYPE_DEBUG_TYPE's storage is shared with other sorts of references to
types, so it shouldn't be accessed unless TYPE_CAN_HAVE_DEBUG_TYPE_P
holds.


for  gcc/ada/ChangeLog

* gcc-interface/misc.cc (gnat_get_array_descr_info): Only follow
TYPE_DEBUG_TYPE if TYPE_CAN_HAVE_DEBUG_TYPE_P.

Diff:
---
 gcc/ada/gcc-interface/misc.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 4f6f6774fe7..f77629ce70b 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -967,7 +967,8 @@ gnat_get_array_descr_info (const_tree const_type,
 
   while (true)
{
- if (TYPE_DEBUG_TYPE (source_element_type))
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (source_element_type)
+ && TYPE_DEBUG_TYPE (source_element_type))
source_element_type = TYPE_DEBUG_TYPE (source_element_type);
  else if (TYPE_IS_PADDING_P (source_element_type))
source_element_type


[gcc(refs/users/aoliva/heads/testme)] make_type_from_size: fix compare for type reuse

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:cdfb1ef5b6c21a89bc518a170d359169f1e28fde

commit cdfb1ef5b6c21a89bc518a170d359169f1e28fde
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:01 2024 -0300

make_type_from_size: fix compare for type reuse

When make_type_from_size is called with a biased type, for an entity
that isn't explicitly biased, we may refrain from reusing the given
type because it doesn't seem to match, and then proceed to create an
exact copy of that type.

Compute earlier the biased status of the expected type, early enough
for the suitability check of the given type.  Modify for_biased
instead of biased_p, so that biased_p remains with the given type's
status for the comparison.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (make_type_from_size): Fix type reuse
by combining biased_p and for_biased earlier.  Hold the
combination in for_biased, adjusting later uses.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 0eb9af8d4a2..d8d42f57b89 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1383,6 +1383,11 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   biased_p = (TREE_CODE (type) == INTEGER_TYPE
  && TYPE_BIASED_REPRESENTATION_P (type));
 
+  /* FOR_BIASED initially refers to the entity's representation,
+not to its type's.  The type we're to return must take both
+into account.  */
+  for_biased |= biased_p;
+
   /* Integer types with precision 0 are forbidden.  */
   if (size == 0)
size = 1;
@@ -1394,12 +1399,10 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
  || size > (Enable_128bit_Types ? 128 : LONG_LONG_TYPE_SIZE))
break;
 
-  biased_p |= for_biased;
-
   /* The type should be an unsigned type if the original type is unsigned
 or if the lower bound is constant and non-negative or if the type is
 biased, see E_Signed_Integer_Subtype case of gnat_to_gnu_entity.  */
-  if (type_unsigned_for_rm (type) || biased_p)
+  if (type_unsigned_for_rm (type) || for_biased)
new_type = make_unsigned_type (size);
   else
new_type = make_signed_type (size);
@@ -1409,7 +1412,7 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   /* Copy the name to show that it's essentially the same type and
 not a subrange type.  */
   TYPE_NAME (new_type) = TYPE_NAME (type);
-  TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p;
+  TYPE_BIASED_REPRESENTATION_P (new_type) = for_biased;
   SET_TYPE_RM_SIZE (new_type, bitsize_int (size));
   return new_type;


[gcc(refs/users/aoliva/heads/testme)] Map unpacked type to packed deduped type for debug info

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:2e886d9baca052fdb7957b05697d0bdbf847c251

commit 2e886d9baca052fdb7957b05697d0bdbf847c251
Author: Alexandre Oliva 
Date:   Thu Jun 27 09:11:27 2024 -0300

Map unpacked type to packed deduped type for debug info

Avoid creating unnecessary copies of types in make_type_from_size.
Cache the packed version of a biased type in TYPE_DEBUG_TYPE, so as to
map the unpacked type to it.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (make_type_from_size): Cache packed
variant, and map unpacked type to it in debug info.

for  gcc/testsuite/ChangeLog

* gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias.

Diff:
---
 gcc/ada/gcc-interface/utils.cc  | 19 +++
 gcc/testsuite/gnat.dg/bias1.adb |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index d8d42f57b89..daf8d7ccdc5 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1399,6 +1399,15 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
  || size > (Enable_128bit_Types ? 128 : LONG_LONG_TYPE_SIZE))
break;
 
+  /* If we've already created this type, the base type is supposed
+to map to it.  Check that it is what we expect.  */
+  if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
+ && (new_type = TYPE_DEBUG_TYPE (type))
+ && TYPE_PRECISION (new_type) == size
+ && ((TREE_CODE (new_type) == INTEGER_TYPE
+  && TYPE_BIASED_REPRESENTATION_P (new_type)) == for_biased))
+   return new_type;
+
   /* The type should be an unsigned type if the original type is unsigned
 or if the lower bound is constant and non-negative or if the type is
 biased, see E_Signed_Integer_Subtype case of gnat_to_gnu_entity.  */
@@ -1414,6 +1423,16 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   TYPE_NAME (new_type) = TYPE_NAME (type);
   TYPE_BIASED_REPRESENTATION_P (new_type) = for_biased;
   SET_TYPE_RM_SIZE (new_type, bitsize_int (size));
+
+  /* Enable us to avoid creating the same narrower type multiple
+times, and avoid duplication in debug information, by mapping
+the wider type to the narrower version.  If biasing is
+different, we use the narrower type for debug information.  */
+  if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
+ && !TYPE_DEBUG_TYPE (type)
+ && biased_p == for_biased)
+   SET_TYPE_DEBUG_TYPE (type, new_type);
+
   return new_type;
 
 case RECORD_TYPE:
diff --git a/gcc/testsuite/gnat.dg/bias1.adb b/gcc/testsuite/gnat.dg/bias1.adb
index 016a159b692..d9a00a1aa45 100644
--- a/gcc/testsuite/gnat.dg/bias1.adb
+++ b/gcc/testsuite/gnat.dg/bias1.adb
@@ -1,6 +1,7 @@
 --  { dg-do compile }
 --  { dg-options "-cargs -g -dA -gnatws -fgnat-encodings=gdb -margs" }
 --  { dg-final { scan-assembler "DW_AT_GNU_bias" } }
+--  { dg-final { scan-assembler-times "-7.*DW_AT_GNU_bias" 1 } }
 
 procedure Bias1 is
type Small is range -7 .. -4;
@@ -31,4 +32,4 @@ procedure Bias1 is
 
 begin
null;
-end Bias1;
\ No newline at end of file
+end Bias1;


[gcc(refs/users/aoliva/heads/testme)] make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:8f9705aadea6b840c9a1403a7497dde7bb586ce6

commit 8f9705aadea6b840c9a1403a7497dde7bb586ce6
Author: Alexandre Oliva 
Date:   Fri Jun 28 05:35:58 2024 -0300

make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index daf8d7ccdc5..b46e035e1d4 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1427,10 +1427,12 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   /* Enable us to avoid creating the same narrower type multiple
 times, and avoid duplication in debug information, by mapping
 the wider type to the narrower version.  If biasing is
-different, we use the narrower type for debug information.  */
+different, we use the narrower type for debug information.
+Be careful to avoid forming loops.  */
   if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
  && !TYPE_DEBUG_TYPE (type)
- && biased_p == for_biased)
+ && biased_p == for_biased
+ && TREE_TYPE (new_type) != type)
SET_TYPE_DEBUG_TYPE (type, new_type);
 
   return new_type;


[gcc/aoliva/heads/testme] (2 commits) [dwarf] get_debug_type of qualified_type

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 0aa14458da7... [dwarf] get_debug_type of qualified_type

It previously pointed to:

 8f9705aadea... make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  8f9705a... make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops


Summary of changes (added commits):
---

  0aa1445... [dwarf] get_debug_type of qualified_type
  0c598db... make_type_from_size: avoid TYPE_DEBUG_TYPE / TREE_TYPE loop


[gcc(refs/users/aoliva/heads/testme)] make_type_from_size: avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0c598db8978a3569bd250a67ac52b7a88d544041

commit 0c598db8978a3569bd250a67ac52b7a88d544041
Author: Alexandre Oliva 
Date:   Fri Jun 28 05:35:58 2024 -0300

make_type_from_size: avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

Before make_type_from_size links a preexisting type to the
newly-created narrower type to use the latter for debug information
purposes, make sure that won't form a loop: if the type didn't have
TREE_TYPE set, the new type will link back to the original type,
rather than to the type's base type, and then modified_type_die would
recurse indefinitely between them.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (make_type_from_size): Avoid forming
loops.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index daf8d7ccdc5..b46e035e1d4 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1427,10 +1427,12 @@ make_type_from_size (tree type, tree size_tree, bool 
for_biased)
   /* Enable us to avoid creating the same narrower type multiple
 times, and avoid duplication in debug information, by mapping
 the wider type to the narrower version.  If biasing is
-different, we use the narrower type for debug information.  */
+different, we use the narrower type for debug information.
+Be careful to avoid forming loops.  */
   if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
  && !TYPE_DEBUG_TYPE (type)
- && biased_p == for_biased)
+ && biased_p == for_biased
+ && TREE_TYPE (new_type) != type)
SET_TYPE_DEBUG_TYPE (type, new_type);
 
   return new_type;


[gcc(refs/users/aoliva/heads/testme)] [dwarf] get_debug_type of qualified_type

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0aa14458da76fdbb55e77b0ed5b8069fe57ed56d

commit 0aa14458da76fdbb55e77b0ed5b8069fe57ed56d
Author: Alexandre Oliva 
Date:   Fri Jun 28 08:13:52 2024 -0300

[dwarf] get_debug_type of qualified_type

When we choose the narrower/packed variant of a type as the main debug
info type, we fail to output its name if we fail to advance
qualified_type to the main debug type in modified_type_die.


for  gcc/ChangeLog

* dwarf2out.cc (modified_type_die): Take qualified_type's
debug type.

Diff:
---
 gcc/dwarf2out.cc | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index f463435e446..bf5faffb700 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -13758,6 +13758,13 @@ modified_type_die (tree type, int cv_quals, bool 
reverse,
   /* If we do, then we can just use its DIE, if it exists.  */
   if (qualified_type)
 {
+  if (lang_hooks.types.get_debug_type)
+   {
+ tree debug_type = lang_hooks.types.get_debug_type (qualified_type);
+ if (debug_type != NULL)
+   qualified_type = debug_type;
+   }
+
   mod_type_die = lookup_type_die (qualified_type);
 
   /* DW_AT_endianity doesn't come from a qualifier on the type, so it is


[gcc/aoliva/heads/testme] [dwarf] get_debug_type of qualified_type

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 03263dba590... [dwarf] get_debug_type of qualified_type

It previously pointed to:

 0aa14458da7... [dwarf] get_debug_type of qualified_type

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  0aa1445... [dwarf] get_debug_type of qualified_type


Summary of changes (added commits):
---

  03263db... [dwarf] get_debug_type of qualified_type


[gcc(refs/users/aoliva/heads/testme)] [dwarf] get_debug_type of qualified_type

2024-06-28 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:03263dba5906e4f7987c89cff3c8e3f4c804e8df

commit 03263dba5906e4f7987c89cff3c8e3f4c804e8df
Author: Alexandre Oliva 
Date:   Fri Jun 28 08:13:52 2024 -0300

[dwarf] get_debug_type of qualified_type

When we choose the narrower/packed variant of a type as the main debug
info type, we fail to output its name if we fail to follow
debug type for the TYPE_NAME decl type in modified_type_die.


for  gcc/ChangeLog

* dwarf2out.cc (modified_type_die): Follow name's debug type.

Diff:
---
 gcc/dwarf2out.cc | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index f463435e446..5ce1a3e6f66 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -14051,8 +14051,11 @@ modified_type_die (tree type, int cv_quals, bool 
reverse,
   && (qualified_type == TYPE_MAIN_VARIANT (type)
   || (cv_quals == TYPE_UNQUALIFIED)))
  || (TREE_CODE (name) == TYPE_DECL
- && TREE_TYPE (name) == qualified_type
- && DECL_NAME (name
+ && DECL_NAME (name)
+ && (TREE_TYPE (name) == qualified_type
+ || (lang_hooks.types.get_debug_type
+ && (lang_hooks.types.get_debug_type (TREE_TYPE (name))
+ == qualified_type))
 {
   if (TREE_CODE (name) == TYPE_DECL)
/* Could just call add_name_and_src_coords_attributes here,


[gcc/aoliva/heads/testme] (3 commits) UI_To_gnu: cope with per-target precision limits

2024-07-01 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 18cdf562ea2... UI_To_gnu: cope with per-target precision limits

It previously pointed to:

 03263dba590... [dwarf] get_debug_type of qualified_type

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  03263db... [dwarf] get_debug_type of qualified_type


Summary of changes (added commits):
---

  18cdf56... UI_To_gnu: cope with per-target precision limits
  f216931... Introduce general caching of sized type
  0a9b788... [dwarf] get_debug_type of TYPE_NAME to compare with qualifi


[gcc(refs/users/aoliva/heads/testme)] Introduce general caching of sized type

2024-07-01 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:f216931275ed5b4244964ede0739e8c7e3cdd624

commit f216931275ed5b4244964ede0739e8c7e3cdd624
Author: Alexandre Oliva 
Date:   Mon Jul 1 22:17:10 2024 -0300

Introduce general caching of sized type

The simplified form of caching, in TYPE_DEBUG_TYPE, didn't work on
big-endian targets, so introduce general caching for sized integral
types, modeled after caching of packable types.


for  gcc/ada/ChangeLog

* gcc-interface/utils.cc (sized_type_hash): New struct.
(sized_type_hasher): New struct.
(sized_type_hash_table): New variable.
(init_gnat_utils): Allocate it.
(destroy_gnat_utils): Release it.
(sized_type_hasher::equal): New.
(hash_sized_type): New.
(canonicalize_sized_type): New.
(make_type_from_size): Use it, instead of
TYPE_DEBUG_TYPE-based caching.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 124 ++---
 1 file changed, 103 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index b46e035e1d4..66e3192ea4f 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -364,6 +364,26 @@ struct pad_type_hasher : ggc_cache_ptr_hash
 
 static GTY ((cache)) hash_table *pad_type_hash_table;
 
+struct GTY((for_user)) sized_type_hash
+{
+  hashval_t hash;
+  tree type;
+};
+
+struct sized_type_hasher : ggc_cache_ptr_hash
+{
+  static inline hashval_t hash (sized_type_hash *t) { return t->hash; }
+  static bool equal (sized_type_hash *a, sized_type_hash *b);
+
+  static int
+  keep_cache_entry (sized_type_hash *&t)
+  {
+return ggc_marked_p (t->type);
+  }
+};
+
+static GTY ((cache)) hash_table *sized_type_hash_table;
+
 static tree merge_sizes (tree, tree, tree, bool, bool);
 static tree fold_bit_position (const_tree);
 static tree compute_related_constant (tree, tree);
@@ -421,6 +441,9 @@ init_gnat_utils (void)
 
   /* Initialize the hash table of padded types.  */
   pad_type_hash_table = hash_table::create_ggc (512);
+
+  /* Initialize the hash table of sized types.  */
+  sized_type_hash_table = hash_table::create_ggc (512);
 }
 
 /* Destroy data structures of the utils.cc module.  */
@@ -443,6 +466,10 @@ destroy_gnat_utils (void)
   /* Destroy the hash table of padded types.  */
   pad_type_hash_table->empty ();
   pad_type_hash_table = NULL;
+
+  /* Destroy the hash table of sized types.  */
+  sized_type_hash_table->empty ();
+  sized_type_hash_table = NULL;
 }
 
 /* GNAT_ENTITY is a GNAT tree node for an entity.  Associate GNU_DECL, a GCC
@@ -1350,6 +1377,79 @@ type_unsigned_for_rm (tree type)
   return false;
 }
 
+/* Return true iff the sized types are equivalent.  */
+
+bool
+sized_type_hasher::equal (sized_type_hash *t1, sized_type_hash *t2)
+{
+  tree type1, type2;
+
+  if (t1->hash != t2->hash)
+return false;
+
+  type1 = t1->type;
+  type2 = t2->type;
+
+  /* We consider sized types equivalent if they have the same name,
+ size, alignment, RM size, and biasing.  The range is not expected
+ to vary across different-sized versions of the same base
+ type.  */
+  bool res
+= (TYPE_NAME (type1) == TYPE_NAME (type2)
+   && TYPE_SIZE (type1) == TYPE_SIZE (type2)
+   && TYPE_ALIGN (type1) == TYPE_ALIGN (type2)
+   && TYPE_RM_SIZE (type1) == TYPE_RM_SIZE (type2)
+   && (TYPE_BIASED_REPRESENTATION_P (type1)
+  == TYPE_BIASED_REPRESENTATION_P (type2)));
+
+  gcc_assert (!res
+ || (TYPE_RM_MIN_VALUE (type1) == TYPE_RM_MIN_VALUE (type2)
+ && TYPE_RM_MAX_VALUE (type1) == TYPE_RM_MAX_VALUE (type2)));
+
+  return res;
+}
+
+/* Compute the hash value for the sized TYPE.  */
+
+static hashval_t
+hash_sized_type (tree type)
+{
+  hashval_t hashcode;
+
+  hashcode = iterative_hash_expr (TYPE_NAME (type), 0);
+  hashcode = iterative_hash_expr (TYPE_SIZE (type), hashcode);
+  hashcode = iterative_hash_hashval_t (TYPE_ALIGN (type), hashcode);
+  hashcode = iterative_hash_expr (TYPE_RM_SIZE (type), hashcode);
+  hashcode
+= iterative_hash_hashval_t (TYPE_BIASED_REPRESENTATION_P (type), hashcode);
+
+  return hashcode;
+}
+
+/* Look up the sized TYPE in the hash table and return its canonical version
+   if it exists; otherwise, insert it into the hash table.  */
+
+static tree
+canonicalize_sized_type (tree type)
+{
+  const hashval_t hashcode = hash_sized_type (type);
+  struct sized_type_hash in, *h, **slot;
+
+  in.hash = hashcode;
+  in.type = type;
+  slot = sized_type_hash_table->find_slot_with_hash (&in, hashcode, INSERT);
+  h = *slot;
+  if (!h)
+{
+  h = ggc_alloc ();
+  h->hash = hashcode;
+  h->type = type;
+  *slot = h;
+}
+
+  return h->type;
+}
+
 /* Given a type TYPE, return a new type whose size is appropriate for SIZE.
If TYPE is the best type, return it.  Otherwise, make a new type.  We
only support new inte

[gcc(refs/users/aoliva/heads/testme)] [dwarf] get_debug_type of TYPE_NAME to compare with qualified_type

2024-07-01 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0a9b788f27514fe72c539de8a58f6d6cb6e2e97f

commit 0a9b788f27514fe72c539de8a58f6d6cb6e2e97f
Author: Alexandre Oliva 
Date:   Fri Jun 28 08:13:52 2024 -0300

[dwarf] get_debug_type of TYPE_NAME to compare with qualified_type

When we choose the narrower/packed variant of a type as the main debug
info type, we fail to output its name if we fail to follow
debug type for the TYPE_NAME decl type in modified_type_die.


for  gcc/ChangeLog

* dwarf2out.cc (modified_type_die): Follow name's debug type.

Diff:
---
 gcc/dwarf2out.cc | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index f463435e446..5ce1a3e6f66 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -14051,8 +14051,11 @@ modified_type_die (tree type, int cv_quals, bool 
reverse,
   && (qualified_type == TYPE_MAIN_VARIANT (type)
   || (cv_quals == TYPE_UNQUALIFIED)))
  || (TREE_CODE (name) == TYPE_DECL
- && TREE_TYPE (name) == qualified_type
- && DECL_NAME (name
+ && DECL_NAME (name)
+ && (TREE_TYPE (name) == qualified_type
+ || (lang_hooks.types.get_debug_type
+ && (lang_hooks.types.get_debug_type (TREE_TYPE (name))
+ == qualified_type))
 {
   if (TREE_CODE (name) == TYPE_DECL)
/* Could just call add_name_and_src_coords_attributes here,


[gcc(refs/users/aoliva/heads/testme)] UI_To_gnu: cope with per-target precision limits

2024-07-01 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:18cdf562ea2ae6b43df502e5ebb043f40d531884

commit 18cdf562ea2ae6b43df502e5ebb043f40d531884
Author: Alexandre Oliva 
Date:   Mon Jul 1 22:17:45 2024 -0300

UI_To_gnu: cope with per-target precision limits

Avoid exceeding the maximum precision for wide ints, and for available
int modes, when selecting a type to represent very wide constants,
falling back to 0/0 for unrepresentable fractions.


for  gcc/ada/ChangeLog

* gcc-interface/cuintp.cc (UI_To_gnu): Don't exceed available
integral mode widths.  Fail if the constant exceeds the
representable numbers.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Recognize the
failure mode and fall back to an indeterminate fraction.

Diff:
---
 gcc/ada/gcc-interface/cuintp.cc | 40 
 gcc/ada/gcc-interface/decl.cc   |  4 
 2 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/gcc-interface/cuintp.cc b/gcc/ada/gcc-interface/cuintp.cc
index ad345096282..6a03131144b 100644
--- a/gcc/ada/gcc-interface/cuintp.cc
+++ b/gcc/ada/gcc-interface/cuintp.cc
@@ -69,7 +69,8 @@ build_cst_from_int (tree type, HOST_WIDE_INT low)
depending on whether TYPE is an integral or real type.  Overflow is tested
by the constant-folding used to build the node.  TYPE is the GCC type of
the resulting node.  If TYPE is NULL, an unsigned integer type wide enough
-   to hold the entire constant is selected.  */
+   to hold the entire constant is selected, and if no such type exists,
+   return NULL_TREE.  */
 
 tree
 UI_To_gnu (Uint Input, tree type)
@@ -79,7 +80,7 @@ UI_To_gnu (Uint Input, tree type)
  any such possible value for intermediate computations and then rely on a
  conversion back to TYPE to perform the bias adjustment when need be.  */
   tree comp_type
-= (!type ? gnat_type_for_size (32, 0)
+= (!type ? gnat_type_for_size (32, 1)
: (TREE_CODE (type) == INTEGER_TYPE
  && TYPE_BIASED_REPRESENTATION_P (type))
? get_base_type (type) : type);
@@ -96,6 +97,10 @@ UI_To_gnu (Uint Input, tree type)
   tree gnu_base;
 
   gcc_assert (Length > 0);
+  /* The extension of unsigned types we use to try to fit the
+constant only works if we're dealing with nonnegative
+constants, but that's what we expect when !TYPE.  */
+  gcc_assert (type || First >= 0);
 
   /* The computations we perform below always require a type at least as
 large as an integer not to overflow.  FP types are always fine, but
@@ -104,9 +109,6 @@ UI_To_gnu (Uint Input, tree type)
 convert the final result back to the incoming type later on.  */
   if (!SCALAR_FLOAT_TYPE_P (comp_type) && TYPE_PRECISION (comp_type) < 32)
comp_type = gnat_type_for_size (32, 0);
-  else if (!type && TYPE_UNSIGNED (comp_type))
-   /* Choose a signed type, so that we can detect overflow.  */
-   comp_type = make_signed_type (TYPE_PRECISION (comp_type));
 
   gnu_base = build_cst_from_int (comp_type, Base);
 
@@ -114,24 +116,38 @@ UI_To_gnu (Uint Input, tree type)
   for (Idx++, Length--; Length; Idx++, Length--)
for (;;)
  {
-   tree next_ret = fold_build2 (code, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int
-(comp_type, (*Udigits_Ptr)[Idx]));
+   tree elt, scaled, next_ret;
+   elt = build_cst_from_int (comp_type, (*Udigits_Ptr)[Idx]);
+   if (!type)
+ {
+   scaled = int_const_binop (MULT_EXPR, gnu_ret, gnu_base, -1);
+   next_ret = int_const_binop (code, scaled, elt, -1);
+ }
+   else
+ {
+   scaled = fold_build2 (MULT_EXPR, comp_type, gnu_ret, gnu_base);
+   next_ret = fold_build2 (code, comp_type, scaled, elt);
+ }
if (!TREE_OVERFLOW (next_ret) || type)
  {
gnu_ret = next_ret;
break;
  }
-   comp_type = make_signed_type (TYPE_PRECISION (comp_type) * 2);
+   opt_scalar_int_mode wider_mode
+ = GET_MODE_WIDER_MODE (SCALAR_INT_TYPE_MODE
+(comp_type)).require ();
+   if (!wider_mode.exists ())
+ /* Signal that we couldn't represent the value.  */
+ return NULL_TREE;
+   comp_type = make_unsigned_type (GET_MODE_BITSIZE
+   (wider_mode.require ()));
gnu_base = convert (comp_type, gnu_base);
gnu_ret = convert (comp_type, gnu_ret);
  }
 }
 
   if (!type)
-type = make_unsigned_type (TYPE_PRECISION (comp_type));
+type = comp_type;
   gnu_ret = c

[gcc r15-1814] [i386] restore recompute to override opts after change [PR113719]

2024-07-03 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:bf2fc0a27b35de039c3d45e6d7ea9ad0a8a305ba

commit r15-1814-gbf2fc0a27b35de039c3d45e6d7ea9ad0a8a305ba
Author: Alexandre Oliva 
Date:   Thu Jun 13 00:12:47 2024 -0300

[i386] restore recompute to override opts after change [PR113719]

The first patch for PR113719 regressed gcc.dg/ipa/iinline-attr.c on
toolchains configured to --enable-frame-pointer, because the
optimization node created within handle_optimize_attribute had
flag_omit_frame_pointer incorrectly set, whereas
default_optimization_node didn't.  With this difference,
can_inline_edge_by_limits_p flagged an optimization mismatch and we
refused to inline the function that had a redundant optimization flag
into one that didn't, which is exactly what is tested for there.

This patch restores the calls to ix86_default_align and
ix86_recompute_optlev_based_flags that used to be, and ought to be,
issued during TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE, but preserves the
intent of the original change, of having those functions called at
different spots within ix86_option_override_internal.  To that end,
the remaining bits were refactored into a separate function, that was
in turn adjusted to operate on explicitly-passed opts and opts_set,
rather than going for their global counterparts.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc
(ix86_override_options_after_change_1): Add opts and opts_set
parms, operate on them, after factoring out of...
(ix86_override_options_after_change): ... this.  Restore calls
of ix86_default_align and ix86_recompute_optlev_based_flags.
(ix86_option_override_internal): Call the factored-out bits.

Diff:
---
 gcc/config/i386/i386-options.cc | 59 -
 1 file changed, 40 insertions(+), 19 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 1ef2c71a7a2..5824c0cb072 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1913,37 +1913,58 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
 }
 }
 
-/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+/* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
 
-void
-ix86_override_options_after_change (void)
+static void
+ix86_override_options_after_change_1 (struct gcc_options *opts,
+ struct gcc_options *opts_set)
 {
+#define OPTS_SET_P(OPTION) opts_set->x_ ## OPTION
+#define OPTS(OPTION) opts->x_ ## OPTION
+
   /* Disable unrolling small loops when there's explicit
  -f{,no}unroll-loop.  */
-  if ((OPTION_SET_P (flag_unroll_loops))
- || (OPTION_SET_P (flag_unroll_all_loops)
-&& flag_unroll_all_loops))
+  if ((OPTS_SET_P (flag_unroll_loops))
+ || (OPTS_SET_P (flag_unroll_all_loops)
+&& OPTS (flag_unroll_all_loops)))
 {
-  if (!OPTION_SET_P (ix86_unroll_only_small_loops))
-   ix86_unroll_only_small_loops = 0;
+  if (!OPTS_SET_P (ix86_unroll_only_small_loops))
+   OPTS (ix86_unroll_only_small_loops) = 0;
   /* Re-enable -frename-registers and -fweb if funroll-loops
 enabled.  */
-  if (!OPTION_SET_P (flag_web))
-   flag_web = flag_unroll_loops;
-  if (!OPTION_SET_P (flag_rename_registers))
-   flag_rename_registers = flag_unroll_loops;
+  if (!OPTS_SET_P (flag_web))
+   OPTS (flag_web) = OPTS (flag_unroll_loops);
+  if (!OPTS_SET_P (flag_rename_registers))
+   OPTS (flag_rename_registers) = OPTS (flag_unroll_loops);
   /* -fcunroll-grow-size default follws -f[no]-unroll-loops.  */
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_unroll_loops
-|| flag_peel_loops
-|| optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_unroll_loops)
+|| OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
   else
 {
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
 
+#undef OPTS
+#undef OPTS_SET_P
+}
+
+/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+
+void
+ix86_override_options_after_change (void)
+{
+  ix86_default_align (&global_options);
+
+  ix86_recompute_optlev_based_flags (&global_options, &global_options_set);
+
+  ix86_override_options_after_change_1 (&global_options, &global_options_set);
 }
 
 /* Clear stack slot assignments remembered from previous functions.
@@ -2493,7 +2514,7 @@ ix86_option_override_internal (bool main_args_p,
 
   ix86_recompute_optl

[gcc r15-1815] [debug] Avoid dropping bits from num/den in fixed-point types

2024-07-03 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:113c4826f5e1ff88a9e1625980ff0b617583279c

commit r15-1815-g113c4826f5e1ff88a9e1625980ff0b617583279c
Author: Alexandre Oliva 
Date:   Wed Jul 3 07:33:00 2024 -0300

[debug] Avoid dropping bits from num/den in fixed-point types

We used to use an unsigned 128-bit type to hold the numerator and
denominator used to represent the delta of a fixed-point type in debug
information, but there are cases in which that was not enough, and
more significant bits silently overflowed and got omitted from debug
information.

Introduce a mode in which UI_to_gnu selects a wide-enough unsigned
type, and use that to convert numerator and denominator.  While at
that, avoid exceeding the maximum precision for wide ints, and for
available int modes, when selecting a type to represent very wide
constants, falling back to 0/0 for unrepresentable fractions.


for  gcc/ada/ChangeLog

* gcc-interface/cuintp.cc (UI_To_gnu): Add mode that selects a
wide enough unsigned type.  Fail if the constant exceeds the
representable numbers.
* gcc-interface/decl.cc (gnat_to_gnu_entity): Use it for
numerator and denominator of fixed-point types.  In case of
failure, fall back to an indeterminate fraction.

Diff:
---
 gcc/ada/gcc-interface/cuintp.cc | 66 ++---
 gcc/ada/gcc-interface/decl.cc   | 19 +---
 2 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/gcc/ada/gcc-interface/cuintp.cc b/gcc/ada/gcc-interface/cuintp.cc
index cdf6c019750..1903c5af0f1 100644
--- a/gcc/ada/gcc-interface/cuintp.cc
+++ b/gcc/ada/gcc-interface/cuintp.cc
@@ -35,6 +35,7 @@
 #include "tree.h"
 #include "inchash.h"
 #include "fold-const.h"
+#include "stor-layout.h"
 
 #include "ada.h"
 #include "types.h"
@@ -67,7 +68,9 @@ build_cst_from_int (tree type, HOST_WIDE_INT low)
 /* Similar to UI_To_Int, but return a GCC INTEGER_CST or REAL_CST node,
depending on whether TYPE is an integral or real type.  Overflow is tested
by the constant-folding used to build the node.  TYPE is the GCC type of
-   the resulting node.  */
+   the resulting node.  If TYPE is NULL, an unsigned integer type wide enough
+   to hold the entire constant is selected, and if no such type exists,
+   return NULL_TREE.  */
 
 tree
 UI_To_gnu (Uint Input, tree type)
@@ -77,8 +80,10 @@ UI_To_gnu (Uint Input, tree type)
  any such possible value for intermediate computations and then rely on a
  conversion back to TYPE to perform the bias adjustment when need be.  */
   tree comp_type
-= TREE_CODE (type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)
-  ? get_base_type (type) : type;
+= (!type ? gnat_type_for_size (32, 1)
+   : (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type))
+   ? get_base_type (type) : type);
   tree gnu_ret;
 
   if (Input <= Uint_Direct_Last)
@@ -88,9 +93,14 @@ UI_To_gnu (Uint Input, tree type)
   Int Idx = (*Uints_Ptr)[Input - Uint_Table_Start].Loc;
   Pos Length = (*Uints_Ptr)[Input - Uint_Table_Start].Length;
   Int First = (*Udigits_Ptr)[Idx];
+  tree_code code = First < 0 ? MINUS_EXPR : PLUS_EXPR;
   tree gnu_base;
 
   gcc_assert (Length > 0);
+  /* The extension of unsigned types we use to try to fit the
+constant only works if we're dealing with nonnegative
+constants, but that's what we expect when !TYPE.  */
+  gcc_assert (type || First >= 0);
 
   /* The computations we perform below always require a type at least as
 large as an integer not to overflow.  FP types are always fine, but
@@ -103,22 +113,44 @@ UI_To_gnu (Uint Input, tree type)
   gnu_base = build_cst_from_int (comp_type, Base);
 
   gnu_ret = build_cst_from_int (comp_type, First);
-  if (First < 0)
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (MINUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
-  else
-   for (Idx++, Length--; Length; Idx++, Length--)
- gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
-fold_build2 (MULT_EXPR, comp_type,
- gnu_ret, gnu_base),
-build_cst_from_int (comp_type,
-(*Udigits_Ptr)[Idx]));
+  for (Idx++, Length--; Length; Idx++, Length--)
+   for (;;)
+ {
+   tree elt, scaled, next_ret;
+   elt = build_cst_from_int (comp_type, (*Udigits_Ptr)[Idx]);
+   /* We want to detect overflows with an unsigned type when
+  TYPE is not given

[gcc r15-1816] Deduplicate explicitly-sized types

2024-07-03 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:640f0f3e2b771e23665924f24527e6b1a5db8d3c

commit r15-1816-g640f0f3e2b771e23665924f24527e6b1a5db8d3c
Author: Alexandre Oliva 
Date:   Wed Jul 3 07:33:08 2024 -0300

Deduplicate explicitly-sized types

When make_type_from_size is called with a biased type, for an entity
that isn't explicitly biased, we may refrain from reusing the given
type because it doesn't seem to match, and then proceed to create an
exact copy of that type.

Compute earlier the biased status of the expected type, early enough
for the suitability check of the given type.  Modify for_biased
instead of biased_p, so that biased_p remains with the given type's
status for the comparison.

Avoid creating unnecessary copies of types in make_type_from_size, by
caching and reusing previously-created identical types, similarly to
the caching of packable types.

While at that, fix two vaguely related issues:

- TYPE_DEBUG_TYPE's storage is shared with other sorts of references
to types, so it shouldn't be accessed unless
TYPE_CAN_HAVE_DEBUG_TYPE_P holds.

- When we choose the narrower/packed variant of a type as the main
debug info type, we fail to output its name if we fail to follow debug
type for the TYPE_NAME decl type in modified_type_die.


for  gcc/ada/ChangeLog

* gcc-interface/misc.cc (gnat_get_array_descr_info): Only follow
TYPE_DEBUG_TYPE if TYPE_CAN_HAVE_DEBUG_TYPE_P.
* gcc-interface/utils.cc (sized_type_hash): New struct.
(sized_type_hasher): New struct.
(sized_type_hash_table): New variable.
(init_gnat_utils): Allocate it.
(destroy_gnat_utils): Release it.
(sized_type_hasher::equal): New.
(hash_sized_type): New.
(canonicalize_sized_type): New.
(make_type_from_size): Use it to cache packed variants.  Fix
type reuse by combining biased_p and for_biased earlier.  Hold
the combination in for_biased, adjusting later uses.

for  gcc/ChangeLog

* dwarf2out.cc (modified_type_die): Follow name's debug type.

for  gcc/testsuite/ChangeLog

* gnat.dg/bias1.adb: Count occurrences of -7.*DW_AT_GNU_bias.

Diff:
---
 gcc/ada/gcc-interface/misc.cc   |   3 +-
 gcc/ada/gcc-interface/utils.cc  | 116 ++--
 gcc/dwarf2out.cc|   7 ++-
 gcc/testsuite/gnat.dg/bias1.adb |   3 +-
 4 files changed, 120 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 4f6f6774fe7..f77629ce70b 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -967,7 +967,8 @@ gnat_get_array_descr_info (const_tree const_type,
 
   while (true)
{
- if (TYPE_DEBUG_TYPE (source_element_type))
+ if (TYPE_CAN_HAVE_DEBUG_TYPE_P (source_element_type)
+ && TYPE_DEBUG_TYPE (source_element_type))
source_element_type = TYPE_DEBUG_TYPE (source_element_type);
  else if (TYPE_IS_PADDING_P (source_element_type))
source_element_type
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 0eb9af8d4a2..66e3192ea4f 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -364,6 +364,26 @@ struct pad_type_hasher : ggc_cache_ptr_hash
 
 static GTY ((cache)) hash_table *pad_type_hash_table;
 
+struct GTY((for_user)) sized_type_hash
+{
+  hashval_t hash;
+  tree type;
+};
+
+struct sized_type_hasher : ggc_cache_ptr_hash
+{
+  static inline hashval_t hash (sized_type_hash *t) { return t->hash; }
+  static bool equal (sized_type_hash *a, sized_type_hash *b);
+
+  static int
+  keep_cache_entry (sized_type_hash *&t)
+  {
+return ggc_marked_p (t->type);
+  }
+};
+
+static GTY ((cache)) hash_table *sized_type_hash_table;
+
 static tree merge_sizes (tree, tree, tree, bool, bool);
 static tree fold_bit_position (const_tree);
 static tree compute_related_constant (tree, tree);
@@ -421,6 +441,9 @@ init_gnat_utils (void)
 
   /* Initialize the hash table of padded types.  */
   pad_type_hash_table = hash_table::create_ggc (512);
+
+  /* Initialize the hash table of sized types.  */
+  sized_type_hash_table = hash_table::create_ggc (512);
 }
 
 /* Destroy data structures of the utils.cc module.  */
@@ -443,6 +466,10 @@ destroy_gnat_utils (void)
   /* Destroy the hash table of padded types.  */
   pad_type_hash_table->empty ();
   pad_type_hash_table = NULL;
+
+  /* Destroy the hash table of sized types.  */
+  sized_type_hash_table->empty ();
+  sized_type_hash_table = NULL;
 }
 
 /* GNAT_ENTITY is a GNAT tree node for an entity.  Associate GNU_DECL, a GCC
@@ -1350,6 +1377,79 @@ type_unsigned_for_rm (tree type)
   return false;
 }
 
+/* Return true iff the sized types are equivalent.  */
+
+bool
+sized_type_hasher::equal (siz

[gcc/aoliva/heads/testbase] (268 commits) RISC-V: c implies zca, and conditionally zcf & zcd

2024-07-10 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 36e5e409190e... RISC-V: c implies zca, and conditionally zcf & zcd

It previously pointed to:

 73ad57c244c2... libstdc++: Fix std::codecvt for e

Diff:

Summary of changes (added commits):
---

  36e5e40... RISC-V: c implies zca, and conditionally zcf & zcd (*)
  f777ab3... Daily bump. (*)
  3918bea... Vect: Optimize truncation for .SAT_SUB operands (*)
  d8cd852... libstdc++: Make std::basic_format_context non-copyable [PR1 (*)
  9f75895... libstdc++: Minor optimization for std::locale::encoding() (*)
  c5efc6e... libstdc++: Use direct-initialization for std::vector' (*)
  cda469a... libstdc++: ranges::find needs explicit conversion to size_t (*)
  aae535f... i386: Swap compare operands in ustrunc patterns (*)
  f0fb6b6... c++: remove Concepts TS code (*)
  0c27ead... c: ICE with invalid sizeof [PR115642] (*)
  4c70097... c: ICE on invalid with attribute optimize [PR115549] (*)
  4865a92... testsuite: Align testcase with implementation [PR105090] (*)
  04df2a9... RISC-V: Update testsuite to use b (*)
  2a90c41... RISC-V: Add support for B standard extension (*)
  5686d3b... internal-fn: Reuse SUBREG_PROMOTED_VAR_P handling (*)
  fde96e8... c++: array new with value-initialization [PR115645] (*)
  9d20529... recog: Handle some mode-changing hardreg propagations (*)
  e08ebd7... rtl-ssa: Add replace_nondebug_insn [PR115785] (*)
  7d454ca... fixincludes: skip stdio_stdarg_h on darwin (*)
  c829042... c++, contracts: Fix ICE in create_tmp_var [PR113968] (*)
  8326956... fixincludes: add bypass to darwin_objc_runtime_1 (*)
  2d1f68e... PR modula2/115823 Wrong expansion of isnormal optab (*)
  44933fd... middle-end: Fix stalled swapped condition code value [PR115 (*)
  73f... arm: cleanup legacy ARM_PE code (*)
  23c2e6d... [PR115394] Remove streamer_debugging and it's uses. (*)
  80e446e... Match: Support form 2 for the .SAT_TRUNC (*)
  1ae5fc2... testsuite: Tests the pattern folding x/sqrt(x) to sqrt(x) f (*)
  6fce466... testsuite: Allow matching `{_1, { 0,0,0,0 }}` for vect/slp- (*)
  8f8bddb... Remove expanding complex EQ/NE inside a GIMPLE_RETURN [PR11 (*)
  7a345d0... RISC-V: fix zcmp popretz [PR113715] (*)
  0dcfef4... Daily bump. (*)
  5b46f19... Fix test errors after r15-1394 for sizeof(int)==sizeof(long (*)
  7825c07... c: Fix ICE for redeclaration of structs with different alig (*)
  592a746... c: Fix ICE for incorrect code in comptypes_verify [PR115696 (*)
  e611189... rs6000, remove vector set and vector init built-ins. (*)
  5db91b3... rs6000, remove __builtin_vsx_xvcmpeqsp_p built-in (*)
  c5b4bfe... rs6000, extend vec_xxpermdi built-in for __int128 args (*)
  ca4842f... rs6000, remove __builtin_vsx_xvnegdp and __builtin_vsx_xvne (*)
  7121926... rs6000, remove __builtin_vsx_vperm_* built-ins (*)
  52d5698... rs6000, remove the vec_xxsel built-ins, they are duplicates (*)
  807bed0... rs6000, add overloaded vec_sel with int128 arguments (*)
  8d6326e... rs6000, remove duplicated built-ins of vecmergl and vec_mer (*)
  fd9fdb3... rs6000, Remove redundant vector float/double type conversio (*)
  b620845... rs6000, extend the current vec_{un,}signed{e,o} built-ins (*)
  6031e34... rs6000, fix error in unsigned vector float to unsigned int  (*)
  224cc56... rs6000, Remove __builtin_vsx_xvcv{sp{sx,u}ws,dpuxds_uns} (*)
  7ed9a45... rs6000, Remove __builtin_vsx_cmple* builtins (*)
  d17889d... i386: Implement .SAT_TRUNC for unsigned integers (*)
  2d6e6a7... diagnostics: use refs rather than pointers for diagnostic_{ (*)
  959c168... arm: clean up some legacy FPA related cruft. (*)
  5ef0b7d... RISC-V: Fix comment/naming in attribute parsing code (*)
  85fa334... RISC-V: Deduplicate arch subset list processing (*)
  0717d50... RISC-V: testsuite: Properly gate LTO tests (*)
  298a576... i386: Correct AVX10 CPUID emulation (*)
  4f76717... c: Rewrite c_parser_omp_tile_sizes to use c_parser_expr_lis (*)
  8eab506... c++: Implement C++26 CWG2819 - Allow cv void * null pointer (*)
  23ab7f6... Rename __{float,double}_u to __x86_{float,double}_u to avoi (*)
  ecde8d5... RISC-V: Add testcases for unsigned vector .SAT_ADD IMM form (*)
  35b1096... RISC-V: Add testcases for unsigned vector .SAT_ADD IMM form (*)
  ceb944a... Daily bump. (*)
  98914f9... [to-be-committed][RISC-V][V3] DCE analysis for extension el (*)
  113b5ce... c-format.cc: add ctors to format_check_results and format_c (*)
  2b3027b... i386: Promote {QI,HI}mode x86_movcc_0_m1_neg to SImod (*)
  40d234d... libstdc++: Fix _Atomic(T) macro in  [PR115807] (*)
  a0e64a0... Remove trailing whitespace from invoke.texi (*)
  f3f9e4e... x86: Support bitwise and/andnot/abs/neg/copysign/xorsign op (*)
  5be9703... rs6000: load high and low part of 128bit vector independent (*)
  dafd63d... RISC-V: Implement .SAT_TRUNC for vector unsigned int (*)
  7183a8c... fortran: Move definition of variable closer to its uses (*)
  682731d... [RISC-V] add implied extens

[gcc/aoliva/heads/testme] (269 commits) [i386] adjust flag_omit_frame_pointer in a single function

2024-07-10 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 ef1d9ef17840... [i386] adjust flag_omit_frame_pointer in a single function 

It previously pointed to:

 18cdf562ea2a... UI_To_gnu: cope with per-target precision limits

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  18cdf56... UI_To_gnu: cope with per-target precision limits
  f216931... Introduce general caching of sized type
  0a9b788... [dwarf] get_debug_type of TYPE_NAME to compare with qualifi
  0c598db... make_type_from_size: avoid TYPE_DEBUG_TYPE / TREE_TYPE loop
  2e886d9... Map unpacked type to packed deduped type for debug info
  cdfb1ef... make_type_from_size: fix compare for type reuse
  0803a2d... Follow only proper TYPE_DEBUG_TYPE
  d47c7fe... Avoid dropping bits from num/den in fixed-point types


Summary of changes (added commits):
---

  ef1d9ef... [i386] adjust flag_omit_frame_pointer in a single function 
  36e5e40... RISC-V: c implies zca, and conditionally zcf & zcd (*)
  f777ab3... Daily bump. (*)
  3918bea... Vect: Optimize truncation for .SAT_SUB operands (*)
  d8cd852... libstdc++: Make std::basic_format_context non-copyable [PR1 (*)
  9f75895... libstdc++: Minor optimization for std::locale::encoding() (*)
  c5efc6e... libstdc++: Use direct-initialization for std::vector' (*)
  cda469a... libstdc++: ranges::find needs explicit conversion to size_t (*)
  aae535f... i386: Swap compare operands in ustrunc patterns (*)
  f0fb6b6... c++: remove Concepts TS code (*)
  0c27ead... c: ICE with invalid sizeof [PR115642] (*)
  4c70097... c: ICE on invalid with attribute optimize [PR115549] (*)
  4865a92... testsuite: Align testcase with implementation [PR105090] (*)
  04df2a9... RISC-V: Update testsuite to use b (*)
  2a90c41... RISC-V: Add support for B standard extension (*)
  5686d3b... internal-fn: Reuse SUBREG_PROMOTED_VAR_P handling (*)
  fde96e8... c++: array new with value-initialization [PR115645] (*)
  9d20529... recog: Handle some mode-changing hardreg propagations (*)
  e08ebd7... rtl-ssa: Add replace_nondebug_insn [PR115785] (*)
  7d454ca... fixincludes: skip stdio_stdarg_h on darwin (*)
  c829042... c++, contracts: Fix ICE in create_tmp_var [PR113968] (*)
  8326956... fixincludes: add bypass to darwin_objc_runtime_1 (*)
  2d1f68e... PR modula2/115823 Wrong expansion of isnormal optab (*)
  44933fd... middle-end: Fix stalled swapped condition code value [PR115 (*)
  73f... arm: cleanup legacy ARM_PE code (*)
  23c2e6d... [PR115394] Remove streamer_debugging and it's uses. (*)
  80e446e... Match: Support form 2 for the .SAT_TRUNC (*)
  1ae5fc2... testsuite: Tests the pattern folding x/sqrt(x) to sqrt(x) f (*)
  6fce466... testsuite: Allow matching `{_1, { 0,0,0,0 }}` for vect/slp- (*)
  8f8bddb... Remove expanding complex EQ/NE inside a GIMPLE_RETURN [PR11 (*)
  7a345d0... RISC-V: fix zcmp popretz [PR113715] (*)
  0dcfef4... Daily bump. (*)
  5b46f19... Fix test errors after r15-1394 for sizeof(int)==sizeof(long (*)
  7825c07... c: Fix ICE for redeclaration of structs with different alig (*)
  592a746... c: Fix ICE for incorrect code in comptypes_verify [PR115696 (*)
  e611189... rs6000, remove vector set and vector init built-ins. (*)
  5db91b3... rs6000, remove __builtin_vsx_xvcmpeqsp_p built-in (*)
  c5b4bfe... rs6000, extend vec_xxpermdi built-in for __int128 args (*)
  ca4842f... rs6000, remove __builtin_vsx_xvnegdp and __builtin_vsx_xvne (*)
  7121926... rs6000, remove __builtin_vsx_vperm_* built-ins (*)
  52d5698... rs6000, remove the vec_xxsel built-ins, they are duplicates (*)
  807bed0... rs6000, add overloaded vec_sel with int128 arguments (*)
  8d6326e... rs6000, remove duplicated built-ins of vecmergl and vec_mer (*)
  fd9fdb3... rs6000, Remove redundant vector float/double type conversio (*)
  b620845... rs6000, extend the current vec_{un,}signed{e,o} built-ins (*)
  6031e34... rs6000, fix error in unsigned vector float to unsigned int  (*)
  224cc56... rs6000, Remove __builtin_vsx_xvcv{sp{sx,u}ws,dpuxds_uns} (*)
  7ed9a45... rs6000, Remove __builtin_vsx_cmple* builtins (*)
  d17889d... i386: Implement .SAT_TRUNC for unsigned integers (*)
  2d6e6a7... diagnostics: use refs rather than pointers for diagnostic_{ (*)
  959c168... arm: clean up some legacy FPA related cruft. (*)
  5ef0b7d... RISC-V: Fix comment/naming in attribute parsing code (*)
  85fa334... RISC-V: Deduplicate arch subset list processing (*)
  0717d50... RISC-V: testsuite: Properly gate LTO tests (*)
  298a576... i386: Correct AVX10 CPUID emulation (*)
  4f76717... c: Rewrite c_parser_omp_tile_sizes to use c_parser_expr_lis (*)
  8eab506... c++: Implement C++26 CWG2819 - Allow cv void * null pointer (*)
  23ab7f6... Rename __{float,double}_u to __x86_{float,double}_u to avoi (*)
  ecde8d5... RISC-V: Add testcases for unsigned vector .SAT_ADD IMM form (*)
  35b1096... RISC-V: Add testcases for unsigned vecto

[gcc(refs/users/aoliva/heads/testme)] [i386] adjust flag_omit_frame_pointer in a single function [PR113719]

2024-07-10 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ef1d9ef17840032c60e9757d92a55fc71ba55353

commit ef1d9ef17840032c60e9757d92a55fc71ba55353
Author: Alexandre Oliva 
Date:   Thu Jul 11 01:16:32 2024 -0300

[i386] adjust flag_omit_frame_pointer in a single function [PR113719]

The first two patches for PR113719 have each regressed
gcc.dg/ipa/iinline-attr.c on a different target.  The reason for this
instability is that there are competing flag_omit_frame_pointer
overriders on x86:

- ix86_recompute_optlev_based_flags computes and sets a
  -f[no-]omit-frame-pointer default depending on
  USE_IX86_FRAME_POINTER and, in 32-bit mode, optimize_size

- ix86_option_override_internal enables flag_omit_frame_pointer for
  -momit-leaf-frame-pointer to take effect

ix86_option_override[_internal] calls
ix86_recompute_optlev_based_flags before setting
flag_omit_frame_pointer.  It is called during global process_options.

But ix86_recompute_optlev_based_flags is also called by
parse_optimize_options, during attribute processing, and at that
point, ix86_option_override is not called, so the final overrider for
global options is not applied to the optimize attributes.  If they
differ, the testcase fails.

In order to fix this, we need to process all overriders of this option
whenever we process any of them.  Since this setting is affected by
optimization options, it makes sense to compute it in
parse_optimize_options, rather than in process_options.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc (ix86_option_override_internal):
Move flag_omit_frame_pointer final overrider...
(ix86_recompute_optlev_based_flags): ... here.

Diff:
---
 gcc/config/i386/i386-options.cc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 5824c0cb072e..059ef3ae6ad4 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1911,6 +1911,12 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
}
 }
+
+  /* Keep nonleaf frame pointers.  */
+  if (opts->x_flag_omit_frame_pointer)
+opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
+  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
+opts->x_flag_omit_frame_pointer = 1;
 }
 
 /* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
@@ -2590,12 +2596,6 @@ ix86_option_override_internal (bool main_args_p,
 opts->x_target_flags |= MASK_NO_RED_ZONE;
 }
 
-  /* Keep nonleaf frame pointers.  */
-  if (opts->x_flag_omit_frame_pointer)
-opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
-  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
-opts->x_flag_omit_frame_pointer = 1;
-
   /* If we're doing fast math, we don't care about comparison order
  wrt NaNs.  This lets us use a shorter comparison sequence.  */
   if (opts->x_flag_finite_math_only)


[gcc(refs/users/aoliva/heads/testme)] [libstdc++] [testsuite] xfail 128bit from_chars on all aarch64-*-*

2024-07-11 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:e7140d9f2a6451f8101e516b95a46261f7494c56

commit e7140d9f2a6451f8101e516b95a46261f7494c56
Author: Alexandre Oliva 
Date:   Thu Jul 11 09:03:27 2024 -0300

[libstdc++] [testsuite] xfail 128bit from_chars on all aarch64-*-*

Having observed failures of these two tests on yet another aarch64
operating system, and having concluded that the conditions that
trigger the problem ought to be present on all aarch64 targets, I'm
now matching any aarch64 target_os to enable the workaround.


for  libstdc++-v3/ChangeLog

* testsuite/20_util/from_chars/8.cc: Define SKIP_LONG_DOUBLE
on all aarch64-*-* targets.
* testsuite/20_util/to_chars/float128_c++23.cc: Xfail on all
aarch64-*-* targets.

Diff:
---
 libstdc++-v3/testsuite/20_util/from_chars/8.cc| 2 +-
 libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/20_util/from_chars/8.cc 
b/libstdc++-v3/testsuite/20_util/from_chars/8.cc
index bacad89943b5..e92b64349025 100644
--- a/libstdc++-v3/testsuite/20_util/from_chars/8.cc
+++ b/libstdc++-v3/testsuite/20_util/from_chars/8.cc
@@ -17,7 +17,7 @@
 
 // { dg-do run { target c++23 } }
 // { dg-add-options ieee }
-// { dg-additional-options "-DSKIP_LONG_DOUBLE" { target aarch64-*-vxworks* 
aarch64-*-rtems* } }
+// { dg-additional-options "-DSKIP_LONG_DOUBLE" { target aarch64-*-* } }
 
 #include 
 #include 
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc 
b/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc
index 6cb9cadcd204..840131c1e569 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/float128_c++23.cc
@@ -19,7 +19,7 @@
 // { dg-require-effective-target ieee_floats }
 // { dg-require-effective-target size32plus }
 // { dg-add-options ieee }
-// { dg-xfail-run-if "from_chars limited to double-precision" { 
aarch64-*-vxworks* aarch64-*-rtems* } }
+// { dg-xfail-run-if "from_chars limited to double-precision" { aarch64-*-* } }
 
 #include 
 #include 


[gcc(refs/users/aoliva/heads/testme)] [libstdc++] [testsuite] require dfprt on some tests

2024-07-11 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:35b8b9ad5a3db3089074fc7c9cd7b91b9fd5cedf

commit 35b8b9ad5a3db3089074fc7c9cd7b91b9fd5cedf
Author: Alexandre Oliva 
Date:   Thu Jul 11 09:04:02 2024 -0300

[libstdc++] [testsuite] require dfprt on some tests

On a target that doesn't enable decimal float components in libgcc
(because the libc doens't define all required FE_* macros), but whose
compiler supports _Decimal* types, the effective target requirement
dfp passes, but several tests won't link because the runtime support
they depend on is missing.  State their dfprt requirement.


for  libstdc++-v3/ChangeLog

* testsuite/decimal/binary-arith.cc: Require dfprt.
* testsuite/decimal/comparison.cc: Likewise.
* testsuite/decimal/compound-assignment-memfunc.cc: Likewise.
* testsuite/decimal/make-decimal.cc: Likewise.
* testsuite/decimal/pr54036-1.cc: Likewise.
* testsuite/decimal/pr54036-2.cc: Likewise.
* testsuite/decimal/pr54036-3.cc: Likewise.
* testsuite/decimal/unary-arith.cc: Likewise.

Diff:
---
 libstdc++-v3/testsuite/decimal/binary-arith.cc| 2 +-
 libstdc++-v3/testsuite/decimal/comparison.cc  | 2 +-
 libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc | 2 +-
 libstdc++-v3/testsuite/decimal/compound-assignment.cc | 2 +-
 libstdc++-v3/testsuite/decimal/make-decimal.cc| 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-1.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-2.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-3.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/unary-arith.cc | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/testsuite/decimal/binary-arith.cc 
b/libstdc++-v3/testsuite/decimal/binary-arith.cc
index c10a8b6466cb..3eeed7ea9750 100644
--- a/libstdc++-v3/testsuite/decimal/binary-arith.cc
+++ b/libstdc++-v3/testsuite/decimal/binary-arith.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.8  Binary arithmetic operators.
 
diff --git a/libstdc++-v3/testsuite/decimal/comparison.cc 
b/libstdc++-v3/testsuite/decimal/comparison.cc
index cf34c8d74bad..424dd8bd2665 100644
--- a/libstdc++-v3/testsuite/decimal/comparison.cc
+++ b/libstdc++-v3/testsuite/decimal/comparison.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.9  Comparison operators.
 
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc 
b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
index 817d4bb10b1e..d520af9a68d4 100644
--- a/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.2.6  Compound assignment (decimal32).
 // ISO/IEC TR 24733  3.2.3.6  Compound assignment (decimal64).
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment.cc 
b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
index 2d3e32585698..5aa87e78a739 100644
--- a/libstdc++-v3/testsuite/decimal/compound-assignment.cc
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.2.6  Compound assignment (decimal32).
 // ISO/IEC TR 24733  3.2.3.6  Compound assignment (decimal64).
diff --git a/libstdc++-v3/testsuite/decimal/make-decimal.cc 
b/libstdc++-v3/testsuite/decimal/make-decimal.cc
index aa75ac89d479..560196cb305e 100644
--- a/libstdc++-v3/testsuite/decimal/make-decimal.cc
+++ b/libstdc++-v3/testsuite/decimal/make-decimal.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 // { dg-options "-Wno-pedantic" }
 
 // ISO/IEC TR 24733  3.2.5  Initialization from coefficient and exponent.
diff --git a/libstdc++-v3/testsuite/decimal/pr54036-1.cc 
b/libstdc++-v3/testsuite/decimal/pr54036-1.cc
index 508738701ca0..a07e4c351651 100644
--- a/libstdc++-v3/testsuite/decimal/pr54036-1.cc
+++ b/libstdc++-v3/testsuite/decimal/pr54036-1.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-/

[gcc(refs/users/aoliva/heads/testme)] [analyzer] [testsuite] avoid unexpected null dereference warning

2024-07-11 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:3b1df514951940298acd6b602f629027066af1c0

commit 3b1df514951940298acd6b602f629027066af1c0
Author: Alexandre Oliva 
Date:   Thu Jul 11 09:04:38 2024 -0300

[analyzer] [testsuite] avoid unexpected null dereference warning

The analyzer testsuite, on a customer's own operating system, reports
a potential NULL pointer dereference in flex-without-call-summaries.c.
I'm not sure why it shows up on that system, but not on others, but
the test is not meant to test for that warning, so I'm silencing it.


for  gcc/testsuite/ChangeLog

* c-c++-common/analyzer/flex-without-call-summaries.c: Disable
null dereference analyzer warnings.

Diff:
---
 gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c 
b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
index c6ecb25d25d5..1aad2bc896b7 100644
--- a/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
+++ b/gcc/testsuite/c-c++-common/analyzer/flex-without-call-summaries.c
@@ -3,6 +3,7 @@
 
 /* { dg-additional-options "-fno-analyzer-call-summaries" } */
 
+/* { dg-additional-options "-Wno-analyzer-null-dereference" } */
 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
 /* { dg-additional-options "-D_POSIX_SOURCE" } */


[gcc(refs/users/aoliva/heads/testme)] [libstdc++] [testsuite] avoid arbitrary errno codes

2024-07-11 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:2f1f926425b4e3cd5e7e48b86e03bb3613b5aa54

commit 2f1f926425b4e3cd5e7e48b86e03bb3613b5aa54
Author: Alexandre Oliva 
Date:   Thu Jul 11 09:04:11 2024 -0300

[libstdc++] [testsuite] avoid arbitrary errno codes

Passing an arbitrary error number to strerror* functions doesn't seem
to be portable; 19_diagnostics/system_error/cons-1.cc is hitting
runtime errors in the block that attempts to instantiate a
std:;system_error for error number 95.  The range of errno macros
defined on this target doesn't reach 95.

I'm changing the test to try to use a couple of select error codes,
falling back to a lower error number if neither are present.
Hopefully this doesn't change the nature of what is being tested for.


for  libstdc++-v3/ChangeLog

* testsuite/19_diagnostics/system_error/cons-1.cc: Use lower
error numbers, preferring some macro-defined ones.

Diff:
---
 .../testsuite/19_diagnostics/system_error/cons-1.cc| 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc 
b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
index 16aa960b2ee2..e227c6754241 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
@@ -37,8 +37,18 @@ int main()
 
   // 2
   {
-std::system_error err2(95, std::system_category(), s);
-VERIFY( err2.code() == std::error_code(95, std::system_category()) );
+int eno;
+#if defined EOPNOTSUPP
+eno = EOPNOTSUPP;
+#elif defined ENOSYS
+eno = ENOSYS;
+#else
+// strerror (used to combine with the given message) may fail if
+// the error number is out of range for the system.
+eno = 42;
+#endif
+std::system_error err2(eno, std::system_category(), s);
+VERIFY( err2.code() == std::error_code(eno, std::system_category()) );
 VERIFY( std::string((err2.what(), s)).find(s) != std::string::npos );
   }


[gcc r15-1996] [alpha] adjust MEM alignment for block move [PR115459]

2024-07-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:ccfe7151803956d178947d0afda0bd66ce097275

commit r15-1996-gccfe7151803956d178947d0afda0bd66ce097275
Author: Alexandre Oliva 
Date:   Fri Jul 12 05:42:07 2024 -0300

[alpha] adjust MEM alignment for block move [PR115459]

Before issuing loads or stores for a block move, adjust the MEM
alignments if analysis of the addresses enabled the inference of
stricter alignment.  This ensures that the MEMs are sufficiently
aligned for the corresponding insns, which avoids trouble in case of
e.g. substitutions into SUBREGs.


for  gcc/ChangeLog

PR target/115459
* config/alpha/alpha.cc (alpha_expand_block_move): Adjust
MEMs to match inferred alignment.

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

diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index a6fe95e71778..74631a416935 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -3820,6 +3820,12 @@ alpha_expand_block_move (rtx operands[])
   else if (a >= 16 && c % 2 == 0)
src_align = 16;
}
+
+  if (MEM_P (orig_src) && MEM_ALIGN (orig_src) < src_align)
+   {
+ orig_src = shallow_copy_rtx (orig_src);
+ set_mem_align (orig_src, src_align);
+   }
 }
 
   tmp = XEXP (orig_dst, 0);
@@ -3841,6 +3847,12 @@ alpha_expand_block_move (rtx operands[])
   else if (a >= 16 && c % 2 == 0)
dst_align = 16;
}
+
+  if (MEM_P (orig_dst) && MEM_ALIGN (orig_dst) < dst_align)
+   {
+ orig_dst = shallow_copy_rtx (orig_dst);
+ set_mem_align (orig_dst, dst_align);
+   }
 }
 
   ofs = 0;


[gcc r15-1997] [libstdc++] [testsuite] require dfprt on some tests

2024-07-12 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:26dfb3f2d30f6d49ed126add9d123dcc6566385f

commit r15-1997-g26dfb3f2d30f6d49ed126add9d123dcc6566385f
Author: Alexandre Oliva 
Date:   Fri Jul 12 05:42:19 2024 -0300

[libstdc++] [testsuite] require dfprt on some tests

On a target that doesn't enable decimal float components in libgcc
(because the libc doens't define all required FE_* macros), but whose
compiler supports _Decimal* types, the effective target requirement
dfp passes, but several tests won't link because the runtime support
they depend on is missing.  State their dfprt requirement.


for  libstdc++-v3/ChangeLog

* testsuite/decimal/binary-arith.cc: Require dfprt.
* testsuite/decimal/comparison.cc: Likewise.
* testsuite/decimal/compound-assignment.cc: Likewise.
* testsuite/decimal/compound-assignment-memfunc.cc: Likewise.
* testsuite/decimal/make-decimal.cc: Likewise.
* testsuite/decimal/pr54036-1.cc: Likewise.
* testsuite/decimal/pr54036-2.cc: Likewise.
* testsuite/decimal/pr54036-3.cc: Likewise.
* testsuite/decimal/unary-arith.cc: Likewise.

Diff:
---
 libstdc++-v3/testsuite/decimal/binary-arith.cc| 2 +-
 libstdc++-v3/testsuite/decimal/comparison.cc  | 2 +-
 libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc | 2 +-
 libstdc++-v3/testsuite/decimal/compound-assignment.cc | 2 +-
 libstdc++-v3/testsuite/decimal/make-decimal.cc| 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-1.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-2.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/pr54036-3.cc   | 2 +-
 libstdc++-v3/testsuite/decimal/unary-arith.cc | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libstdc++-v3/testsuite/decimal/binary-arith.cc 
b/libstdc++-v3/testsuite/decimal/binary-arith.cc
index c10a8b6466cb..3eeed7ea9750 100644
--- a/libstdc++-v3/testsuite/decimal/binary-arith.cc
+++ b/libstdc++-v3/testsuite/decimal/binary-arith.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.8  Binary arithmetic operators.
 
diff --git a/libstdc++-v3/testsuite/decimal/comparison.cc 
b/libstdc++-v3/testsuite/decimal/comparison.cc
index cf34c8d74bad..424dd8bd2665 100644
--- a/libstdc++-v3/testsuite/decimal/comparison.cc
+++ b/libstdc++-v3/testsuite/decimal/comparison.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.9  Comparison operators.
 
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc 
b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
index 817d4bb10b1e..d520af9a68d4 100644
--- a/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.2.6  Compound assignment (decimal32).
 // ISO/IEC TR 24733  3.2.3.6  Compound assignment (decimal64).
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment.cc 
b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
index 2d3e32585698..5aa87e78a739 100644
--- a/libstdc++-v3/testsuite/decimal/compound-assignment.cc
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 
 // ISO/IEC TR 24733  3.2.2.6  Compound assignment (decimal32).
 // ISO/IEC TR 24733  3.2.3.6  Compound assignment (decimal64).
diff --git a/libstdc++-v3/testsuite/decimal/make-decimal.cc 
b/libstdc++-v3/testsuite/decimal/make-decimal.cc
index aa75ac89d479..560196cb305e 100644
--- a/libstdc++-v3/testsuite/decimal/make-decimal.cc
+++ b/libstdc++-v3/testsuite/decimal/make-decimal.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // .
 
-// { dg-require-effective-target dfp }
+// { dg-require-effective-target dfprt }
 // { dg-options "-Wno-pedantic" }
 
 // ISO/IEC TR 24733  3.2.5  Initialization from coefficient and exponent.
diff --git a/libstdc++-v3/testsuite/decimal/pr54036-1.cc 
b/libstdc++-v3/testsuite/decimal/pr54036-1.cc
index 508738701ca0..a07e4c351651 100644
--- a/libstdc++-v3/testsuite/decimal/pr54036-1.cc
+++ b/libstdc++-v3/testsuite/decimal/pr54036-1.cc
@@ -15,7 +15,7 @@
 // with this library;

[gcc r15-2042] [i386] adjust flag_omit_frame_pointer in a single function [PR113719]

2024-07-15 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:bf8e80f9d164f8778d86a3dc50e501cf19a9eff1

commit r15-2042-gbf8e80f9d164f8778d86a3dc50e501cf19a9eff1
Author: Alexandre Oliva 
Date:   Mon Jul 15 14:00:36 2024 -0300

[i386] adjust flag_omit_frame_pointer in a single function [PR113719]

The first two patches for PR113719 have each regressed
gcc.dg/ipa/iinline-attr.c on a different target.  The reason for this
instability is that there are competing flag_omit_frame_pointer
overriders on x86:

- ix86_recompute_optlev_based_flags computes and sets a
  -f[no-]omit-frame-pointer default depending on
  USE_IX86_FRAME_POINTER and, in 32-bit mode, optimize_size

- ix86_option_override_internal enables flag_omit_frame_pointer for
  -momit-leaf-frame-pointer to take effect

ix86_option_override[_internal] calls
ix86_recompute_optlev_based_flags before setting
flag_omit_frame_pointer.  It is called during global process_options.

But ix86_recompute_optlev_based_flags is also called by
parse_optimize_options, during attribute processing, and at that
point, ix86_option_override is not called, so the final overrider for
global options is not applied to the optimize attributes.  If they
differ, the testcase fails.

In order to fix this, we need to process all overriders of this option
whenever we process any of them.  Since this setting is affected by
optimization options, it makes sense to compute it in
parse_optimize_options, rather than in process_options.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc (ix86_option_override_internal):
Move flag_omit_frame_pointer final overrider...
(ix86_recompute_optlev_based_flags): ... here.

Diff:
---
 gcc/config/i386/i386-options.cc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 5824c0cb072e..059ef3ae6ad4 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1911,6 +1911,12 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
}
 }
+
+  /* Keep nonleaf frame pointers.  */
+  if (opts->x_flag_omit_frame_pointer)
+opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
+  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
+opts->x_flag_omit_frame_pointer = 1;
 }
 
 /* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
@@ -2590,12 +2596,6 @@ ix86_option_override_internal (bool main_args_p,
 opts->x_target_flags |= MASK_NO_RED_ZONE;
 }
 
-  /* Keep nonleaf frame pointers.  */
-  if (opts->x_flag_omit_frame_pointer)
-opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
-  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
-opts->x_flag_omit_frame_pointer = 1;
-
   /* If we're doing fast math, we don't care about comparison order
  wrt NaNs.  This lets us use a shorter comparison sequence.  */
   if (opts->x_flag_finite_math_only)


[gcc/aoliva/heads/testme] (82 commits) [strub] adjust all at-calls type variants at once

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testme' was updated to point to:

 529d91ce3711... [strub] adjust all at-calls type variants at once

It previously pointed to:

 3b1df5149519... [analyzer] [testsuite] avoid unexpected null dereference wa

Diff:

!!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):
---

  3b1df51... [analyzer] [testsuite] avoid unexpected null dereference wa
  2f1f926... [libstdc++] [testsuite] avoid arbitrary errno codes
  35b8b9a... [libstdc++] [testsuite] require dfprt on some tests
  e7140d9... [libstdc++] [testsuite] xfail 128bit from_chars on all aarc
  ef1d9ef... [i386] adjust flag_omit_frame_pointer in a single function 


Summary of changes (added commits):
---

  529d91c... [strub] adjust all at-calls type variants at once
  bf8e80f... [i386] adjust flag_omit_frame_pointer in a single function  (*)
  4306f76... RISC-V: Fix testcase for vector .SAT_SUB in zip benchmark (*)
  8f87b3c... AVR: avr-md - Simplify GET_MODE and GET_MODE_BITSIZE. (*)
  9964edf... varasm: Add support for emitting binary data with the new g (*)
  f27bf48... Fix SSA_NAME leak due to def_stmt is removed before use_stm (*)
  681ff5c... [APX NF] Add a pass to convert legacy insn to NF insns (*)
  60ba989... arm: Fix the expected output of the test pr111235.c  [PR115 (*)
  bf26413... RISC-V: Implement locality for __builtin_prefetch (*)
  8b14920... aarch64: Fix the expected output of the test cpy_1.c [PR115 (*)
  da37a27... CRIS: Adjust gcc.dg/tree-ssa/loop-1.c (*)
  9f52163... RISC-V: Add md files for vector BFloat16 (*)
  281f021... RISC-V: Add Zvfbfmin and Zvfbfwma intrinsic (*)
  02a3bf5... AVX512BF16: Do not allow permutation with vcvtne2ps2bf16 [P (*)
  666f167... RISC-V: Add vector type of BFloat16 format (*)
  8ccfa57... Daily bump. (*)
  74e6dfb... i386: Tweak i386-expand.cc to restore bootstrap on RHEL. (*)
  44c9403... c, objc: Add -Wunterminated-string-initialization (*)
  74595c7... CRIS: Fix up last comment. (*)
  a01b40c... CRIS: Disable late-combine by default, related PR115883 (*)
  944e425... Daily bump. (*)
  677ef11... Document return value in write_cv_integer (*)
  800e06c... Make sure CodeView symbols are aligned (*)
  45a4f34... Avoid magic numbers when writing CodeView padding (*)
  f53087a... Add CodeView enum cv_sym_type (*)
  131fcb5... Add CodeView enum cv_leaf_type (*)
  d211100... fortran: Correctly evaluate scalar MASK arguments of MINLOC (*)
  6fc24a0... Add gcc.gnu.org account names to MAINTAINERS (*)
  7d73c01... diagnostics: add highlight-a vs highlight-b in colorization (*)
  abf3964... tree-optimization/115868 - ICE with .MASK_CALL in simdclone (*)
  2ee5b58... Daily bump. (*)
  dd2840a... doc: Update GNU Modula 2 mailing list links (*)
  a6f551d... [PR rtl-optimization/115876] Fix one of two ubsan reported  (*)
  b3d4a02... doc: remove @opindex for fconcepts-ts (*)
  08776be... Fix Xcode 16 build break with NULL != nullptr (*)
  6e7053a... rtl-ssa: Fix prev_any_insn [PR115785] (*)
  f4047a8... modula2: bootstrap fix for string and vector headers. (*)
  ae829a2... [RISC-V] Avoid unnecessary sign extension after memcmp (*)
  13757e5... c++/modules: Add testcase for fixed issue with usings [PR11 (*)
  1f7a21c... c++/modules: Handle redefinitions of using-decls (*)
  d6bf4b1... c++: Introduce USING_DECLs for non-function usings [PR11468 (*)
  61715e9... s390: Fully exploit vgm, vgbm, vrepi (*)
  e6680d3... s390: Fix output template for movv1qi (*)
  6b5d263... i386: Some AVX512 ternlog expansion refinements. (*)
  56de68a... s390: Align *cjump_64 and *icjump_64 (*)
  7bcef75... aarch64: Avoid alloca in target attribute parsing (*)
  26dfb3f... [libstdc++] [testsuite] require dfprt on some tests (*)
  ccfe715... [alpha] adjust MEM alignment for block move [PR115459] (*)
  c6f38e5... RISC-V: NO_WARNING preferred else value for RVV (*)
  a55d24b... fortran: Factor the evaluation of MINLOC/MAXLOC's BACK argu (*)
  63d7d59... RISC-V: Disable misaligned vector access in hook riscv_slow (*)
  3ea47ea... RISC-V: Add SiFive extensions, xsfvcp and xsfcease (*)
  f7e4000... rs6000: Remove vcond{,u} expanders (*)
  4f4478f... tree-optimization/115867 - ICE with simdcall vectorization  (*)
  a91c51c... [committed] Fix m68k bootstrap segfault with late-combine (*)
  bf406a5... libbacktrace: avoid infinite recursion (*)
  3bc1a86... LoongArch: Remove unreachable codes. (*)
  abeb6c8... LoongArch: TFmode is not allowed to be stored in the float  (*)
  d7318f4... libbacktrace: don't fail if symbol size is unknown (*)
  b870086... libbacktrace: correctly gather Mach-O symbol table (*)
  88ff050... Daily bump. (*)
  8f7c06d... libbacktrace: fix testsuite for clang (*)
  43763bd... libstdc++: Test that std::atomic_ref uses the primary (*)
  79d3f17... libstdc++: the specialization atomic_ref should use t (*)
  b96789a... libbacktrace: suggest how to fix missing debug info (*)
  02f7525... libback

[gcc/aoliva/heads/testbase] (81 commits) [i386] adjust flag_omit_frame_pointer in a single function

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
The branch 'aoliva/heads/testbase' was updated to point to:

 bf8e80f9d164... [i386] adjust flag_omit_frame_pointer in a single function 

It previously pointed to:

 36e5e409190e... RISC-V: c implies zca, and conditionally zcf & zcd

Diff:

Summary of changes (added commits):
---

  bf8e80f... [i386] adjust flag_omit_frame_pointer in a single function  (*)
  4306f76... RISC-V: Fix testcase for vector .SAT_SUB in zip benchmark (*)
  8f87b3c... AVR: avr-md - Simplify GET_MODE and GET_MODE_BITSIZE. (*)
  9964edf... varasm: Add support for emitting binary data with the new g (*)
  f27bf48... Fix SSA_NAME leak due to def_stmt is removed before use_stm (*)
  681ff5c... [APX NF] Add a pass to convert legacy insn to NF insns (*)
  60ba989... arm: Fix the expected output of the test pr111235.c  [PR115 (*)
  bf26413... RISC-V: Implement locality for __builtin_prefetch (*)
  8b14920... aarch64: Fix the expected output of the test cpy_1.c [PR115 (*)
  da37a27... CRIS: Adjust gcc.dg/tree-ssa/loop-1.c (*)
  9f52163... RISC-V: Add md files for vector BFloat16 (*)
  281f021... RISC-V: Add Zvfbfmin and Zvfbfwma intrinsic (*)
  02a3bf5... AVX512BF16: Do not allow permutation with vcvtne2ps2bf16 [P (*)
  666f167... RISC-V: Add vector type of BFloat16 format (*)
  8ccfa57... Daily bump. (*)
  74e6dfb... i386: Tweak i386-expand.cc to restore bootstrap on RHEL. (*)
  44c9403... c, objc: Add -Wunterminated-string-initialization (*)
  74595c7... CRIS: Fix up last comment. (*)
  a01b40c... CRIS: Disable late-combine by default, related PR115883 (*)
  944e425... Daily bump. (*)
  677ef11... Document return value in write_cv_integer (*)
  800e06c... Make sure CodeView symbols are aligned (*)
  45a4f34... Avoid magic numbers when writing CodeView padding (*)
  f53087a... Add CodeView enum cv_sym_type (*)
  131fcb5... Add CodeView enum cv_leaf_type (*)
  d211100... fortran: Correctly evaluate scalar MASK arguments of MINLOC (*)
  6fc24a0... Add gcc.gnu.org account names to MAINTAINERS (*)
  7d73c01... diagnostics: add highlight-a vs highlight-b in colorization (*)
  abf3964... tree-optimization/115868 - ICE with .MASK_CALL in simdclone (*)
  2ee5b58... Daily bump. (*)
  dd2840a... doc: Update GNU Modula 2 mailing list links (*)
  a6f551d... [PR rtl-optimization/115876] Fix one of two ubsan reported  (*)
  b3d4a02... doc: remove @opindex for fconcepts-ts (*)
  08776be... Fix Xcode 16 build break with NULL != nullptr (*)
  6e7053a... rtl-ssa: Fix prev_any_insn [PR115785] (*)
  f4047a8... modula2: bootstrap fix for string and vector headers. (*)
  ae829a2... [RISC-V] Avoid unnecessary sign extension after memcmp (*)
  13757e5... c++/modules: Add testcase for fixed issue with usings [PR11 (*)
  1f7a21c... c++/modules: Handle redefinitions of using-decls (*)
  d6bf4b1... c++: Introduce USING_DECLs for non-function usings [PR11468 (*)
  61715e9... s390: Fully exploit vgm, vgbm, vrepi (*)
  e6680d3... s390: Fix output template for movv1qi (*)
  6b5d263... i386: Some AVX512 ternlog expansion refinements. (*)
  56de68a... s390: Align *cjump_64 and *icjump_64 (*)
  7bcef75... aarch64: Avoid alloca in target attribute parsing (*)
  26dfb3f... [libstdc++] [testsuite] require dfprt on some tests (*)
  ccfe715... [alpha] adjust MEM alignment for block move [PR115459] (*)
  c6f38e5... RISC-V: NO_WARNING preferred else value for RVV (*)
  a55d24b... fortran: Factor the evaluation of MINLOC/MAXLOC's BACK argu (*)
  63d7d59... RISC-V: Disable misaligned vector access in hook riscv_slow (*)
  3ea47ea... RISC-V: Add SiFive extensions, xsfvcp and xsfcease (*)
  f7e4000... rs6000: Remove vcond{,u} expanders (*)
  4f4478f... tree-optimization/115867 - ICE with simdcall vectorization  (*)
  a91c51c... [committed] Fix m68k bootstrap segfault with late-combine (*)
  bf406a5... libbacktrace: avoid infinite recursion (*)
  3bc1a86... LoongArch: Remove unreachable codes. (*)
  abeb6c8... LoongArch: TFmode is not allowed to be stored in the float  (*)
  d7318f4... libbacktrace: don't fail if symbol size is unknown (*)
  b870086... libbacktrace: correctly gather Mach-O symbol table (*)
  88ff050... Daily bump. (*)
  8f7c06d... libbacktrace: fix testsuite for clang (*)
  43763bd... libstdc++: Test that std::atomic_ref uses the primary (*)
  79d3f17... libstdc++: the specialization atomic_ref should use t (*)
  b96789a... libbacktrace: suggest how to fix missing debug info (*)
  02f7525... libbacktrace: remove trailing whitespace (*)
  26c9b09... libstdc++: Switch gcc.gnu.org links to https (*)
  74d8acc... [to-be-committed,RISC-V] Eliminate unnecessary sign extensi (*)
  4e0aa05... Ranger: Mark a few classes as final (*)
  8dbc02b... libstdc++: Disable expensive test for debug mode [PR108636] (*)
  7c11fdd... mve: Fix vsetq_lane for 64-bit elements with lane 1 [PR 115 (*)
  44fc801... recog: Avoid validate_change shortcut for groups [PR115782] (*)
  b9513c6... Fix bootstrap broken by gcc-15-1965-ge4f2f46e015 (*)
  7387117... Fix gimp

[gcc(refs/users/aoliva/heads/testme)] [strub] adjust all at-calls type variants at once

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:529d91ce3711739c56a502cdf7d6b7b657776c3d

commit 529d91ce3711739c56a502cdf7d6b7b657776c3d
Author: Alexandre Oliva 
Date:   Tue Jul 16 05:33:07 2024 -0300

[strub] adjust all at-calls type variants at once

TYPE_ARG_TYPES of type variants must compare equal, according to
verify_type, but adjust_at_calls_type didn't preserve this invariant.

Adjust the main type variant and propagate TYPE_ARG_TYPES to all
variants.  While at that, also adjust the canonical type and its
variants, and then verify_type.


for  gcc/ChangeLog

PR c/115848
* ipa-strub.cc (pass_ipa_strub::adjust_at_calls_type_main):
Rename from...
(pass_ipa_strub::adjust_at_calls_type): ... this.  Preserve
TYPE_ARG_TYPES across all variants.  Adjust TYPE_CANONICAL and
verify_type.

for  gcc/testsuite/ChangeLog

PR c/115848
* c-c++-common/strub-pr115848.c: New.

Diff:
---
 gcc/ipa-strub.cc| 41 +++--
 gcc/testsuite/c-c++-common/strub-pr115848.c |  6 +
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 8fa7bdf53002..15d91c994bf8 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -1891,6 +1891,7 @@ public:
 
 #undef DEF_IDENT
 
+  static inline int adjust_at_calls_type_main (tree);
   static inline int adjust_at_calls_type (tree);
   static inline void adjust_at_calls_call (cgraph_edge *, int, tree);
   static inline void adjust_at_calls_calls (cgraph_node *);
@@ -2348,15 +2349,51 @@ strub_watermark_parm (tree fndecl)
   gcc_unreachable ();
 }
 
+/* Adjust a STRUB_AT_CALLS function TYPE and all its variants,
+   preserving TYPE_ARG_TYPES identity, adding a watermark pointer if
+   it hasn't been added yet.  Return the named argument count.  */
+
+int
+pass_ipa_strub::adjust_at_calls_type (tree type)
+{
+  gcc_checking_assert (same_strub_mode_in_variants_p (type));
+
+  tree tmain = TYPE_MAIN_VARIANT (type);
+  tree orig_types = TYPE_ARG_TYPES (tmain);
+  gcc_checking_assert (TYPE_ARG_TYPES (type) == orig_types);
+  int named_args = adjust_at_calls_type_main (tmain);
+  tree mod_types = TYPE_ARG_TYPES (tmain);
+
+  if (mod_types != orig_types)
+for (tree other = TYPE_NEXT_VARIANT (tmain);
+other != NULL_TREE; other = TYPE_NEXT_VARIANT (other))
+  {
+   gcc_checking_assert (TYPE_ARG_TYPES (other) == orig_types);
+   TYPE_ARG_TYPES (other) = mod_types;
+  }
+
+  if (TYPE_CANONICAL (type)
+  && TYPE_MAIN_VARIANT (TYPE_CANONICAL (type)) != tmain)
+{
+  int ret = adjust_at_calls_type (TYPE_CANONICAL (type));
+  gcc_checking_assert (named_args == ret);
+}
+
+  if (flag_checking)
+verify_type (type);
+
+  return named_args;
+}
+
 /* Adjust a STRUB_AT_CALLS function TYPE, adding a watermark pointer if it
hasn't been added yet.  Return the named argument count.  */
 
 int
-pass_ipa_strub::adjust_at_calls_type (tree type)
+pass_ipa_strub::adjust_at_calls_type_main (tree type)
 {
   int named_args = 0;
 
-  gcc_checking_assert (same_strub_mode_in_variants_p (type));
+  gcc_checking_assert (TYPE_MAIN_VARIANT (type) == type);
 
   if (!TYPE_ARG_TYPES (type))
 return named_args;
diff --git a/gcc/testsuite/c-c++-common/strub-pr115848.c 
b/gcc/testsuite/c-c++-common/strub-pr115848.c
new file mode 100644
index ..658dbaafe01d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-pr115848.c
@@ -0,0 +1,6 @@
+/* { dg-do link } */
+/* { dg-options "-flto" } */
+
+typedef void __attribute__((__strub__)) a(int, int);
+a(b);
+void c() { b(0, 0); }


[gcc r14-10426] [i386] restore recompute to override opts after change [PR113719]

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:102bcf147892855463c5854119aacda752ed033c

commit r14-10426-g102bcf147892855463c5854119aacda752ed033c
Author: Alexandre Oliva 
Date:   Tue Jul 16 06:27:06 2024 -0300

[i386] restore recompute to override opts after change [PR113719]

The first patch for PR113719 regressed gcc.dg/ipa/iinline-attr.c on
toolchains configured to --enable-frame-pointer, because the
optimization node created within handle_optimize_attribute had
flag_omit_frame_pointer incorrectly set, whereas
default_optimization_node didn't.  With this difference,
can_inline_edge_by_limits_p flagged an optimization mismatch and we
refused to inline the function that had a redundant optimization flag
into one that didn't, which is exactly what is tested for there.

This patch restores the calls to ix86_default_align and
ix86_recompute_optlev_based_flags that used to be, and ought to be,
issued during TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE, but preserves the
intent of the original change, of having those functions called at
different spots within ix86_option_override_internal.  To that end,
the remaining bits were refactored into a separate function, that was
in turn adjusted to operate on explicitly-passed opts and opts_set,
rather than going for their global counterparts.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc
(ix86_override_options_after_change_1): Add opts and opts_set
parms, operate on them, after factoring out of...
(ix86_override_options_after_change): ... this.  Restore calls
of ix86_default_align and ix86_recompute_optlev_based_flags.
(ix86_option_override_internal): Call the factored-out bits.

(cherry picked from commit bf2fc0a27b35de039c3d45e6d7ea9ad0a8a305ba)

Diff:
---
 gcc/config/i386/i386-options.cc | 59 -
 1 file changed, 40 insertions(+), 19 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index d97464f2c74b..6e8fcbdaa28a 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1925,37 +1925,58 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
 }
 }
 
-/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+/* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
 
-void
-ix86_override_options_after_change (void)
+static void
+ix86_override_options_after_change_1 (struct gcc_options *opts,
+ struct gcc_options *opts_set)
 {
+#define OPTS_SET_P(OPTION) opts_set->x_ ## OPTION
+#define OPTS(OPTION) opts->x_ ## OPTION
+
   /* Disable unrolling small loops when there's explicit
  -f{,no}unroll-loop.  */
-  if ((OPTION_SET_P (flag_unroll_loops))
- || (OPTION_SET_P (flag_unroll_all_loops)
-&& flag_unroll_all_loops))
+  if ((OPTS_SET_P (flag_unroll_loops))
+ || (OPTS_SET_P (flag_unroll_all_loops)
+&& OPTS (flag_unroll_all_loops)))
 {
-  if (!OPTION_SET_P (ix86_unroll_only_small_loops))
-   ix86_unroll_only_small_loops = 0;
+  if (!OPTS_SET_P (ix86_unroll_only_small_loops))
+   OPTS (ix86_unroll_only_small_loops) = 0;
   /* Re-enable -frename-registers and -fweb if funroll-loops
 enabled.  */
-  if (!OPTION_SET_P (flag_web))
-   flag_web = flag_unroll_loops;
-  if (!OPTION_SET_P (flag_rename_registers))
-   flag_rename_registers = flag_unroll_loops;
+  if (!OPTS_SET_P (flag_web))
+   OPTS (flag_web) = OPTS (flag_unroll_loops);
+  if (!OPTS_SET_P (flag_rename_registers))
+   OPTS (flag_rename_registers) = OPTS (flag_unroll_loops);
   /* -fcunroll-grow-size default follws -f[no]-unroll-loops.  */
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_unroll_loops
-|| flag_peel_loops
-|| optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_unroll_loops)
+|| OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
   else
 {
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
 
+#undef OPTS
+#undef OPTS_SET_P
+}
+
+/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+
+void
+ix86_override_options_after_change (void)
+{
+  ix86_default_align (&global_options);
+
+  ix86_recompute_optlev_based_flags (&global_options, &global_options_set);
+
+  ix86_override_options_after_change_1 (&global_options, &global_options_set);
 }
 
 /* Clear stack slot assignments remembered from previous functions.
@@ -2527,7 +25

[gcc r14-10427] [i386] adjust flag_omit_frame_pointer in a single function [PR113719]

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:7bc63f1c70331763989d72b7df051e0ce67ff84c

commit r14-10427-g7bc63f1c70331763989d72b7df051e0ce67ff84c
Author: Alexandre Oliva 
Date:   Tue Jul 16 06:27:09 2024 -0300

[i386] adjust flag_omit_frame_pointer in a single function [PR113719]

The first two patches for PR113719 have each regressed
gcc.dg/ipa/iinline-attr.c on a different target.  The reason for this
instability is that there are competing flag_omit_frame_pointer
overriders on x86:

- ix86_recompute_optlev_based_flags computes and sets a
  -f[no-]omit-frame-pointer default depending on
  USE_IX86_FRAME_POINTER and, in 32-bit mode, optimize_size

- ix86_option_override_internal enables flag_omit_frame_pointer for
  -momit-leaf-frame-pointer to take effect

ix86_option_override[_internal] calls
ix86_recompute_optlev_based_flags before setting
flag_omit_frame_pointer.  It is called during global process_options.

But ix86_recompute_optlev_based_flags is also called by
parse_optimize_options, during attribute processing, and at that
point, ix86_option_override is not called, so the final overrider for
global options is not applied to the optimize attributes.  If they
differ, the testcase fails.

In order to fix this, we need to process all overriders of this option
whenever we process any of them.  Since this setting is affected by
optimization options, it makes sense to compute it in
parse_optimize_options, rather than in process_options.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc (ix86_option_override_internal):
Move flag_omit_frame_pointer final overrider...
(ix86_recompute_optlev_based_flags): ... here.

(cherry picked from commit bf8e80f9d164f8778d86a3dc50e501cf19a9eff1)

Diff:
---
 gcc/config/i386/i386-options.cc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 6e8fcbdaa28a..af450dba73dd 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1923,6 +1923,12 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
}
 }
+
+  /* Keep nonleaf frame pointers.  */
+  if (opts->x_flag_omit_frame_pointer)
+opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
+  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
+opts->x_flag_omit_frame_pointer = 1;
 }
 
 /* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
@@ -2623,12 +2629,6 @@ ix86_option_override_internal (bool main_args_p,
 opts->x_target_flags |= MASK_NO_RED_ZONE;
 }
 
-  /* Keep nonleaf frame pointers.  */
-  if (opts->x_flag_omit_frame_pointer)
-opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
-  else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
-opts->x_flag_omit_frame_pointer = 1;
-
   /* If we're doing fast math, we don't care about comparison order
  wrt NaNs.  This lets us use a shorter comparison sequence.  */
   if (opts->x_flag_finite_math_only)


[gcc r13-8915] [i386] restore recompute to override opts after change [PR113719]

2024-07-16 Thread Alexandre Oliva via Gcc-cvs
https://gcc.gnu.org/g:0b9d6829b503cfc72c4271ead2948d8100cce25c

commit r13-8915-g0b9d6829b503cfc72c4271ead2948d8100cce25c
Author: Alexandre Oliva 
Date:   Tue Jul 16 06:48:18 2024 -0300

[i386] restore recompute to override opts after change [PR113719]

The first patch for PR113719 regressed gcc.dg/ipa/iinline-attr.c on
toolchains configured to --enable-frame-pointer, because the
optimization node created within handle_optimize_attribute had
flag_omit_frame_pointer incorrectly set, whereas
default_optimization_node didn't.  With this difference,
can_inline_edge_by_limits_p flagged an optimization mismatch and we
refused to inline the function that had a redundant optimization flag
into one that didn't, which is exactly what is tested for there.

This patch restores the calls to ix86_default_align and
ix86_recompute_optlev_based_flags that used to be, and ought to be,
issued during TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE, but preserves the
intent of the original change, of having those functions called at
different spots within ix86_option_override_internal.  To that end,
the remaining bits were refactored into a separate function, that was
in turn adjusted to operate on explicitly-passed opts and opts_set,
rather than going for their global counterparts.


for  gcc/ChangeLog

PR target/113719
* config/i386/i386-options.cc
(ix86_override_options_after_change_1): Add opts and opts_set
parms, operate on them, after factoring out of...
(ix86_override_options_after_change): ... this.  Restore calls
of ix86_default_align and ix86_recompute_optlev_based_flags.
(ix86_option_override_internal): Call the factored-out bits.

(cherry picked from commit bf2fc0a27b35de039c3d45e6d7ea9ad0a8a305ba)

Diff:
---
 gcc/config/i386/i386-options.cc | 59 -
 1 file changed, 40 insertions(+), 19 deletions(-)

diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index cdbe2dc62010..4c27e4e01957 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -1870,37 +1870,58 @@ ix86_recompute_optlev_based_flags (struct gcc_options 
*opts,
 }
 }
 
-/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+/* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
 
-void
-ix86_override_options_after_change (void)
+static void
+ix86_override_options_after_change_1 (struct gcc_options *opts,
+ struct gcc_options *opts_set)
 {
+#define OPTS_SET_P(OPTION) opts_set->x_ ## OPTION
+#define OPTS(OPTION) opts->x_ ## OPTION
+
   /* Disable unrolling small loops when there's explicit
  -f{,no}unroll-loop.  */
-  if ((OPTION_SET_P (flag_unroll_loops))
- || (OPTION_SET_P (flag_unroll_all_loops)
-&& flag_unroll_all_loops))
+  if ((OPTS_SET_P (flag_unroll_loops))
+ || (OPTS_SET_P (flag_unroll_all_loops)
+&& OPTS (flag_unroll_all_loops)))
 {
-  if (!OPTION_SET_P (ix86_unroll_only_small_loops))
-   ix86_unroll_only_small_loops = 0;
+  if (!OPTS_SET_P (ix86_unroll_only_small_loops))
+   OPTS (ix86_unroll_only_small_loops) = 0;
   /* Re-enable -frename-registers and -fweb if funroll-loops
 enabled.  */
-  if (!OPTION_SET_P (flag_web))
-   flag_web = flag_unroll_loops;
-  if (!OPTION_SET_P (flag_rename_registers))
-   flag_rename_registers = flag_unroll_loops;
+  if (!OPTS_SET_P (flag_web))
+   OPTS (flag_web) = OPTS (flag_unroll_loops);
+  if (!OPTS_SET_P (flag_rename_registers))
+   OPTS (flag_rename_registers) = OPTS (flag_unroll_loops);
   /* -fcunroll-grow-size default follws -f[no]-unroll-loops.  */
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_unroll_loops
-|| flag_peel_loops
-|| optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_unroll_loops)
+|| OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
   else
 {
-  if (!OPTION_SET_P (flag_cunroll_grow_size))
-   flag_cunroll_grow_size = flag_peel_loops || optimize >= 3;
+  if (!OPTS_SET_P (flag_cunroll_grow_size))
+   OPTS (flag_cunroll_grow_size)
+ = (OPTS (flag_peel_loops)
+|| OPTS (optimize) >= 3);
 }
 
+#undef OPTS
+#undef OPTS_SET_P
+}
+
+/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook.  */
+
+void
+ix86_override_options_after_change (void)
+{
+  ix86_default_align (&global_options);
+
+  ix86_recompute_optlev_based_flags (&global_options, &global_options_set);
+
+  ix86_override_options_after_change_1 (&global_options, &global_options_set);
 }
 
 /* Clear stack slot assignments remembered from previous functions.
@@ -2417,7 +243

  1   2   3   4   5   6   7   8   9   10   >