[PATCH] libgccjit: Support getting the size of a float

2022-06-02 Thread Antoni Boucher via Gcc-patches
Hi. The attached patch fix bug 105829: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105829 Thanks for the review. From 5d75fd342cdcea94a785312252be0c0046afdf43 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 4 May 2022 21:42:44 -0400 Subject: [PATCH] libgccjit: Support getting the size

Re: [ping2][PATCH 0/8][RFC] Support BTF decl_tag and type_tag annotations

2022-06-02 Thread Yonghong Song via Gcc-patches
On 5/27/22 12:56 PM, David Faust wrote: On 5/26/22 00:29, Yonghong Song wrote: On 5/24/22 10:04 AM, David Faust wrote: On 5/24/22 09:03, Yonghong Song wrote: On 5/24/22 8:53 AM, David Faust wrote: On 5/24/22 04:07, Jose E. Marchesi wrote: On 5/11/22 11:44 AM, David Faust

Re: [PATCH] libgccjit: Fix infinite recursion in gt_ggc_mx_lang_tree_node

2022-06-02 Thread Andrew Pinski via Gcc-patches
On Thu, Jun 2, 2022 at 6:21 PM Antoni Boucher via Gcc-patches wrote: > > Hi. > The attached patch fix bug 105827: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105827 > > I'm not sure how to test this, so please share ideas. Looks like the attachment was removed ... > > Thanks for the review.

Re: [PATCH] libgccjit: Fix infinite recursion in gt_ggc_mx_lang_tree_node

2022-06-02 Thread Antoni Boucher via Gcc-patches
Sorry, forgot to attach the patch. Here it is. On Thu, 2022-06-02 at 21:20 -0400, Antoni Boucher via Jit wrote: > Hi. > The attached patch fix bug 105827: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105827 > > I'm not sure how to test this, so please share ideas. > > Thanks for the review.

[PATCH] libgccjit: Fix infinite recursion in gt_ggc_mx_lang_tree_node

2022-06-02 Thread Antoni Boucher via Gcc-patches
Hi. The attached patch fix bug 105827: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105827 I'm not sure how to test this, so please share ideas. Thanks for the review.

Re: Ping: [PATCH] Optimize vec_splats of constant V2DI/V2DF vec_extract, PR target/99293

2022-06-02 Thread Segher Boessenkool
On Thu, Jun 02, 2022 at 03:06:52PM -0400, Michael Meissner wrote: > Ping patch posted on May 13th: Are you not going to apply any of Will's suggestions? They looked solid to me. Segher

Re: [PATCH] c++: fix broken copy elision with nested TARGET_EXPRs [PR105550]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 5/26/22 11:01, Marek Polacek wrote: In this problem, we are failing to properly perform copy elision with a conditional operator, so this: constexpr A a = true ? A{} : A{}; fails with: error: 'A{((const A*)(&))}' is not a constant expression The whole initializer is TARGET_EXPR

Re: [PATCH v2] x86: {,v}psadbw have commutative source operands

2022-06-02 Thread Uros Bizjak via Gcc-patches
On Thu, Jun 2, 2022 at 5:00 PM Jan Beulich wrote: > > Like noticed for gas as well (binutils-gdb commit c8cad9d389b7), the > "absolute difference" aspect of the insns makes their source operands > commutative. > > gcc/ > > * config/i386/mmx.md (mmx_psadbw): Convert to expander. >

Re: [PATCH] c++: find_template_parameters and PARM_DECLs [PR105797]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/1/22 12:44, Patrick Palka wrote: As explained in r11-4959-gde6f64f9556ae3, the atom cache assumes two equivalent expressions (according to cp_tree_equal) must use the same template parameters (according to find_template_parameters). This assumption turned out to not hold for TARGET_EXPR,

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/2/22 16:33, Marek Polacek wrote: On Thu, Jun 02, 2022 at 04:26:27PM -0400, Jason Merrill wrote: On 6/2/22 16:10, Marek Polacek wrote: index 1346a1d4c10..2bbd8785627 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -9039,10 +9039,18 @@ potential_constant_expression_1 (tree t,

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Marek Polacek via Gcc-patches
On Thu, Jun 02, 2022 at 04:26:27PM -0400, Jason Merrill wrote: > On 6/2/22 16:10, Marek Polacek wrote: > > index 1346a1d4c10..2bbd8785627 100644 > > --- a/gcc/cp/constexpr.cc > > +++ b/gcc/cp/constexpr.cc > > @@ -9039,10 +9039,18 @@ potential_constant_expression_1 (tree t, bool > > want_rval,

Re: [PATCH] c++: cv-quals of dummy obj for non-dep memfn call [PR105637]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/2/22 15:57, Patrick Palka wrote: On Thu, 2 Jun 2022, Jason Merrill wrote: On 5/27/22 09:57, Patrick Palka wrote: On Thu, 26 May 2022, Patrick Palka wrote: On Thu, 26 May 2022, Jason Merrill wrote: On 5/26/22 14:57, Patrick Palka wrote: On Thu, 26 May 2022, Patrick Palka wrote:

Re: [PATCH] c++: value-dep but not type-dep decltype operand [PR105756]

2022-06-02 Thread Patrick Palka via Gcc-patches
On Thu, 2 Jun 2022, Jason Merrill wrote: > On 6/1/22 14:20, Patrick Palka wrote: > > r12-7564-gec0f53a3a542e7 made us instantiate non-constant non-dependent > > decltype operands by relaxing instantiate_non_dependent_expr to check > > instantiation_dependent_uneval_expression_p. But as the

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/2/22 16:10, Marek Polacek wrote: On Thu, Jun 02, 2022 at 03:42:15PM -0400, Jason Merrill wrote: On 6/2/22 10:03, Marek Polacek wrote: On Thu, Jun 02, 2022 at 08:42:36AM -0400, Patrick Palka wrote: On Wed, 1 Jun 2022, Marek Polacek via Gcc-patches wrote: Here we ICE because

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Marek Polacek via Gcc-patches
On Thu, Jun 02, 2022 at 03:42:15PM -0400, Jason Merrill wrote: > On 6/2/22 10:03, Marek Polacek wrote: > > On Thu, Jun 02, 2022 at 08:42:36AM -0400, Patrick Palka wrote: > > > On Wed, 1 Jun 2022, Marek Polacek via Gcc-patches wrote: > > > > > > > Here we ICE because value_dependent_expression_p

Re: [PATCH] c++: value-dep but not type-dep decltype operand [PR105756]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/1/22 14:20, Patrick Palka wrote: r12-7564-gec0f53a3a542e7 made us instantiate non-constant non-dependent decltype operands by relaxing instantiate_non_dependent_expr to check instantiation_dependent_uneval_expression_p. But as the testcase below demonstrates, this predicate is too

Re: [PATCH] c++: cv-quals of dummy obj for non-dep memfn call [PR105637]

2022-06-02 Thread Patrick Palka via Gcc-patches
On Thu, 2 Jun 2022, Jason Merrill wrote: > On 5/27/22 09:57, Patrick Palka wrote: > > On Thu, 26 May 2022, Patrick Palka wrote: > > > > > On Thu, 26 May 2022, Jason Merrill wrote: > > > > > > > On 5/26/22 14:57, Patrick Palka wrote: > > > > > On Thu, 26 May 2022, Patrick Palka wrote: > > > > >

Re: [PATCH] c++: don't substitute TEMPLATE_PARM_CONSTRAINT [PR100374]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/2/22 11:40, Patrick Palka wrote: On Tue, 31 May 2022, Jason Merrill wrote: On 5/31/22 08:56, Patrick Palka wrote: On Sun, 29 May 2022, Jason Merrill wrote: On 5/29/22 22:10, Jason Merrill wrote: On 5/27/22 14:05, Patrick Palka wrote: This makes us avoid substituting into the

[committed] diagnostics: add SARIF output format

2022-06-02 Thread David Malcolm via Gcc-patches
This patch adds support to gcc's diagnostic subsystem for emitting diagnostics in SARIF, aka the Static Analysis Results Interchange Format: https://sarifweb.azurewebsites.net/ by extending -fdiagnostics-format= to add two new options: -fdiagnostics-format=sarif-stderr and:

[committed] Add -fdiagnostics-format={json-stderr|json-file}

2022-06-02 Thread David Malcolm via Gcc-patches
This commit adds -fdiagnostics-format=json-file, writing to DUMP_BASE_NAME.gcc.json, and adds -fdiagnostics-format=json-stderr, a synonym for the existing -fdiagnostics-format=json. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-966-g5ab73173cca461.

Re: [PATCH] c++: cv-quals of dummy obj for non-dep memfn call [PR105637]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 5/27/22 09:57, Patrick Palka wrote: On Thu, 26 May 2022, Patrick Palka wrote: On Thu, 26 May 2022, Jason Merrill wrote: On 5/26/22 14:57, Patrick Palka wrote: On Thu, 26 May 2022, Patrick Palka wrote: Here we expect the calls to BaseClass::baseDevice resolve to the second, third and

[committed] json: fix escaping of '\'

2022-06-02 Thread David Malcolm via Gcc-patches
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r13-965-g4f9ad0b4b0a8c7. gcc/ChangeLog: * json.cc (string::print): Fix escaping of '\'. --- gcc/json.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/json.cc b/gcc/json.cc index

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 6/2/22 10:03, Marek Polacek wrote: On Thu, Jun 02, 2022 at 08:42:36AM -0400, Patrick Palka wrote: On Wed, 1 Jun 2022, Marek Polacek via Gcc-patches wrote: Here we ICE because value_dependent_expression_p gets a NEW_EXPR whose operand is a type, and we go to the default case which just

Re: [PATCH v2] RISC-V: bitmanip: improve constant-loading for (1ULL << 31) in DImode

2022-06-02 Thread Philipp Tomsich
OK for backport? On Thu, 2 Jun 2022 at 21:23, Philipp Tomsich wrote: > > Thanks, applied to trunk! > > On Thu, 2 Jun 2022 at 15:17, Kito Cheng wrote: > > > > LGTM > > > > On Mon, May 30, 2022 at 5:52 AM Philipp Tomsich > > wrote: > > > > > > The SINGLE_BIT_MASK_OPERAND() is overly restrictive,

Re: [PATCH v2] RISC-V: bitmanip: improve constant-loading for (1ULL << 31) in DImode

2022-06-02 Thread Philipp Tomsich
Thanks, applied to trunk! On Thu, 2 Jun 2022 at 15:17, Kito Cheng wrote: > > LGTM > > On Mon, May 30, 2022 at 5:52 AM Philipp Tomsich > wrote: > > > > The SINGLE_BIT_MASK_OPERAND() is overly restrictive, triggering for > > bits above 31 only (to side-step any issues with the negative SImode > >

[pushed] c++: more constexpr empty base [PR105795]

2022-06-02 Thread Jason Merrill via Gcc-patches
Following on from the previous patch, for trunk let's consistently set ctx->ctor to NULL_TREE for empty subobjects. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/105795 gcc/cp/ChangeLog: * constexpr.cc (init_subob_ctx): Clear ctx->ctor for empty subob.

[pushed] c++: constexpr empty aggr [PR105795]

2022-06-02 Thread Jason Merrill via Gcc-patches
In this testcase, leaving ctx->ctor pointing to the enclosing object meant that evaluating the initializer for the subobject clobbered previous initializers for the enclosing object. So do update ctx->ctor, just don't add it to the enclosing object ctor. Tested x86_64-pc-linux-gnu, applying to

Ping: [PATCH] Optimize vec_splats of constant V2DI/V2DF vec_extract, PR target/99293

2022-06-02 Thread Michael Meissner via Gcc-patches
Ping patch posted on May 13th: | Cate: Fri, 13 May 2022 10:49:26 -0400 | From: Michael Meissner | Subject: [PATCH] Optimize vec_splats of constant V2DI/V2DF vec_extract, PR target/99293 | Message-ID: -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email:

Re: [PATCH v3] RISC-V: Implement C[LT]Z_DEFINED_VALUE_AT_ZERO

2022-06-02 Thread Philipp Tomsich
Cherry picked from commit 16f7fcadac19dabd04a5abbe6601df52d22e9685 onto releases/gcc-12. On Thu, 2 Jun 2022 at 10:49, Kito Cheng wrote: > > OK to back port, thanks! > > On Thu, Jun 2, 2022 at 4:46 PM Philipp Tomsich > wrote: > > > > OK for backport? > > > > Thanks, > > Phil. > > > > On Fri, 13

Re: [PATCH] c++: cv-quals of dummy obj for non-dep memfn call [PR105637]

2022-06-02 Thread Patrick Palka via Gcc-patches
On Fri, 27 May 2022, Patrick Palka wrote: > On Thu, 26 May 2022, Patrick Palka wrote: > > > On Thu, 26 May 2022, Jason Merrill wrote: > > > > > On 5/26/22 14:57, Patrick Palka wrote: > > > > On Thu, 26 May 2022, Patrick Palka wrote: > > > > > > > > > Here we expect the calls to

[PATCH][WIP] have configure probe prefix for gmp/mpfr/mpc [PR44425]

2022-06-02 Thread Eric Gallager via Gcc-patches
So, I'm working on fixing PR bootstrap/44425, and have this patch to have the top-level configure script check in the value passed to `--prefix=` when looking for gmp/mpfr/mpc. It "works" (in that configuring with just `--prefix=` and none of `--with-gmp=`/`--with-mpfr=`/`--with-mpc=` now works

Re: [PATCH] c++: don't substitute TEMPLATE_PARM_CONSTRAINT [PR100374]

2022-06-02 Thread Patrick Palka via Gcc-patches
On Tue, 31 May 2022, Jason Merrill wrote: > On 5/31/22 08:56, Patrick Palka wrote: > > On Sun, 29 May 2022, Jason Merrill wrote: > > > > > On 5/29/22 22:10, Jason Merrill wrote: > > > > On 5/27/22 14:05, Patrick Palka wrote: > > > > > This makes us avoid substituting into the

[PATCH] configure: arrange to use appropriate objcopy

2022-06-02 Thread Jan Beulich via Gcc-patches
Using the system objcopy is wrong when other configure checks have probed a different set of binutils (I've noticed the problem on a system where the base objcopy can't deal with compressed debug sections). Arrange for the matching one to be picked up, first and foremost if an "in tree" one is

[PATCH] x86-64: make "length_vex" also account for VEX.B use by register operand

2022-06-02 Thread Jan Beulich via Gcc-patches
The length attribute ought to be "the (bounding maximum) length of an instruction" according to the comment next to its definition. A register operand encoded using the ModR/M.rm field will additionally use VEX.B for encoding the highest bit of the register number. Hence for the high 8 GPR

[PATCH] x86: harmonize __builtin_ia32_psadbw*() types

2022-06-02 Thread Jan Beulich via Gcc-patches
The 64-bit, 128-bit, and 512-bit variants have VDI return type, in line with instruction behavior. Make the 256-bit builtin match, thus also making it match the insn it expands to (using VI8_AVX2_AVX512BW). gcc/ * config/i386/i386-builtin.def (__builtin_ia32_psadbw256): Change

[PATCH v2] x86: {,v}psadbw have commutative source operands

2022-06-02 Thread Jan Beulich via Gcc-patches
Like noticed for gas as well (binutils-gdb commit c8cad9d389b7), the "absolute difference" aspect of the insns makes their source operands commutative. gcc/ * config/i386/mmx.md (mmx_psadbw): Convert to expander. (*mmx_psadbw): New. Mark as commutative. *

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Marek Polacek via Gcc-patches
On Thu, Jun 02, 2022 at 08:42:36AM -0400, Patrick Palka wrote: > On Wed, 1 Jun 2022, Marek Polacek via Gcc-patches wrote: > > > Here we ICE because value_dependent_expression_p gets a NEW_EXPR > > whose operand is a type, and we go to the default case which just > > calls v_d_e_p on each operand

Re: [PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (stype)0) [PR105777]

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, 2 Jun 2022, Jakub Jelinek wrote: > Hi! > > The following patch is an incremental change to the PR30314 enhancement, > this one handles signed types. > For signed types (but still, the same for 1st and result element type > and non-zero constant that fits into that type), we actually need

Re: [PATCH v2] RISC-V: bitmanip: improve constant-loading for (1ULL << 31) in DImode

2022-06-02 Thread Kito Cheng via Gcc-patches
LGTM On Mon, May 30, 2022 at 5:52 AM Philipp Tomsich wrote: > > The SINGLE_BIT_MASK_OPERAND() is overly restrictive, triggering for > bits above 31 only (to side-step any issues with the negative SImode > value 0x8000/(-1ull << 31)/(1 << 31)). This moves the special > handling of this

[PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (stype)0) [PR105777]

2022-06-02 Thread Jakub Jelinek via Gcc-patches
Hi! The following patch is an incremental change to the PR30314 enhancement, this one handles signed types. For signed types (but still, the same for 1st and result element type and non-zero constant that fits into that type), we actually need to watch for overflow in direction to positive and

Re: [PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-02 Thread Patrick Palka via Gcc-patches
On Wed, 1 Jun 2022, Marek Polacek via Gcc-patches wrote: > Here we ICE because value_dependent_expression_p gets a NEW_EXPR > whose operand is a type, and we go to the default case which just > calls v_d_e_p on each operand of the NEW_EXPR. Since one of them > is a type, we crash on the new

Re: [PATCH] Fold truncations of left shifts in match.pd

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 12:55 PM Roger Sayle wrote: > > > Hi Richard, > > + /* RTL expansion knows how to expand rotates using shift/or. */ if > > + (icode == CODE_FOR_nothing > > + && (code == LROTATE_EXPR || code == RROTATE_EXPR) > > + && optab_handler (ior_optab, vec_mode) !=

Re: [PATCH/RFC] cprop_hardreg... Third time's a charm.

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 12:20 PM Roger Sayle wrote: > > > > This middle-end patch proposes the "hard register constant propagation" > > pass be performed up to three times on each basic block (up from the > > current two times) if the second pass successfully made changes. > > > > The motivation

RE: [PATCH] Fold truncations of left shifts in match.pd

2022-06-02 Thread Roger Sayle
Hi Richard, > + /* RTL expansion knows how to expand rotates using shift/or. */ if > + (icode == CODE_FOR_nothing > + && (code == LROTATE_EXPR || code == RROTATE_EXPR) > + && optab_handler (ior_optab, vec_mode) != CODE_FOR_nothing > + && optab_handler (ashl_optab, vec_mode) !=

[PATCH/RFC] cprop_hardreg... Third time's a charm.

2022-06-02 Thread Roger Sayle
This middle-end patch proposes the "hard register constant propagation" pass be performed up to three times on each basic block (up from the current two times) if the second pass successfully made changes. The motivation for three passes is to handle the "swap idiom" (i.e. t = x; x = y;

Re: [PATCH] Introduce -finstrument-functions-once

2022-06-02 Thread Richard Biener via Gcc-patches
On Tue, May 24, 2022 at 12:49 PM Eric Botcazou via Gcc-patches wrote: > > Hi, > > some time ago we were requested to implement a -finstrument-functions-once > switch in the compiler, with the semantics that the profiling functions be > called only once per instrumented function. The goal was to

Re: [x86 PATCH] Add peephole2 to reduce double word register shuffling.

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 11:48 AM Uros Bizjak via Gcc-patches wrote: > > On Thu, Jun 2, 2022 at 9:20 AM Roger Sayle wrote: > > > > The simple test case below demonstrates an interesting register > > allocation challenge facing x86_64, imposed by ABI requirements > > on int128. > > > > __int128

Re: [PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, 2 Jun 2022, Jakub Jelinek wrote: > On Thu, Jun 02, 2022 at 08:36:42AM +, Richard Biener wrote: > > > --- gcc/match.pd.jj 2022-06-01 13:54:32.000654151 +0200 > > > +++ gcc/match.pd 2022-06-01 15:13:35.473084402 +0200 > > > @@ -5969,6 +5969,17 @@ (define_operator_list

Re: [x86 PATCH] Add peephole2 to reduce double word register shuffling.

2022-06-02 Thread Uros Bizjak via Gcc-patches
On Thu, Jun 2, 2022 at 11:32 AM Uros Bizjak wrote: > > On Thu, Jun 2, 2022 at 9:20 AM Roger Sayle wrote: > > > > The simple test case below demonstrates an interesting register > > allocation challenge facing x86_64, imposed by ABI requirements > > on int128. > > > > __int128 foo(__int128 x,

Re: [x86 PATCH] Add peephole2 to reduce double word register shuffling.

2022-06-02 Thread Uros Bizjak via Gcc-patches
On Thu, Jun 2, 2022 at 9:20 AM Roger Sayle wrote: > > The simple test case below demonstrates an interesting register > allocation challenge facing x86_64, imposed by ABI requirements > on int128. > > __int128 foo(__int128 x, __int128 y) > { > return x+y; > } > > For which GCC currently

Re: [x86 PATCH] Add peephole2 to reduce double word register shuffling.

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 9:21 AM Roger Sayle wrote: > > The simple test case below demonstrates an interesting register > allocation challenge facing x86_64, imposed by ABI requirements > on int128. > > __int128 foo(__int128 x, __int128 y) > { > return x+y; > } > > For which GCC currently

Re: [PATCH] [PR105665] ivopts: check defs of names in base for undefs

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 9:10 AM Alexandre Oliva wrote: > > On Jun 1, 2022, Alexandre Oliva wrote: > > > Now I'm thinking we can go for an even stricter predicate to disable > > the optimization: if a non-PHI use of a maybe-undefined dominates the > > loop, then we can still perform the

Re: [PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]

2022-06-02 Thread Jakub Jelinek via Gcc-patches
On Thu, Jun 02, 2022 at 08:36:42AM +, Richard Biener wrote: > > --- gcc/match.pd.jj 2022-06-01 13:54:32.000654151 +0200 > > +++ gcc/match.pd2022-06-01 15:13:35.473084402 +0200 > > @@ -5969,6 +5969,17 @@ (define_operator_list SYNC_FETCH_AND_AND > > && (!TYPE_UNSIGNED (TREE_TYPE

Re: [PATCH] Simplify (B * v + C) * D -> BD* v + CD when B, C, D are all INTEGER_CST.

2022-06-02 Thread Richard Biener via Gcc-patches
On Thu, Jun 2, 2022 at 3:10 AM liuhongt via Gcc-patches wrote: > > Similar for (v + B) * C + D -> C * v + BCD. > Don't simplify it when there's overflow and overflow is UB for type v. > > There's new failure > > gcc.dg/vect/slp-11a.c scan-tree-dump-times vect "vectorizing stmts using SLP" > 0 > >

[Ada] Fix record layout warnings not being tagged

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This allows tools ingesting GNAT's output to properly classify these messages. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (warn_on_field_placement): Add insertion character '.q' to warning string.diff --git a/gcc/ada/gcc-interface/decl.cc

[Ada] Disable -flto when building the shared libgnat

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This setting isn't useful in this context. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/Makefile.in (gnatlib-shared-default): Add -fno-lto.diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in ---

[Ada] Couple of small preparatory adjustments

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Do not check the scope of anonymous access Itypes. * gcc-interface/trans.cc (Identifier_to_gnu): Do not translate the return type of a

[Ada] Restore full generation of static dispatch tables with -gnatzr

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
The -gnatzr switch triggers the creation of distribution stubs for use by the implementation of PolyORB. Now these stubs declare tagged types and are generated at the very end of the analysis of compilation units, after the static dispatch tables have been built, so these tables are missing for

[Ada] Never make symbols for thunks public

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Thunks are only referenced locally by dispatch tables and never inlined. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Clear the Is_Public flag on thunks.diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb ---

[Ada] Get rid of secondary stack for most calls returning tagged types

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This eliminates the use of the secondary stack to return specific tagged types from functions in calls that are not dispatching on result, which comprises returning controlled types, by introducing thunks whose only purpose is to move the result from the primary to the secondary stack for

[Ada] Remove redundant checks for missing lists

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
When iterating over list elements with First/Next there is no need to check if the list is present, because First intentionally returns Empty if list is not present and the condition of subsequent loop will not be satisfied. Code cleanup; semantics is unaffected. Occurrences of the redundant

[Ada] Fix references to old variables that have been refactored

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Local_Entity_Suppress and Global_Entity_Suppress variables referencing tables were refactored to Local_Suppress_Stack_Top and Global_Suppress_Stack_Top stacks back in 2007. Fix remaining references to these variables. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ *

[Ada] Make the functional Maps and Sets unbounded

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Before this patch, the Functional Sets ans Maps were bounded both from the user and the implementation points of view. To make them closer to mathematical Sets ans Maps, this patch removes the bounds from the contracts. Note that, in practice, they are still bounded by Count_Type'Last, even if

[Ada] Rename GNATprove annotate pragma for termination to Always_Return

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
GNATprove changed the name of the pragma Annotate used to verify that a subprogram always returns normally. It is now called Always_Return instead of Terminating. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-aridou.adb: Use Always_Return instead of Terminating

[Ada] Fix spurious use of trampolines with interface types

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Function pointers must always be built with '[Unrestricted_]Access. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch3.adb (Init_Secondary_Tags.Initialize_Tag): Initialize the Offset_Func component by means of 'Unrestricted_Access.diff --git

[Ada] Add precise subprogram identification to -fdiagnostics-format=json

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This commit adds information allowing identification of the subprogram surrounding the message emitted by gnat when using -gnatdJ along with -fdiagnostics-format=json. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * errout.adb (Write_JSON_Span): Add subprogram name to

[Ada] Refine previous changes on making symbols public/private

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Inline_Always procedures should be kept public for proper inter unit inlining. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch7.adb (Set_Referencer_Of_Non_Subprograms): New local procedure, used for code refactoring. Also take into account

[Ada] Fix spurious errors on ghost code in generics

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
After the recent fix for detecting illegal use of ghost entities in code, spurious errors could be raised on generic code with ghost, due to wrong setting of the ghost flags on copied entities from the generic to the instantiation. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Move registering code for predefined primitives to Exp_Disp

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This avoids making Expand_Interface_Thunk visible from the outside. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch6.adb (Freeze_Subprogram.Register_Predefined_DT_Entry): Move procedure to... * exp_disp.ads

[Ada] Build static dispatch tables always at the end of declarative part

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
The static dispatch tables of library-level tagged types are either built on the first object declaration or at the end of the declarative part of the package spec or body. There is no real need for the former case, and the tables are not built for other constructs that freeze (tagged) types.

[Ada] vx7r2-arm/aarch64 - Support Atomic Primitives True

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This feature is an architecture feature, not an OS feature, so enable on vx7r2 for arm and aarch64 to coincide with what is done on similarly capable targets. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/system-vxworks7-arm.ads (Support_Atomic_Primitives):

[Ada] Update documentation of GNAT.Dynamic_Tables

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Document that dynamic tables are defined aliased for backward compatibility. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/g-dyntab.ads (Table_Type): Update documentation.diff --git a/gcc/ada/libgnat/g-dyntab.ads b/gcc/ada/libgnat/g-dyntab.ads ---

[Ada] Fix detection of deferred constants for freezing error

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Testing Is_Frozen is not robust enough, so instead test that the full view has been seen and that the Has_Completion flag is set on it. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * freeze.adb (Check_Expression_Function.Find_Constant): Make test for deferred

[Ada] Fix preconditions of Interfaces.C.Strings

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Preconditions of Update procedures were always true when Offset was 0. The changes enable to protect from Update_Error when Offset is 0. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/i-cstrin.ads (Update): Update precondition.diff --git

[Ada] Issue errors on wrong context for ghost entities

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
References to ghost entities should only occur in ghost context. This was not checked systematically on all references. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch2.adb (Analyze_Identifier): Add checking for ghost context. * sem_ch5.adb

[Ada] Complete contracts of Interfaces.C.Strings subprograms

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This patch adds preconditions to Update procedures, to protect from Update_Error propagations. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/i-cstrin.ads (Update): Add precondition.diff --git a/gcc/ada/libgnat/i-cstrin.ads b/gcc/ada/libgnat/i-cstrin.ads ---

[Ada] Propagate Has_Inherit{able,ed}_Invariants to base types

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
The two flags apply to base types only like Has_Own_Invariants. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Propagate_DIC_Attributes): Add ??? comment. (Propagate_Invariant_Attributes): Likewise. Propagate the Has_Inheritable_Invariants

[Ada] Combine system.ads files - arm and aarch64 linux

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/system-linux-arm.ads (Memory_Size): Compute based on Word_Size.diff --git

[Ada] Combine system.ads file - vxworks7 rtp constants

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/system-vxworks7-aarch64-rtp-smp.ads (Word_Size): Compute based on

[Ada] Gnatbind crash during checksum calculation

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This patch corrects an error in the compiler whereby gnatbind may crash during calculation of file checksums in certain corner cases due to uninitialized lookup tables. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnatbind.adb (Gnatbind): Add initialize call for Uintp

[Ada] Fix iteration on formal vectors

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
We need to use Extended_Index for the Position parameter of the Element function in formal vectors so it is compatible with other primitives of the Iterable aspect. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cfinve.ads (Element): Change the type of the

[Ada] Add contracts to System.Address_To_Access_Conversions

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This patch adds SPARK annotations to subprograms from System.Address_To_Access_Conversions. To_Pointer is considered to have no global items, if the returned value has no aliases. To_Address is forbidden in SPARK because addresses are not handled. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Add contracts to Interfaces.C.Strings

2022-06-02 Thread Pierre-Marie de Rodat via Gcc-patches
This patch adds Global contracts and preconditions to subprograms of Interfaces.C.Strings. Effects on allocated memory are modelled through an abstract state, C_Memory. The preconditions protect against Dereference_Error, but not Storage_Error (which is not handled by SPARK). This patch also

Re: [PATCH v2, rs6000] Fix ICE on expand bcd__ [PR100736]

2022-06-02 Thread Segher Boessenkool
Hi! On Thu, Jun 02, 2022 at 01:30:04PM +0800, HAO CHEN GUI wrote: > Segher, > Does BCD comparison return false when either operand is invalid coding? It sets all of LT, GT, and EQ to 0 (it normally sets exactly one of them to 1). It sets bit 3 (the "SO" bit usually) to 1. That is what the

Re: [PATCH v3] RISC-V: Implement C[LT]Z_DEFINED_VALUE_AT_ZERO

2022-06-02 Thread Kito Cheng via Gcc-patches
OK to back port, thanks! On Thu, Jun 2, 2022 at 4:46 PM Philipp Tomsich wrote: > > OK for backport? > > Thanks, > Phil. > > On Fri, 13 May 2022 at 22:23, Philipp Tomsich > wrote: > > > Added the two nits from Kito's review and … Applied to trunk! > > > > > > On Fri, 13 May 2022 at 22:16,

Re: [PATCH] Fold truncations of left shifts in match.pd

2022-06-02 Thread Richard Biener via Gcc-patches
On Mon, May 30, 2022 at 2:24 PM Roger Sayle wrote: > > > Whilst investigating PR 55278, I noticed that the tree-ssa optimizers > aren't eliminating the promotions of shifts to "int" as inserted by the > c-family front-ends, instead leaving this simplification to be left to > the RTL optimizers.

Re: [PATCH v3] RISC-V: Implement C[LT]Z_DEFINED_VALUE_AT_ZERO

2022-06-02 Thread Philipp Tomsich
OK for backport? Thanks, Phil. On Fri, 13 May 2022 at 22:23, Philipp Tomsich wrote: > Added the two nits from Kito's review and … Applied to trunk! > > > On Fri, 13 May 2022 at 22:16, Philipp Tomsich > wrote: > > > > The Zbb support has introduced ctz and clz to the backend, but some > >

Re: [PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]

2022-06-02 Thread Richard Biener via Gcc-patches
On Wed, 1 Jun 2022, Jakub Jelinek wrote: > Hi! > > A comparison with a constant is most likely always faster than > .MUL_OVERFLOW from which we only check whether it overflowed and not the > multiplication result, and even if not, it is simpler operation on GIMPLE > and even if a target exists

Re: [PATCH] i386: Optimize away shift count masking of shifts/rotates some more [PR105778]

2022-06-02 Thread Uros Bizjak via Gcc-patches
On Thu, Jun 2, 2022 at 10:00 AM Jakub Jelinek wrote: > > Hi! > > As the following testcase shows, our x86 backend support for optimizing > out useless masking of shift/rotate counts when using instructions > that naturally modulo the count themselves is insufficient. > The *_mask

[PATCH] i386: Optimize away shift count masking of shifts/rotates some more [PR105778]

2022-06-02 Thread Jakub Jelinek via Gcc-patches
Hi! As the following testcase shows, our x86 backend support for optimizing out useless masking of shift/rotate counts when using instructions that naturally modulo the count themselves is insufficient. The *_mask define_insn_and_split patterns use (subreg:QI (and:SI (match_operand:SI)

Re: [PATCH] x86-64: Remove HAVE_LD_PIE_COPYRELOC

2022-06-02 Thread Fāng-ruì Sòng via Gcc-patches
On Sun, Oct 31, 2021 at 7:36 PM Fāng-ruì Sòng wrote: > > On Fri, Oct 8, 2021 at 10:57 AM Fāng-ruì Sòng wrote: > > > > On Fri, Sep 24, 2021 at 11:29 AM H.J. Lu wrote: > > > > > > On Fri, Sep 24, 2021 at 11:14 AM Fāng-ruì Sòng wrote: > > > > > > > > On Fri, Sep 24, 2021 at 10:41 AM H.J. Lu

[PATCH] Add instruction level discriminator support.

2022-06-02 Thread Eugene Rozenfeld via Gcc-patches
This is the first in a series of patches to enable discriminator support in AutoFDO. This patch switches to tracking discriminators per statement/instruction instead of per basic block. Tracking per basic block was problematic since not all statements in a basic block needed a discriminator and,

[x86 PATCH] Add peephole2 to reduce double word register shuffling.

2022-06-02 Thread Roger Sayle
The simple test case below demonstrates an interesting register allocation challenge facing x86_64, imposed by ABI requirements on int128. __int128 foo(__int128 x, __int128 y) { return x+y; } For which GCC currently generates the unusual sequence: movq%rsi, %rax movq

Re: [PATCH] [PR105665] ivopts: check defs of names in base for undefs

2022-06-02 Thread Alexandre Oliva via Gcc-patches
On Jun 1, 2022, Alexandre Oliva wrote: > Now I'm thinking we can go for an even stricter predicate to disable > the optimization: if a non-PHI use of a maybe-undefined dominates the > loop, then we can still perform the optimization: Here it is. [PR105665] ivopts: check defs of names in base

Re: [x86_64 PATCH] PR target/105791: Add V1TI to V_128_256 for xop_pcmov_v1ti.

2022-06-02 Thread Hongtao Liu via Gcc-patches
On Thu, Jun 2, 2022 at 2:24 PM Roger Sayle wrote: > > > This patch resolves PR target/105791 which is a regression that was > accidentally introduced for my workaround to PR tree-optimization/10566. > (a deeper problem in GCC's vectorizer creating VEC_COND_EXPR when it > shouldn't). The latest

[PATCH] tree-optimization/105802 - another unswitching type issue

2022-06-02 Thread Richard Biener via Gcc-patches
This also fixes the type of the irange used for unswitching of switch statements. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/105802 * tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb): Make sure to also compute the range

[x86_64 PATCH] PR target/105791: Add V1TI to V_128_256 for xop_pcmov_v1ti.

2022-06-02 Thread Roger Sayle
This patch resolves PR target/105791 which is a regression that was accidentally introduced for my workaround to PR tree-optimization/10566. (a deeper problem in GCC's vectorizer creating VEC_COND_EXPR when it shouldn't). The latest issues is that by providing a vcond_mask_v1tiv1ti pattern in