Re: [PATCH] RISC-V: Optimize the MASK opt generation

2023-05-26 Thread Feng Wang
On 2023-03-01 09:46  Feng Wang wrote: > >The Mask flag in the single TargetVariable is not enough due to more >and more extensions were added.So I optimize the defination of Mask >flag, please refer to the below case: >There are some new MASK flags for 'v' extension(ZVL32B,ZVL64B,...,ZVL65536B), >b

[Ping][PATCH] RISC-V: Optimize the MASK opt generation

2023-05-26 Thread Feng Wang
Ping, I will rebase if the change is fine to you, thanks! On 2023-03-01 09:46  Feng Wang wrote: > >The Mask flag in the single TargetVariable is not enough due to more >and more extensions were added.So I optimize the defination of Mask >flag, please refer to the below case: >There are some new MA

[PATCH] RISC-V: Add RVV FMA auto-vectorization support

2023-05-26 Thread juzhe . zhong
From: Juzhe-Zhong This patch support FMA auto-vectorization pattern. 1. Let's RA decide vmacc or vmadd. 2. Fix bug of vector.md which generate incorrect information to VSETVL PASS when testing ternop-3.c. gcc/ChangeLog: * config/riscv/autovec.md (fma4): New pattern. (*fma): D

Re: [PATCH RFC] c++: use __cxa_call_terminate for MUST_NOT_THROW [PR97720]

2023-05-26 Thread Jonathan Wakely via Gcc-patches
On Wed, 24 May 2023 at 19:56, Jason Merrill via Libstdc++ < libstd...@gcc.gnu.org> wrote: > Middle-end folks: any thoughts about how best to make the change described > in > the last paragraph below? > > Library folks: any thoughts on the changes to __cxa_call_terminate? > I see no harm in export

Re: [PATCH] RISC-V: Add RVV FMA auto-vectorization support

2023-05-26 Thread Robin Dapp via Gcc-patches
Hi Juzhe, > +;; We can't expand FMA for the following reasons: But we do :) We just haven't selected the proper alternative yet. > +;; 1. Before RA, we don't know which multiply-add instruction is the ideal > one. > +;;The vmacc is the ideal instruction when operands[3] overlaps > operand

Re: [PATCH 1/3] xtensa: Addendum of the commit e33d2dcb463161a110ac345a451132ce8b2b23d9

2023-05-26 Thread Max Filippov via Gcc-patches
On Thu, May 25, 2023 at 8:13 AM Takayuki 'January June' Suwa wrote: > > gcc/ChangeLog: > > * config/xtensa/xtensa.md (*extzvsi-1bit_ashlsi3): > Retract excessive line folding, and correct the value of > the "length" insn attribute related to TARGET_DENSITY. > (*extz

Re: [PATCH 2/3] xtensa: Add 'subtraction from constant' insn pattern

2023-05-26 Thread Max Filippov via Gcc-patches
On Thu, May 25, 2023 at 8:13 AM Takayuki 'January June' Suwa wrote: > > This patch makes try to eliminate using temporary pseudo for > '(minus:SI (const_int) (reg:SI))' if the addition of negative constant > value can be emitted in a single machine instruction. > > /* example */ > int test

Re: [PATCH 3/3] xtensa: Rework 'setmemsi' insn pattern

2023-05-26 Thread Max Filippov via Gcc-patches
On Thu, May 25, 2023 at 8:13 AM Takayuki 'January June' Suwa wrote: > > In order to reject voodoo estimation logic with lots of magic numbers, > this patch revises the code to measure the costs of the three memset > methods based on the actual emission size of the insn sequence > corresponding to

Re: Re: [PATCH] RISC-V: Add RVV FMA auto-vectorization support

2023-05-26 Thread 钟居哲
Hi, Robin. >> Can you explain these two points (3 and 4, maybe 2) a bit in the comments? >> I.e. what makes fma different from a normal insn? You can take a lookt at vector.md. The ternary instruction pattern has operands[0] operands[1] operands[2] operands[3] operands[4] operands[5] : operands

[committed] libstdc++: Resolve -Wsign-compare issue

2023-05-26 Thread Matthias Kretz via Gcc-patches
pushed to master, will backport later tested on x86_64-pc-linux-gnu and powerpc64le-linux-gnu --- 8< Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * include/experimental/bits/simd_ppc.h (_S_bit_shift_left): Negative __y is UB, so prefer signed com

[PATCH] libstdc++: Fix test assumptions on long and long double

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done) tested on powerpc64le-linux-gnu (with 64-bit long double) --- 8< Expect that long might not fit into the long double mantissa bits. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental

[PATCH] libstdc++: Simplify calculation of expected value in simd test

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done)? tested on powerpc64le-linux-gnu --- 8< This avoids a failure on PR109964. Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/integer_operators.cc: Compute expecte

[PATCH] libstdc++: Correct NTTP and simd_mask ctor call

2023-05-26 Thread Matthias Kretz via Gcc-patches
OK for master and all backports (after 11.4 is done)? tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu --- 8< Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: PR libstdc++/109822 * include/experimental/bits/simd.h (to_native): Use int NTTP

Re: [PATCH] RISC-V: Add RVV FMA auto-vectorization support

2023-05-26 Thread Robin Dapp via Gcc-patches
Hi Juzhe, >>> Can you explain these two points (3 and 4, maybe 2) a bit in the comments? >>> I.e. what makes fma different from a normal insn? > You can take a lookt at vector.md. The ternary instruction pattern has  > operands[0] operands[1] operands[2] operands[3] operands[4] operands[5] : > >

[PATCH V2] RISC-V: Add RVV FMA auto-vectorization support

2023-05-26 Thread juzhe . zhong
From: Juzhe-Zhong This patch support FMA auto-vectorization pattern. 1. Let's RA decide vmacc or vmadd. 2. Fix bug of vector.md which generate incorrect information to VSETVL PASS when testing ternop-3.c. gcc/ChangeLog: * config/riscv/autovec.md (fma4): New pattern. (*fma): D

Re: [PATCH] RISC-V: Add the option "-mdisable-multilib-check" to avoid multilib checks breaking the compilation.

2023-05-26 Thread Maciej W. Rozycki
On Tue, 23 May 2023, Jin Ma via Gcc-patches wrote: > When testing a extension, it is often necessary for a certain program not to > need some kind of extension, such as the bitmanip extension, to evaluate the > performance or codesize of the extension. However, the current multilib rules > will re

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-26 Thread Qing Zhao via Gcc-patches
> On May 25, 2023, at 5:02 PM, Joseph Myers wrote: > > What happens if the field giving the number of elements is in a contained > anonymous structure or union? > > struct s { > struct { size_t count; }; > int array[] __attribute__ ((element_count ("count"))); > }; > > This ought to work -

Re: [Ping][PATCH] RISC-V: Optimize the MASK opt generation

2023-05-26 Thread Jeff Law via Gcc-patches
On 5/26/23 03:00, Feng Wang wrote: Ping, I will rebase if the change is fine to you, thanks! Not forgotten. I think Palmer owns this from a review standpoint. We're tracking RISC-V specific patches here: https://patchwork.sourceware.org/project/gcc/list/?series=&submitter=&state=&q=RISC-

[PATCH] RISC-V: Allow all const_vec_duplicates as constants.

2023-05-26 Thread Robin Dapp
Hi, as we can always broadcast an integer constant to a vector register allow them in riscv_const_insns. We need as many instructions as it takes to generate the constant and one vmv.vx. Regards Robin gcc/ChangeLog: * config/riscv/riscv.cc (riscv_const_insns): Allow const_vec_

[PATCH] Add COMPLEX_VECTOR_INT modes

2023-05-26 Thread Andrew Stubbs
Hi all, I want to implement a vector DIVMOD libfunc for amdgcn, but I can't just do it because the GCC middle-end models DIVMOD's return value as "complex int" type, and there are no vector equivalents of that type. Therefore, this patch adds minimal support for "complex vector int" modes.

Re: [PATCH V5, 1/2] PR target/105325: Rewrite genfusion.pl's gen_ld_cmpi_p10 function.

2023-05-26 Thread Segher Boessenkool
Hi Mike, On Wed, May 10, 2023 at 11:38:55AM -0400, Michael Meissner wrote: > This patch rewrites the gen_ld_cmpi_p10 function in genfusion.pl to be > clearer. That is not at all what I asked for, even if I would agree the code is nicer to read now (I don't). What I asked for, what is needed, is

[patch] amdgcn: Change -m(no-)xnack to -mxnack=(on,off,any)

2023-05-26 Thread Tobias Burnus
(Update the syntax of the amdgcn commandline option in anticipation of later patches; while -m(no-)xnack is in mainline since r12-2396-gaad32a00b7d2b6 (for PR100208), -mxsnack (contrary to -msram-ecc) is currently mostly a stub for later patches and is documented as such in invoke.texi. Thus, thi

Re: [PATCH V5, 2/2] PR target/105325: Fix memory constraints for power10 fusion.

2023-05-26 Thread Segher Boessenkool
On Wed, May 10, 2023 at 11:40:00AM -0400, Michael Meissner wrote: > This patch applies stricter predicates and constraints for LD and LWA > instructions with power10 fusion. These instructions are DS-form > instructions, > which means that the bottom 2 bits of the address must be 0. The low two

Re: [patch] amdgcn: Change -m(no-)xnack to -mxnack=(on,off,any)

2023-05-26 Thread Andrew Stubbs
OK. Andrew On 26/05/2023 15:58, Tobias Burnus wrote: (Update the syntax of the amdgcn commandline option in anticipation of later patches; while -m(no-)xnack is in mainline since r12-2396-gaad32a00b7d2b6 (for PR100208), -mxsnack (contrary to -msram-ecc) is currently mostly a stub for later pat

[r14-1246 Regression] FAIL: gcc.target/i386/pr98434-1.c scan-assembler-times vpsrlvw[\\t ]*%ymm 2 on Linux/x86_64

2023-05-26 Thread haochen.jiang via Gcc-patches
On Linux/x86_64, 52ff3f7b863da1011b73c0ab3b11f6c78b6451c7 is the first bad commit commit 52ff3f7b863da1011b73c0ab3b11f6c78b6451c7 Author: Uros Bizjak Date: Thu May 25 19:40:26 2023 +0200 i386: Use 2x-wider modes when emulating QImode vector instructions caused FAIL: gcc.target/i386/avx51

Re: [PATCH] libstdc++: Fix test assumptions on long and long double

2023-05-26 Thread Jonathan Wakely via Gcc-patches
On Fri, 26 May 2023 at 12:03, Matthias Kretz via Libstdc++ < libstd...@gcc.gnu.org> wrote: > OK for master and all backports (after 11.4 is done) > OK > > tested on powerpc64le-linux-gnu (with 64-bit long double) > > --- 8< > > Expect that long might not fit into the long

Re: [PATCH] libstdc++: Simplify calculation of expected value in simd test

2023-05-26 Thread Jonathan Wakely via Gcc-patches
On Fri, 26 May 2023 at 12:09, Matthias Kretz via Libstdc++ < libstd...@gcc.gnu.org> wrote: > OK for master and all backports (after 11.4 is done)? > OK > > tested on powerpc64le-linux-gnu > > --- 8< > > This avoids a failure on PR109964. > > Signed-off-by: Matthias Kretz

Re: [PATCH] libstdc++: Correct NTTP and simd_mask ctor call

2023-05-26 Thread Jonathan Wakely via Gcc-patches
On Fri, 26 May 2023 at 12:11, Matthias Kretz via Libstdc++ < libstd...@gcc.gnu.org> wrote: > OK for master and all backports (after 11.4 is done)? > OK > > tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu > > --- 8< > > Signed-off-by: Matthias Kretz > > libstdc++-v

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-05-26 Thread Kees Cook via Gcc-patches
On Thu, May 25, 2023 at 04:14:47PM +, Qing Zhao wrote: > This patch set introduces a new attribute "element_count" to annotate bounds > for C99 flexible array member. Thank you for this work! I'm really excited to start using it in the Linux kernel. I'll give this a spin, but I know you've al

Re: [PATCH] Convert ipcp_vr_lattice to type agnostic framework.

2023-05-26 Thread Martin Jambor
Hello, On Mon, May 22 2023, Aldy Hernandez wrote: > I've adjusted the patch with some minor cleanups that came up when I > implemented the rest of the IPA revamp. > > Rested. OK? > > On Wed, May 17, 2023 at 4:31 PM Aldy Hernandez wrote: >> >> This converts the lattice to store ranges in Value_Ra

Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-26 Thread Jeff Law via Gcc-patches
On 5/25/23 08:43, Robin Dapp wrote: Beside, V2 patch should change this: emit_vlmax_masked_insn (unsigned icode, int op_num, rtx *ops) change it into emit_vlmax_masked_mu_insn . V3 is inline with these changes. This patch implements abs2, vneg2 and vnot2 expanders for integer vector regist

Re: [PATCH] RISC-V: Add autovec sign/zero extension and truncation.

2023-05-26 Thread Jeff Law via Gcc-patches
On 5/25/23 03:03, Robin Dapp wrote: Hi, this patch implements the autovec expanders for sign and zero extension patterns as well as the accompanying truncations. In order to use them additional mode_attr iterators as well as vectorizer hooks are required. Using these hooks we can e.g. vector

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-26 Thread Joseph Myers
On Thu, 25 May 2023, Qing Zhao via Gcc-patches wrote: > > On May 25, 2023, at 4:51 PM, Joseph Myers wrote: > > > > The documentation in this case is OK, though claims about how a future > > version will behave have a poor track record (we tend to end up with such > > claims persisting in the d

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-26 Thread Joseph Myers
On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > > What if the string is a wide string? I don't expect that to work (either > > as a matter of interface design, or in the present code), but I think that > > case should have a specific check and error. > > Dump question: how to check whe

[PATCH] Replace a HWI_COMPUTABLE_MODE_P with wide-int in simplify-rtx.cc.

2023-05-26 Thread Roger Sayle
This patch enhances one of the optimizations in simplify_binary_operation_1 to allow it to simplify RTL expressions in modes than HOST_WIDE_INT by replacing a use of HWI_COMPUTABLE_MODE_P and UINTVAL with wide_int. The motivating example is a pending x86_64 backend patch that produces the followi

Re: [PATCH v2] i386: Allow -mlarge-data-threshold with -mcmodel=large

2023-05-26 Thread Fangrui Song via Gcc-patches
On Fri, May 26, 2023 at 12:11 AM Jan Beulich wrote: > > On 25.05.2023 18:11, Fangrui Song wrote: > > On 2023-05-25, Jan Beulich wrote: > >> On 25.05.2023 17:16, Fangrui Song wrote: > >>> --- a/gcc/doc/invoke.texi > >>> +++ b/gcc/doc/invoke.texi > >>> @@ -32942,9 +32942,10 @@ the cache line size.

[committed][Patch] Fortran/OpenMP: Add parsing support for allocators/allocate directives

2023-05-26 Thread Tobias Burnus
I have now re-diffed the patch and cleaned up some comments, and spend some time proof reading it myself. And have now committed it as r14-1301-gd64e8e1224708e7f5b87c531aeb26f1ed07f91ff As the subject line states, it adds parsing support for "!$omp allocate" as declarative directive and (if prece

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-26 Thread Qing Zhao via Gcc-patches
Thank you for the suggestion. > On May 26, 2023, at 1:59 PM, Joseph Myers wrote: > > On Thu, 25 May 2023, Qing Zhao via Gcc-patches wrote: > >>> On May 25, 2023, at 4:51 PM, Joseph Myers wrote: >>> >>> The documentation in this case is OK, though claims about how a future >>> version will b

Re: [V1][PATCH 1/3] Provide element_count attribute to flexible array member field (PR108896)

2023-05-26 Thread Qing Zhao via Gcc-patches
> On May 26, 2023, at 2:15 PM, Joseph Myers wrote: > > On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > >>> What if the string is a wide string? I don't expect that to work (either >>> as a matter of interface design, or in the present code), but I think that >>> case should have a

[C PATCH] -Wstringop-overflow for parameters with forward-declared sizes

2023-05-26 Thread Martin Uecker via Gcc-patches
This is a minor change so that parameter that have forward declarations for with -Wstringop-overflow. Bootstrapped and regression tested on x86_64. c: -Wstringop-overflow for parameters with forward-declared sizes Warnings from -Wstringop-overflow do not appear for parameters d

[PATCH] PR target/107172: Avoid "unusual" MODE_CC comparisons in simplify-rtx.cc

2023-05-26 Thread Roger Sayle
I believe that a better (or supplementary) fix to PR target/107172 is to avoid producing incorrect (but valid) RTL in simplify_const_relational_operation when presented with questionable (obviously invalid) expressions, such as those produced during combine. Just as with the "first do no harm" cl

Re: [V8][PATCH 2/2] Update documentation to clarify a GCC extension [PR77650]

2023-05-26 Thread Joseph Myers
On Fri, 26 May 2023, Qing Zhao via Gcc-patches wrote: > Another question: is it better for me to rearrange the Patch 1/2 and Patch > 2/2 a little bit, > to put the FE , doc change and corresponding testing case together into one > patch, (you have approved the FE part of change in Patch 1/2).

Re: [C PATCH] -Wstringop-overflow for parameters with forward-declared sizes

2023-05-26 Thread Joseph Myers
On Fri, 26 May 2023, Martin Uecker via Gcc-patches wrote: > c: -Wstringop-overflow for parameters with forward-declared sizes > > Warnings from -Wstringop-overflow do not appear for parameters declared > as VLAs when the bound refers to a parameter forward declaration. This >

Re: [V1][PATCH 0/3] New attribute "element_count" to annotate bounds for C99 FAM(PR108896)

2023-05-26 Thread Kees Cook via Gcc-patches
On Thu, May 25, 2023 at 04:14:47PM +, Qing Zhao wrote: > GCC will pass the number of elements info from the attached attribute to both > __builtin_dynamic_object_size and bounds sanitizer to check the out-of-bounds > or dynamic object size issues during runtime for flexible array members. > >

[PATCH] c++: wrong error with static constexpr var in tmpl [PR109876]

2023-05-26 Thread Marek Polacek via Gcc-patches
Since r8-509, we'll no longer create a static temporary var for the initializer '{ 1, 2 }' for num in the attached test because the code in finish_compound_literal is now guarded by '&& fcl_context == fcl_c99' but it's fcl_functional here. This causes us to reject num as non-constant when evaluati

Re: [PATCH] RISC-V: Add missing torture-init and torture-finish for rvv.exp

2023-05-26 Thread Vineet Gupta
On 5/25/23 13:26, Thomas Schwinge wrote: I'm pasting a snippet of gcc.log. Issue is indeed triggered by rvv.exp which needs some love. I'd intentionally asked to "see a complete 'gcc.log' file where the ERRORs are visible". The full log files are humongous - even xz compressed is ~ 7 MB -

Re: [PATCH] c++: wrong error with static constexpr var in tmpl [PR109876]

2023-05-26 Thread Jason Merrill via Gcc-patches
On 5/26/23 19:18, Marek Polacek wrote: Since r8-509, we'll no longer create a static temporary var for the initializer '{ 1, 2 }' for num in the attached test because the code in finish_compound_literal is now guarded by '&& fcl_context == fcl_c99' but it's fcl_functional here. This causes us to

Re: [PATCH v2] i386: Allow -mlarge-data-threshold with -mcmodel=large

2023-05-26 Thread Jan Beulich via Gcc-patches
On 25.05.2023 18:11, Fangrui Song wrote: > On 2023-05-25, Jan Beulich wrote: >> On 25.05.2023 17:16, Fangrui Song wrote: >>> --- a/gcc/doc/invoke.texi >>> +++ b/gcc/doc/invoke.texi >>> @@ -32942,9 +32942,10 @@ the cache line size. @samp{compat} is the default. >>> >>> @opindex mlarge-data-thresho

[RFC][PATCH] Improve generating FMA by adding a widening_mul pass

2023-05-26 Thread Di Zhao OS via Gcc-patches
As GCC's reassociation pass does not have knowledge of FMA, when transforming expression lists to parallel, it reduces the opportunities to generate FMAs. Currently there's a workaround on AArch64 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84114), that is, to disable the parallelization with flo

[COMMITTED] ada: Enhance Is_Null_Range and Not_Null_Range predicates

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou Both predicates bail out if the bounds of the range are not known at compile time, whereas Compile_Time_Compare can deal with them in specific cases. gcc/ada/ * sem_eval.ads (Is_Null_Range): Remove requirements of compile-time known bounds and add WARNING lin

[COMMITTED] ada: Add missing guards in Selected_Range_Checks

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * checks.adb (Selected_Range_Checks): Add guards to protect calls to Expr_Value on bounds. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/checks.adb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/ada/checks.adb b/gcc/ada

[COMMITTED] ada: Clean style in expansion of array aggregates

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup only; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Build_Array_Aggr_Code): Change variable to constant. (Check_Same_Aggr_Bounds): Fix style; remove unused initial value. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc

[COMMITTED] ada: Fix another couple of unchecked conversions to Ada.Tags.Tag

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou They are problematic on platforms where the provenance of pointers must be tracked throughout their lifetime. gcc/ada/ * exp_sel.adb: Add clauses for Sem_Util, remove them for Opt, Sinfo and Sinfo.Nodes. (Build_K): Always use 'Tag of the object.

[COMMITTED] ada: Refine types for an accessibility-checking routine

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup related to work on expression functions for GNATprove (which require accessibility checks even when they are not expanded and thus have no explicit return statements). gcc/ada/ * accessibility.adb (Is_Formal_Of_Current_Function): This routine ex

[COMMITTED] ada: Fix late extra formals creation

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Ronan Desplanques Before this patch, in some situations, a subprogram call could be expanded before the extra formals for the subprogram were created. This patch fixes the problem in those situations. gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Create extra formals

[COMMITTED] ada: Handle new Controlling_Tag format when converting to SCIL

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Ghjuvan Lacambre This commit fixes two CodePeer crashes that were introduced when the format of the controlling tag changed. gcc/ada/ * exp_disp.adb (Expand_Dispatching_Call): Handle new Controlling_Tag. * sem_scil.adb (Check_SCIL_Node): Treat N_Object_Renaming_Declaration

[COMMITTED] ada: Fix missing finalization in library-level instance body

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This extends the delaying mechanism present in the cases where the instance is not at library level, so as to wait until after the instantiation of the body is performed, before generating the finalizer of the compilation unit. gcc/ada/ * einfo.ads (Delay_Cleanups):

[COMMITTED] ada: Use computed value from os_constants to define sigset_t

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Doug Rupp Remove hard coded definition and conform to standard usage of using computed os_constants for opaque type declarations. gcc/ada/ * libgnarl/s-osinte__qnx.ads (sigset_t): Modify declaration to use system.os_constants computed value. Align it. Tested on x8

[COMMITTED] ada: Use context variables in expansion of aggregates

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Build_Constrained_Type): Remove local constants that were shadowing equivalent global constants; replace a wrapper that calls Make_Integer_Literal with a numeric literal; remove

[COMMITTED] ada: Remove Is_Descendant_Of_Address flag from Standard_Address

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou It breaks the Allow_Integer_Address special mode. Add new standard_address parameters to gigi and alphabetize others, this is necessary when addresses are not treated like integers. gcc/ada/ * back_end.adb (Call_Back_End): Add gigi_standard_address to the si

[COMMITTED] ada: Remove redundant guards from handling of record components

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Call to First on empty list is intentionally returning Empty. gcc/ada/ * sem_util.adb (Gather_Components): Remove guard for empty list of components. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 7 +-- 1 file changed,

[COMMITTED] ada: Simplify expansion of positional aggregates

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_aggr.adb (Build_Constrained_Type): Use List_Length to count expressions in consecutive subaggregates. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_aggr.adb | 12 +++- 1 f

[COMMITTED] ada: Remove redundant protection against empty lists

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Calls to Length on No_List intentionally return 0, so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * sem_ch13.adb (Check_Component_List): Local variable Compl is now a constant; a nested block is no longer

[COMMITTED] ada: Duplicate declaration of _master entity

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * exp_ch9.adb (Build_Class_Wide_Master): Remember internal blocks that have a task master entity declaration. (Build_Master_Entity): Code cleanup. * sem_util.ads (Is_Internal_Block): New subprogram. * sem_util.adb (Is_Internal

[COMMITTED] ada: Crash on loop in dispatching conditional entry call

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda gcc/ada/ * exp_ch9.adb (Expand_N_Conditional_Entry_Call): Factorize code to avoid duplicating subtrees; required to avoid problems when the copied code has implicit labels. * sem_util.ads (New_Copy_Separate_List): Removed. (New

[COMMITTED] ada: Minor tweak in condition

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * sem_util.adb (Compile_Time_Constraint_Error): Test the Ekind. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb ind

[COMMITTED] ada: Reorder components in Ada.Containers.Restricted_Doubly_Linked_Lists

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou An instantiation of the package compiled with -gnatw.q yields: warning: in instantiation at a-crdlli.ads:317 [-gnatw.q] warning: record layout may cause performance issues [-gnatw.q] warning: in instantiation at a-crdlli.ads:317 [-gnatw.q] warning: component "No

[COMMITTED] ada: Simplify expansion of set membership

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch4.adb (Expand_Set_Membership): Simplify by using Evolve_Or_Else. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch4.adb | 17 +++-- 1 file changed, 7 insertions(+), 10 deleti

[COMMITTED] ada: Tune detection of expression functions within a declare expression

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_ch4.adb (Check_Action_OK): Replace low-level test with a high-level routine. * sem_ch13.adb (Is_Predicate_Static): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_

[COMMITTED] ada: Fix iteration over component items with pragmas

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Component items in a record declaration might include pragmas, which must be ignored when detecting components with default expressions. More a code cleanup than a bugfix, as it only affects artificial corner cases. Found while fixing missing legality checks for variant comp

[COMMITTED] ada: Cleanup expansion of membership operators into attribute Valid

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * exp_ch4.adb (Is_OK_Object_Reference): Replace loop with a call to Unqual_Conv; consequently, change object from variable to constant; replace an IF statement with an AND THEN expression. Tested on x8

[COMMITTED] ada: Minor doc clarification

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy Pattern Matching extension does not apply yet to case expressions. This is worth stating clearly, as this is a natural use of pattern matching to program in more functional style. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Be more explicit on pattern

[COMMITTED] ada: Fix handling of Global contracts inside generic subprograms

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Routine Get_Argument works differently for generic units (as explained in its comment), but it failed to reliably detect such units when their kind is temporarily made non-generic (for resolving recursive calls, as explained in the comment at the end of Is_Generic_Declaration

[COMMITTED] ada: Cleanups in handling of aggregates

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Assorted cleanups related to recent fixes of aggregate handling for GNATprove; semantics is unaffected. gcc/ada/ * sem_aggr.adb (Resolve_Record_Aggregate): Remove useless assignment. * sem_aux.adb (Has_Variant_Part): Remove useless guard; thi

[COMMITTED] ada: Fix internal error on Big_Integer conversion ghost instance

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The problem is that the ghost mode of the instance is used to analyze the parent of the generic body, whose own ghost mode has nothing to do with it. gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Set the ghost mode to that of the instance only after loa

[COMMITTED] ada: Default initialize entity to avoid CodePeer message

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy CodePeer issues a false alarm when reading local entity Component later if not initialized by default. Fix this. gcc/ada/ * sem_aggr.adb (Resolve_Record_Aggregate): Add dummy initialization and assertion that clarifies when we reassigned to a useful value. Tes

[COMMITTED] ada: Fix detection of non-static expressions in records with pragmas

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek When iterating over record components we must ignore pragmas. Minor bug, as pragmas within record components do not appear often. gcc/ada/ * sem_cat.adb (Check_Non_Static_Default_Expr): Detect components inside loop, not in the loop condition itself. Tested

[COMMITTED] ada: Simplify iteration over record component items with possible pragmas

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek Code cleanup; semantics is unaffected. gcc/ada/ * sem_util.adb (Is_Null_Record_Definition): Use First_Non_Pragma and Next_Non_Pragma to ignore pragmas within component list. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 6

[COMMITTED] ada: Fix typos "statment" and "condtion"

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff ...caused by moving code here from Atree. gcc/ada/ * einfo.ads: Add comma. * contracts.adb: Fix typos. * exp_attr.adb: Likewise. * exp_ch5.adb: Likewise. * exp_ch6.adb: Likewise. * lib-xref.adb: Likewise. Tested on x86_64-pc-linux-

[COMMITTED] ada: Reject thin 'Unrestricted_Access value to aliased constrained array

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This rejects the Unrestricted_Access attribute applied to an aliased array with a constrained nominal subtype when its type is resolved to be a thin pointer. The reason is that supporting this case would require the aliased array to contain its bounds, and this is the case on

[COMMITTED] ada: Fix crash on 'Img as generic actual function

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff 'Image is allowed as an actual for a generic formal function. This patch fixes a crash when 'Img is used instead of 'Image in that context. Misc cleanups. gcc/ada/ * exp_put_image.adb (Build_Image_Call): Treat 'Img the same as 'Image. * exp_imgv.adb (Expa

[COMMITTED] ada: Corrections to premature-references rules

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Bob Duff This patch corrects the implementation of RM-8.3(17), which says that a record extension is self-hidden until "record". Previously, such premature references could cause a compiler crash. gcc/ada/ * sem_ch3.adb (Build_Derived_Record_Type): Temporarily set the stat

[COMMITTED] ada: Reorder components in Ada.Containers.Bounded_Doubly_Linked_Lists

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou gcc/ada/ * libgnat/a-cbdlli.ads (List): Move Nodes component to the end. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-cbdlli.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/libgnat/a-cbdlli.ads b/gcc/ada/

[COMMITTED] ada: Remove leftover code for counting protected entries

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek We used to count protected entries by iterating over component declarations, but then switched to iterating over entities and left some code that is no longer needed. Cleanup; semantics is unaffected (maybe except fixing an assertion failure in developer builds when there is

Re: Re: decremnt IV patch create fails on PowerPC

2023-05-26 Thread juzhe.zh...@rivai.ai
Hi, Richi. Thanks for your analysis and helps. >> We could simply retain the original >> incrementing IV for loop control and add the decrementing >> IV for computing LEN in addition to that and leave IVOPTs >> sorting out to eventually merge them (or not). I am not sure how to do that. Could you

[COMMITTED] ada: Fix double free on finalization of Vector in array aggregate

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou The handling of finalization is delicate during the expansion of aggregates since the generated assignments must not cause the finalization of the RHS. That's why the No_Ctrl_Actions flag is set on them and the adjustments are generated manually. This was not done in the case

[COMMITTED] ada: Remove redundant guard against empty lists

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Piotr Trojanek There is no need to guard against routine Contains being called on No_Elist, because it will return False. Code cleanup related to handling of primitive operations in GNATprove; semantics is unaffected. gcc/ada/ * sem_prag.adb (Record_Possible_Body_Reference): Remov

[COMMITTED] ada: Complete contracts of SPARK units

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Yannick Moy SPARK units in the standard library (both Ada and GNAT ones) should have subprograms correctly annotated with contracts, so that a SPARK subprogram should always return (not fail or raise an exception) under the conditions expressed in its precondition, unless it is a procedure

[COMMITTED] ada: Crash on function returning allocated object containing tasks

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Javier Miranda The frontend crashes when a function returns an object of a limited type that may have task components, has discriminants, and the object is created with an allocator. gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): If an allocator with constraints is called

[COMMITTED] ada: Use truncation for dynamic conversions from floating point to fixed point

2023-05-26 Thread Marc Poulhiès via Gcc-patches
From: Eric Botcazou This changes the implementation of dynamic conversions from floating-point to ordinary fixed-point types, from rounding (to the nearest number) to truncation (toward zero), so as to make them consistent with both static conversions between these types and also the value of the

Re: [PATCH] RISC-V: Optimize TARGET_XTHEADCONDMOV

2023-05-26 Thread Philipp Tomsich
LGTM. Happy to move this forward, once it receives an OK from one of you. --Philipp. On Fri, 26 May 2023 at 02:53, Die Li wrote: > > This patch allows less instructions to be used when TARGET_XTHEADCONDMOV is > enabled. > > Provide an example from the existing testcases. > > Testcase: > int Co

Re: [i386 PATCH] A minor code clean-up: Use NULL_RTX instead of nullptr

2023-05-26 Thread Bernhard Reutner-Fischer via Gcc-patches
On Thu, 25 May 2023 18:58:04 +0200 Bernhard Reutner-Fischer wrote: > On Wed, 24 May 2023 18:54:06 +0100 > "Roger Sayle" wrote: > > > My understanding is that GCC's preferred null value for rtx is NULL_RTX > > (and for tree is NULL_TREE), and by being typed allows strict type checking, > > and u