[gcc r15-4696] Fix old glitch in the GNAT Reference Manual
https://gcc.gnu.org/g:ecf80e7daf7f27defe1ca724e265f723d10e7681 commit r15-4696-gecf80e7daf7f27defe1ca724e265f723d10e7681 Author: Eric Botcazou Date: Sat Oct 26 15:16:57 2024 +0200 Fix old glitch in the GNAT Reference Manual gcc/ada PR ada/62122 * doc/gnat_rm/implementation_defined_attributes.rst (Unrestricted_Access): Remove null exclusion. * gnat_rm.texi: Regenerate. Diff: --- gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst | 2 +- gcc/ada/gnat_rm.texi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst index 2db245a0b884..f0518106853f 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst @@ -1382,7 +1382,7 @@ has returned, such calls are erroneous. For example: package body P is - type Less_Nested is not null access procedure; + type Less_Nested is access procedure; Global : Less_Nested; procedure P1 is diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 4bcdcf6781d4..647207f89e9d 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -12066,7 +12066,7 @@ has returned, such calls are erroneous. For example: @example package body P is - type Less_Nested is not null access procedure; + type Less_Nested is access procedure; Global : Less_Nested; procedure P1 is
[gcc r15-4699] doc, fortran: Add a missing menu item.
https://gcc.gnu.org/g:f6e93484be58065a3e8c3746387884866b985134 commit r15-4699-gf6e93484be58065a3e8c3746387884866b985134 Author: Iain Sandoe Date: Sat Oct 26 23:06:09 2024 +0100 doc, fortran: Add a missing menu item. The changes in r15-4697-g4727bfb37701 omit a menu entry which causes a bootstrap fail when Frotran is included for at least makeinfo 6.7. Fixed thus. gcc/fortran/ChangeLog: * intrinsic.texi: Add menu item for UINT. Signed-off-by: Iain Sandoe Diff: --- gcc/fortran/intrinsic.texi | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 0354704e4d0d..f47fa3bbd5e8 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -321,6 +321,7 @@ Some basic guidelines for editing this document: * @code{TTYNAM}:TTYNAM,Get the name of a terminal device * @code{UBOUND}:UBOUND,Upper dimension bounds of an array * @code{UCOBOUND}: UCOBOUND, Upper codimension bounds of an array +* @code{UINT}: UINT, Convert to an unsigned integer type * @code{UMASK}: UMASK, Set the file creation mask * @code{UNLINK}:UNLINK,Remove a file from the file system * @code{UNPACK}:UNPACK,Unpack an array of rank one into an array
[gcc r15-4695] Assert finished vectorizer pattern COND_EXPR transition
https://gcc.gnu.org/g:d17e672ce82e696d8662afceb318f97139995c89 commit r15-4695-gd17e672ce82e696d8662afceb318f97139995c89 Author: Richard Biener Date: Fri Oct 25 14:27:37 2024 +0200 Assert finished vectorizer pattern COND_EXPR transition The following places a few strathegic asserts so we do not end up with COND_EXPRs with a comparison as the first operand during vectorization. * tree-vect-slp.cc (vect_get_operand_map): Mark COMPARISON_CLASS_P COND_EXPR condition path unreachable. * tree-vect-stmts.cc (vect_is_simple_use): Likewise. (vectorizable_condition): Assert the COND_EXPR condition isn't COMPARISON_CLASS_P. Diff: --- gcc/tree-vect-slp.cc | 2 +- gcc/tree-vect-stmts.cc | 8 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index b192328e3eb7..2e98a943e061 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -549,7 +549,7 @@ vect_get_operand_map (const gimple *stmt, bool gather_scatter_p = false, { if (gimple_assign_rhs_code (assign) == COND_EXPR && COMPARISON_CLASS_P (gimple_assign_rhs1 (assign))) - return cond_expr_maps[swap]; + gcc_unreachable (); if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison && swap) return op1_op0_map; diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 396eea070a4e..4a824d169550 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12290,6 +12290,7 @@ vectorizable_condition (vec_info *vinfo, return false; /* FORNOW */ cond_expr = gimple_assign_rhs1 (stmt); + gcc_assert (! COMPARISON_CLASS_P (cond_expr)); if (!vect_is_simple_cond (cond_expr, vinfo, stmt_info, slp_node, &comp_vectype, &dts[0], vectype) @@ -14257,12 +14258,7 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info stmt, slp_tree slp_node, { if (gimple_assign_rhs_code (ass) == COND_EXPR && COMPARISON_CLASS_P (gimple_assign_rhs1 (ass))) - { - if (operand < 2) - *op = TREE_OPERAND (gimple_assign_rhs1 (ass), operand); - else - *op = gimple_op (ass, operand); - } + gcc_unreachable (); else if (gimple_assign_rhs_code (ass) == VIEW_CONVERT_EXPR) *op = TREE_OPERAND (gimple_assign_rhs1 (ass), 0); else
[gcc r15-4694] Finish vectorizer pattern proper COND_EXPR transition
https://gcc.gnu.org/g:9fd86361676064a06ed61d4e7ae82492a14185a3 commit r15-4694-g9fd86361676064a06ed61d4e7ae82492a14185a3 Author: Richard Biener Date: Fri Oct 25 14:20:23 2024 +0200 Finish vectorizer pattern proper COND_EXPR transition This fixes up vect_recog_ctz_ffs_pattern. * tree-vect-patterns.cc (vect_recog_ctz_ffs_pattern): Create a separate pattern stmt for the comparison in the generated COND_EXPR. Diff: --- gcc/tree-vect-patterns.cc | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index d9fe49378583..46aa3129bb30 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -2072,8 +2072,11 @@ vect_recog_ctz_ffs_pattern (vec_info *vinfo, stmt_vec_info stmt_vinfo, tree ret_var = vect_recog_temp_ssa_var (lhs_type, NULL); rhs_oprnd = gimple_call_arg (call_stmt, 0); rhs_type = TREE_TYPE (rhs_oprnd); - tree cmp = build2_loc (loc, NE_EXPR, boolean_type_node, -rhs_oprnd, build_zero_cst (rhs_type)); + tree cmp = vect_recog_temp_ssa_var (boolean_type_node, NULL); + pattern_stmt = gimple_build_assign (cmp, NE_EXPR, rhs_oprnd, + build_zero_cst (rhs_type)); + append_pattern_def_seq (vinfo, stmt_vinfo, pattern_stmt, + truth_type_for (vec_type), rhs_type); pattern_stmt = gimple_build_assign (ret_var, COND_EXPR, cmp, new_var, build_int_cst (lhs_type, val));
[gcc r15-4697] Add UNSIGNED for intrinsics.
https://gcc.gnu.org/g:4727bfb37701f3fef98a5f8b60dcd2daa82e8143 commit r15-4697-g4727bfb37701f3fef98a5f8b60dcd2daa82e8143 Author: Thomas Koenig Date: Sat Oct 26 19:20:14 2024 +0200 Add UNSIGNED for intrinsics. gcc/fortran/ChangeLog: * gfortran.texi: Correct reference to make clear that UNSIGNED will not be part of F202Y. Other clarifications. Extend table of intrinsics, add links. * intrinsic.texi: Add descriptions for UNSIGNED arguments. * invoke.texi: Add anchor for -funsigned. Diff: --- gcc/fortran/gfortran.texi | 115 +++ gcc/fortran/intrinsic.texi | 486 ++--- gcc/fortran/invoke.texi| 1 + 3 files changed, 409 insertions(+), 193 deletions(-) diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 76326e625f8d..3b2691649b0e 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -1192,7 +1192,7 @@ extensions. @menu * Extensions implemented in GNU Fortran:: * Extensions not implemented in GNU Fortran:: -* Experimental features for Fortran 202Y:: +* Experimental features for future Fortran versions:: @end menu @@ -2702,19 +2702,19 @@ descriptor occurred, use @code{INQUIRE} to get the file position, count the characters up to the next @code{NEW_LINE} and then start reading from the position marked previously. -@node Experimental features for Fortran 202Y -@section Experimental features for Fortran 202Y -@cindex Fortran 202Y +@node Experimental features for future Fortran versions +@section Experimental features future Fortran versions +@cindex Future Fortran versions GNU Fortran supports some experimental features which have been proposed and accepted by the J3 standards committee. These exist to give users a chance to try them out, and to provide a reference implementation. -As these features have not been finalized, there is a chance that the -version in the upcoming standard will differ from what GNU Fortran -currently implements. Stability of these implementations is therefore -not guaranteed. +As these features have not been included in the worklist for Fortran +202Y by WG5, there is a chance that a version in any upcoming standard +will differ from what GNU Fortran currently implements. These +features are therefore currently classified as an extension. @menu * Unsigned integers:: @@ -2723,11 +2723,12 @@ not guaranteed. @node Unsigned integers @subsection Unsigned integers @cindex Unsigned integers -GNU Fortran supports unsigned integers according to +If the @option{-funsigned} option is given, GNU Fortran supports +unsigned integers according to @uref{https://j3-fortran.org/doc/year/24/24-116.txt, J3/24-116}. The -data type is called @code{UNSIGNED}. For an unsigned type with $n$ bits, -it implements integer arithmetic modulo @code{2**n}, comparable to the -@code{unsigned} data type in C. +data type is called @code{UNSIGNED}. For an unsigned type with @code{n} +bits, it implements integer arithmetic modulo @code{2**n}, comparable +to the @code{unsigned} data type in C. The data type has @code{KIND} numbers comparable to other Fortran data types, which can be selected via the @code{SELECTED_UNSIGNED_KIND} @@ -2771,31 +2772,75 @@ formatted and unformatted I/O. For formatted I/O, the @code{B}, values and values which would overflow are rejected with @code{-pedantic}. -As of now, the following intrinsics take unsigned arguments: +The following intrinsics take unsigned arguments: @itemize @bullet -@item @code{BLT}, @code{BLE}, @code{BGE} and @code{BGT}. These intrinsics - are actually redundant because comparison operators could be used - directly. -@item @code{IAND}, @code{IOR}, @code{IEOR} and @code{NOT} -@item @code{BIT_SIZE}, @code{DIGITS} and @code{HUGE} -@item @code{DSHIFTL} and @code{DSHIFTR} -@item @code{IBCLR}, @code{IBITS} and @code{IBSET} -@item @code{MIN} and @code{MAX} -@item @code{ISHFT}, @code{ISHFTC}, @code{SHIFTL}, @code{SHIFTR} and - @code{SHIFTA}. -@item @code{MERGE_BITS} -@item @code{MOD} and @code{MODULO} -@item @code{MVBITS} -@item @code{RANGE} -@item @code{TRANSFER} -@item @code{SUM}, @code{PRODUCT}, @code{MATMUL} and @code{DOT_PRODUCT} -@item @code{IANY}, @code{IALL} and @code{IPARITY} -@item @code{RANDOM_NUMBER} -@item @code{CSHIFT} and @code{EOSHIFT} -@item @code{FINDLOC} -@item @code{MAXVAL} and @code{MINVAL} -@item @code{MAXLOC} and @code{MINLOC}. +@item @code{BGE}, @pxref{BGE} +@item @code{BGT}, @pxref{BGT} +@item @code{BIT_SIZE}, @pxref{BIT_SIZE} +@item @code{BLE}, @pxref{BLE} +@item @code{BLT}, @pxref{BLT} +@item @code{CSHIFT}, @pxref{CSHIFT} +@item @code{DIGITS}, @pxref{DIGITS} +@item @code{DOT_PRODUCT}, @pxref{DOT_PRODUCT} +@item @code{DSHIFTL}, @pxref{DSHIFTL} +@item @code{DSHIFTR}, @pxref{DSHIFTR} +@item @code{EOSHIFT}, @pxref{EOSHIFT} +@item @code{FINDLOC}, @pxref{FINDLOC} +@item @code{HUGE}, @pxref{HUGE} +@item @code{IALL},
[gcc r15-4693] Finish vectorizer pattern proper COND_EXPR transition
https://gcc.gnu.org/g:5203deaf526b7119b456c0ac568851957640c078 commit r15-4693-g5203deaf526b7119b456c0ac568851957640c078 Author: Richard Biener Date: Fri Oct 25 13:42:08 2024 +0200 Finish vectorizer pattern proper COND_EXPR transition The following tries to finish building proper GIMPLE COND_EXPRs in vectorizer pattern recognition. * tree-vect-patterns.cc (vect_recog_divmod_pattern): Build separate comparion pattern for the condition of a COND_EXPR pattern. Diff: --- gcc/tree-vect-patterns.cc | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index d4c7793bb5aa..d9fe49378583 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -4933,8 +4933,11 @@ vect_recog_divmod_pattern (vec_info *vinfo, return pattern_stmt; } - cond = build2 (LT_EXPR, boolean_type_node, oprnd0, -build_int_cst (itype, 0)); + cond = vect_recog_temp_ssa_var (boolean_type_node, NULL); + def_stmt = gimple_build_assign (cond, LT_EXPR, oprnd0, + build_int_cst (itype, 0)); + append_pattern_def_seq (vinfo, stmt_vinfo, def_stmt, + truth_type_for (vectype), itype); if (rhs_code == TRUNC_DIV_EXPR || rhs_code == EXACT_DIV_EXPR) {
[gcc r15-4698] tree: Mark PAREN_EXPR and VEC_DUPLICATE_EXPR as non-trapping [PR117234]
https://gcc.gnu.org/g:5596572b6bf72031de888301ebfe8e984df04dc9 commit r15-4698-g5596572b6bf72031de888301ebfe8e984df04dc9 Author: Andrew Pinski Date: Sat Oct 26 02:14:18 2024 -0700 tree: Mark PAREN_EXPR and VEC_DUPLICATE_EXPR as non-trapping [PR117234] While looking to fix a possible trapping issue in PHI-OPT's factor, I noticed that some tree codes could be marked as trapping even though they don't have a possibility to trap. In the case of PAREN_EXPR, it is basically a nop except when it comes to association across it so it can't trap. In the case of VEC_DUPLICATE_EXPR, it is similar to a CONSTRUCTOR, so it can't trap. This fixes those 2 issues and adds 4 testcases, 2 which are specific to aarch64 since the only way to get a VEC_DUPLICATE_EXPR is to use intrinsics currently. Build and tested for aarch64-linux-gnu. PR tree-optimization/117234 gcc/ChangeLog: * tree-eh.cc (operation_could_trap_helper_p): Treat PAREN_EXPR and VEC_DUPLICATE_EXPR like constructing expressions. gcc/testsuite/ChangeLog: * g++.dg/eh/noncall-fp-1.C: New test. * g++.target/aarch64/sve/noncall-eh-fp-1.C: New test. * gcc.dg/tree-ssa/trapping-1.c: New test. * gcc.target/aarch64/sve/trapping-1.c: New test. Signed-off-by: Andrew Pinski Diff: --- gcc/testsuite/g++.dg/eh/noncall-fp-1.C | 15 +++ .../g++.target/aarch64/sve/noncall-eh-fp-1.C| 16 gcc/testsuite/gcc.dg/tree-ssa/trapping-1.c | 21 + gcc/testsuite/gcc.target/aarch64/sve/trapping-1.c | 21 + gcc/tree-eh.cc | 2 ++ 5 files changed, 75 insertions(+) diff --git a/gcc/testsuite/g++.dg/eh/noncall-fp-1.C b/gcc/testsuite/g++.dg/eh/noncall-fp-1.C new file mode 100644 index ..bb6f8afb58a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/noncall-fp-1.C @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fnon-call-exceptions -fdump-tree-optimized" } */ + +/* PR tree-optimization/117234 */ +/* PAREN_EXPR should not be declared as trapping. */ + +float f1(float a) +{ + try { +return __builtin_assoc_barrier (a); + } catch(...) + { __builtin_trap (); } +} + +/* { dg-final { scan-tree-dump-not "__builtin_trap" "optimized" } } */ diff --git a/gcc/testsuite/g++.target/aarch64/sve/noncall-eh-fp-1.C b/gcc/testsuite/g++.target/aarch64/sve/noncall-eh-fp-1.C new file mode 100644 index ..778b63d82d56 --- /dev/null +++ b/gcc/testsuite/g++.target/aarch64/sve/noncall-eh-fp-1.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fnon-call-exceptions -fdump-tree-optimized" } */ + +/* PR tree-optimization/117234 */ +/* VEC_DUPLICATE_EXPR should not be declared as trapping. */ +#include + +svfloat32_t f(float a) +{ + try { +return svdup_f32(a); + } catch(...) + { __builtin_trap (); } +} + +/* { dg-final { scan-tree-dump-not "__builtin_trap" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/trapping-1.c b/gcc/testsuite/gcc.dg/tree-ssa/trapping-1.c new file mode 100644 index ..ea07562e47eb --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/trapping-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-lim-details" } */ + +/* PR tree-optimization/117234 */ +/* PAREN_EXPR should not be declared as + a trapping. */ + +float f1(float a, int t, _Bool *b, float c) +{ + float tt = 0; + for (int i = 0; i < t; i++) + { +if (b[i]) + tt *= -__builtin_assoc_barrier (-a); + } + return tt; +} + +/* There should be 3 `invariant up to level`, two for each `-` and one + for the PAREN_EXPR. */ +/* { dg-final { scan-tree-dump-times "invariant up to level" 3 "lim2" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/trapping-1.c b/gcc/testsuite/gcc.target/aarch64/sve/trapping-1.c new file mode 100644 index ..1ac7ac708d22 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/trapping-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-lim-details" } */ + +/* PR tree-optimization/117234 */ +/* VEC_DUPLICATE_EXPR should not be declared as + a trapping. */ +#include + +svfloat32_t f(float a, int t, _Bool *b) +{ + svfloat32_t tt = svdup_f32(0.0); + for (int i =0 ;i < t; i++) + { +if (b[i]) + tt = svadd_f32_z(svptrue_b32(),tt,svdup_f32(a)); + } + return tt; +} + +/* There should be 1 `invariant up to level`, one for the VEC_DUPLICATE_EXPR. */ +/* { dg-final { scan-tree-dump-times "invariant up to level" 1 "lim2" } } */ diff --git a/gcc/tree-eh.cc b/gcc/tree-eh.cc index ae0a4e3864cd..769785fad2b9 100644 --- a/gcc/tree-eh.cc +++ b/gcc/tree-eh.cc @@ -2532,6 +2532,8 @@ operation_could_trap_helper_p (enum tree_code op, case COMPLEX_EXPR: case CONSTRUCTOR: +case VEC_DUPLICATE_EXPR: +