Re: [PATCH] v2: small _BitInt tweaks

2023-09-19 Thread Richard Biener via Gcc-patches
On Tue, 19 Sep 2023, Jakub Jelinek wrote: > Hi! > > On Tue, Sep 12, 2023 at 05:27:30PM +, Joseph Myers wrote: > > On Tue, 12 Sep 2023, Jakub Jelinek via Gcc-patches wrote: > > > > > And by ensuring we never create 1-bit signed BITINT_TYPE e.g. the backends > > > don't need to worry about

Re: LTO: Get rid of 'lto_mode_identity_table' (was: Machine Mode ICE in RISC-V when LTO)

2023-09-18 Thread Richard Biener via Gcc-patches
On Mon, Sep 18, 2023 at 4:46 PM Thomas Schwinge wrote: > > Hi! > > On 2023-09-15T15:33:59+0200, Robin Dapp wrote: > > is there anything we can do to assist from the riscv side in order to help > > with this? I haven't really been involved with it but was wondering > > what's missing. If I

Re: [PATCH] MATCH: Avoid recusive zero_one_valued_p for conversions

2023-09-18 Thread Richard Biener via Gcc-patches
On Sun, Sep 17, 2023 at 3:45 AM Andrew Pinski via Gcc-patches wrote: > > So when VN finds a name which has a nop conversion, it says > both names are equivalent to each other and the valuaization > function for one will return the other. This normally does not > cause any issues as there is no

Re: [PATCH] MATCH: Make zero_one_valued_p non-recusive fully

2023-09-18 Thread Richard Biener via Gcc-patches
On Sun, Sep 17, 2023 at 11:41 PM Andrew Pinski via Gcc-patches wrote: > > So it turns out VN can't handle any kind of recusion for match. In this > case we have `b = a & -1` and we try to match a as being zero_one_valued_p > and VN returns b as being the value and we just go into an infinite loop

Re: [PATCH/RFC 08/10] aarch64: Don't use CEIL for vector_store in aarch64_stp_sequence_cost

2023-09-18 Thread Richard Biener via Gcc-patches
On Mon, Sep 18, 2023 at 10:41 AM Richard Sandiford wrote: > > Kewen Lin writes: > > This costing adjustment patch series exposes one issue in > > aarch64 specific costing adjustment for STP sequence. It > > causes the below test cases to fail: > > > > -

Re: [PATCH] tree-optimization/111294 - backwards threader PHI costing

2023-09-18 Thread Richard Biener via Gcc-patches
On Mon, 18 Sep 2023, Jakub Jelinek wrote: > On Thu, Sep 14, 2023 at 01:23:13PM +0000, Richard Biener via Gcc-patches > wrote: > > diff --git a/libgomp/team.c b/libgomp/team.c > > index 54dfca8080a..e5a86de1dd0 100644 > > --- a/libgomp/team.c > > +++ b/libgo

Re: [PATCH] Trivial typo fix in variadic

2023-09-18 Thread Richard Biener via Gcc-patches
On Sun, Sep 17, 2023 at 9:47 PM Marc Poulhiès via Gcc-patches wrote: > > Fix all occurences of varadic, except for Rust (will be part of another > change). OK. > gcc/ChangeLog: > > * config/nvptx/nvptx.h (struct machine_function): Fix typo in > variadic. > *

Re: [PATCH] MATCH: Add simplifications of `(a == CST) & a`

2023-09-18 Thread Richard Biener via Gcc-patches
On Sat, Sep 16, 2023 at 6:00 PM Andrew Pinski via Gcc-patches wrote: > > `(a == CST) & a` can be either simplified to simplying `a == CST` > or 0 depending on the first bit of the CST. > This is an extension of the already pattern of `X & !X` and allows > us to remove the 2 xfails on

Re: [PATCH] MATCH: Add simplifications for `(a * zero_one) ==/!= CST`

2023-09-18 Thread Richard Biener via Gcc-patches
On Sat, Sep 16, 2023 at 7:50 AM Andrew Pinski via Gcc-patches wrote: > > Transforming `(a * b@[0,1]) != 0` into `((cast)b) & a != 0` that isn't strictly a simplification (one more op), and your alternate transform is even worse in this regard. > will produce better code as a lot of the time b

Re: [PATCH] gcc: Introduce -fhardened

2023-09-18 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 5:09 PM Marek Polacek via Gcc-patches wrote: > > Bootstrapped/regtested on x86_64-pc-linux-gnu, powerpc64le-unknown-linux-gnu, > and aarch64-unknown-linux-gnu; ok for trunk? > > -- >8 -- > In > I proposed

Re: [PATCH] [RFC] New early __builtin_unreachable processing.

2023-09-18 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 4:45 PM Andrew MacLeod wrote: > > Ive been looking at __builtin_unreachable () regressions. The > fundamental problem seems to be a lack of consistent expectation for > when we remove it earlier than the final pass of VRP.After looking > through them, I think this

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-15 Thread Richard Biener via Gcc-patches
> Am 15.09.2023 um 17:37 schrieb Qing Zhao : > >  > >>> On Sep 15, 2023, at 11:29 AM, Richard Biener >>> wrote: >>> >>> >>> Am 15.09.2023 um 17:25 schrieb Qing Zhao : >>> >>>  >>> On Sep 15, 2023, at 8:41 AM, Arsen Arsenović wrote: Qing Zhao writes:

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-15 Thread Richard Biener via Gcc-patches
> Am 15.09.2023 um 17:25 schrieb Qing Zhao : > >  > >> On Sep 15, 2023, at 8:41 AM, Arsen Arsenović wrote: >> >> >> Qing Zhao writes: >> >>> Even though unsigned integer overflow is well defined, it might be >>> unintentional, shall we warn user about this? >> >> This would be better

Re: [WIP] Re-introduce 'TREE_USED' in tree streaming

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 3:05 PM Richard Biener wrote: > > On Fri, Sep 15, 2023 at 3:01 PM Thomas Schwinge > wrote: > > > > Hi! > > > > On 2023-09-15T12:11:44+0200, Richard Biener via Gcc-patches > > wrote: > > > On Fri, Sep 15, 2023 at 1

Re: [WIP] Re-introduce 'TREE_USED' in tree streaming

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 3:01 PM Thomas Schwinge wrote: > > Hi! > > On 2023-09-15T12:11:44+0200, Richard Biener via Gcc-patches > wrote: > > On Fri, Sep 15, 2023 at 11:20 AM Thomas Schwinge > > wrote: > >> Now, that was another qu

[PATCH][RFC] middle-end/106811 - document GENERIC/GIMPLE undefined behavior

2023-09-15 Thread Richard Biener via Gcc-patches
The following attempts to provide a set of conditions GENERIC/GIMPLE considers invoking undefined behavior, leaning on the C standards Annex J, as to provide portability guidance to language frontend developers. I've both tried to remember cases we exploit undefined behavior and went over C2x

Re: [WIP] Re-introduce 'TREE_USED' in tree streaming

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 11:20 AM Thomas Schwinge wrote: > > Hi! > > Now, that was another quirky debug session: in > 'gcc/omp-low.cc:create_omp_child_function' we clearly do set > 'TREE_USED (t) = 1;' for '.omp_data_i', which ends up as formal parameter > for outlined '[...]._omp_fn.[...]'

Re: [PATCH] test: Block SLP check of slp-34.c for vect_strided5

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > Since RISC-V use vsseg5 which is the vect_store_lanes with stride 5 > if failed on RISC-V. OK. > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/slp-34.c: Block check for vect_strided5. > > --- > gcc/testsuite/gcc.dg/vect/slp-34.c | 2 +- > 1 file

Re: [PATCH] test: Block SLP check of slp-35.c for vect_strided5

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > gcc/testsuite/ChangeLog: OK. > * gcc.dg/vect/slp-35.c: Block SLP check for vect_strided5 targets. > > --- > gcc/testsuite/gcc.dg/vect/slp-35.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH] test: Block vect_strided5 for slp-34-big-array.c SLP check

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > If failed on RISC-V since it use vect_store_lanes with array 5. OK. > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/slp-34-big-array.c: Block SLP check for vect_strided5. > > --- > gcc/testsuite/gcc.dg/vect/slp-34-big-array.c | 2 +- > 1 file

Re: [PATCH] test: Isolate slp-1.c check of target supports vect_strided5

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > This test failed in RISC-V: > FAIL: gcc.dg/vect/slp-1.c -flto -ffat-lto-objects scan-tree-dump-times vect > "vectorizing stmts using SLP" 4 > FAIL: gcc.dg/vect/slp-1.c scan-tree-dump-times vect "vectorizing stmts using > SLP" 4 > > Because this loop:

Re: [PATCH] test: Block slp-16.c check for target support vect_strided6

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > This testcase FAIL in RISC-V because RISC-V support vect_load_lanes with 6. > FAIL: gcc.dg/vect/slp-16.c -flto -ffat-lto-objects scan-tree-dump-times vect > "vectorizing stmts using SLP" 2 > FAIL: gcc.dg/vect/slp-16.c scan-tree-dump-times vect

Re: [PATCH] test: Remove XPASS for RISCV

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Juzhe-Zhong wrote: > Like ARM SVE, this test cause FAILs of XPASS: > XPASS: gcc.dg/Wstringop-overflow-47.c pr97027 (test for warnings, line 72) > XPASS: gcc.dg/Wstringop-overflow-47.c pr97027 (test for warnings, line 77) > XPASS: gcc.dg/Wstringop-overflow-47.c pr97027 note

Re: [PATCH] use local range for one more pattern in match.pd

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, 15 Sep 2023, Jiufu Guo wrote: > Hi, > > For "get_global_range_query" SSA_NAME_RANGE_INFO can be queried. > For "get_range_query", it could get more context-aware range info. > And look at the implementation of "get_range_query", it returns > global range if no local fun info. > >

Re: [PATCH] MATCH: Improve zero_one_valued_p for cases without range information

2023-09-15 Thread Richard Biener via Gcc-patches
On Fri, Sep 15, 2023 at 3:09 AM Andrew Pinski via Gcc-patches wrote: > > I noticed we sometimes lose range information in forwprop due to a few > match and simplify patterns optimizing away casts. So the easier way > to these cases is to add a match for zero_one_valued_p wich mathes > a cast from

Re: [PATCH] MATCH: Fix `(1 >> X) != 0` pattern for vector types

2023-09-15 Thread Richard Biener via Gcc-patches
On Thu, Sep 14, 2023 at 7:49 PM Andrew Pinski via Gcc-patches wrote: > > I had missed that integer_onep can match vector types with uniform constant > of `1`. > This means the shifter could be an scalar type and then doing a comparison > against `0` > would be an invalid transformation. > This

Re: [PATCH] tree optimization/111407--SSA corruption due to widening_mul opt

2023-09-15 Thread Richard Biener via Gcc-patches
On Thu, Sep 14, 2023 at 3:25 PM Qing Zhao via Gcc-patches wrote: > > on conflict across an abnormal edge > > This is a bug in tree-ssa-math-opts.cc, when applying the widening mul > optimization, the compiler needs to check whether the operand is in a > ABNORMAL PHI, if YES, we should avoid the

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-14 Thread Richard Biener via Gcc-patches
> Am 14.09.2023 um 17:01 schrieb Qing Zhao : > > Thanks for the info. > >> On Sep 14, 2023, at 10:06 AM, Richard Biener >> wrote: >> >>> On Thu, Sep 14, 2023 at 3:42 PM Qing Zhao via Gcc-patches >>> wrote: >>> >>> Hi, >>> >>> I have several questions on these options: >>> >>> 1.are

Re: Question on -fwrapv and -fwrapv-pointer

2023-09-14 Thread Richard Biener via Gcc-patches
On Thu, Sep 14, 2023 at 3:42 PM Qing Zhao via Gcc-patches wrote: > > Hi, > > I have several questions on these options: > > 1.are pointers treated as signed integers in general? (I thought that > pointers are addresses to the memory, should be treated as unsigned integer…) > 2. If Yes, why? > 3.

[PATCH] tree-optimization/111294 - backwards threader PHI costing

2023-09-14 Thread Richard Biener via Gcc-patches
This revives an earlier patch since the problematic code applying extra costs to PHIs in copied blocks we couldn't make any sense of prevents a required threading in this case. Instead of coming up with an artificial other costing the following simply removes the bits. As with all threading

[PATCH] tree-optimization/111294 - better DCE after forwprop

2023-09-14 Thread Richard Biener via Gcc-patches
The following adds more aggressive DCE to forwprop to clean up dead stmts when folding a stmt leaves some operands unused. The patch uses simple_dce_from_worklist for this purpose, queueing original operands before substitution and folding, but only if we folded the stmt. This removes one dead

Re: [PATCH] core: Support heap-based trampolines

2023-09-14 Thread Richard Biener via Gcc-patches
On Wed, Sep 6, 2023 at 5:44 PM FX Coudert wrote: > > Hi, > > ping**2 on the revised patch, for Richard or another global reviewer. So far > all review feedback is that it’s a step forward, and it’s been widely used > for both aarch64-darwin and x86_64-darwin distributions for almost three >

Re: [PATCHSET] Reintroduce targetrustm hooks

2023-09-14 Thread Richard Biener via Gcc-patches
On Wed, Sep 13, 2023 at 10:14 PM Iain Buclaw via Gcc-patches wrote: > > Excerpts from Arthur Cohen's message of September 7, 2023 3:41 pm: > > Alright, was not expecting to mess up this patchset so bad so here we go: > > > > This patchset reintroduces proper targetrustm hooks without the old > >

Re: gcc-patches From rewriting mailman settings (Was: [Linaro-TCWG-CI] gcc patch #75674: FAIL: 68 regressions)

2023-09-14 Thread Richard Biener via Gcc-patches
On Tue, Sep 12, 2023 at 5:00 PM Mark Wielaard wrote: > > Hi Maxim, > > Adding Jeff to CC who is the official gcc-patches mailinglist admin. > > On Tue, 2023-09-12 at 11:08 +0400, Maxim Kuvyrkov wrote: > > Normally, notifications from Linaro TCWG precommit CI are sent only to > > patch author and

Re: [PATCH] MATCH: Support `(a != (CST+1)) & (a > CST)` optimizations

2023-09-14 Thread Richard Biener via Gcc-patches
On Thu, Sep 14, 2023 at 7:34 AM Andrew Pinski via Gcc-patches wrote: > > Even though this is done via reassocation, match can support > these with a simple change to detect that the difference is just > one. This allows to optimize these earlier and even during phiopt > for an example. > > This

Re: [PATCH] Improve error message for if with an else part while in switch

2023-09-14 Thread Richard Biener via Gcc-patches
On Thu, Sep 14, 2023 at 12:30 AM Andrew Pinski via Gcc-patches wrote: > > While writing some match.pd code, I was trying to figure > out why I was getting an `expected ), got (` error message > while writing an if statement with an else clause. For switch > statements, the if statements cannot

[PATCH] tree-optimization/111387 - BB SLP and irreducible regions

2023-09-13 Thread Richard Biener via Gcc-patches
When we split an irreducible region for BB vectorization analysis the defensive handling of external backedge defs in vect_get_and_check_slp_defs doesn't work since that relies on dominance info to identify a backedge. The testcase also shows we are iterating over the function in a sub-optimal

[PATCH] tree-optimization/111397 - missed copy propagation involving abnormal dest

2023-09-13 Thread Richard Biener via Gcc-patches
The following extends the previous enhancement to copy propagation involving abnormals. We can easily replace abnormal uses by not abnormal uses and only need to preserve the abnormals in PHI arguments flowing in from abnormal edges. This changes the may_propagate_copy argument indicating we are

Re: [PATCH] MATCH: Simplify `(X % Y) < Y` pattern.

2023-09-13 Thread Richard Biener via Gcc-patches
On Wed, Sep 13, 2023 at 12:11 AM Andrew Pinski via Gcc-patches wrote: > > This merges the two patterns to catch > `(X % Y) < Y` and `Y > (X % Y)` into one by > using :c on the comparison operator. > It does not change any code generation nor > anything else. It is more to allow for better >

Re: [PATCH v2 08/11] Native complex ops: Add explicit vector of complex

2023-09-13 Thread Richard Biener via Gcc-patches
On Tue, Sep 12, 2023 at 7:26 PM Joseph Myers wrote: > > On Tue, 12 Sep 2023, Sylvain Noiry via Gcc-patches wrote: > > > Summary: > > Allow the creation and usage of builtins vectors of complex > > in C, using __attribute__ ((vector_size ())) > > If you're adding a new language feature like this,

Re: [PATCH 2/2] MATCH: Move `X <= MAX(X, Y)` before `MIN (X, C1) < C2` pattern

2023-09-13 Thread Richard Biener via Gcc-patches
On Tue, Sep 12, 2023 at 5:41 PM Andrew Pinski via Gcc-patches wrote: > > Since matching C1 as C2 here will decrease how much other simplifications > will need to happen to get the final answer. > > OK? Bootstrapped and tested on x86_64-linux-gnu. OK Richard. > gcc/ChangeLog: > > *

Re: [PATCH 1/2] MATCH: [PR111364] Add some more minmax cmp operand simplifications

2023-09-13 Thread Richard Biener via Gcc-patches
On Tue, Sep 12, 2023 at 5:31 PM Andrew Pinski via Gcc-patches wrote: > > This adds a few more minmax cmp operand simplifications which were missed > before. > `MIN(a,b) < a` -> `a > b` > `MIN(a,b) >= a` -> `a <= b` > `MAX(a,b) > a` -> `a < b` > `MAX(a,b) <= a` -> `a >= b` > > OK? Bootstrapped

Re: [PATCH] MATCH: Simplify (a CMP1 b) ^ (a CMP2 b)

2023-09-12 Thread Richard Biener via Gcc-patches
On Tue, Sep 12, 2023 at 6:22 AM Andrew Pinski via Gcc-patches wrote: > > This adds the missing optimizations here. > Note we don't need to match where CMP1 and CMP2 are complements of each > other as that is already handled elsewhere. > > I added a new executable testcase to make sure we optimize

Re: [PATCH] small _BitInt tweaks

2023-09-12 Thread Richard Biener via Gcc-patches
On Mon, 11 Sep 2023, Jakub Jelinek wrote: > Hi! > > When discussing PR111369 with Andrew Pinski, I've realized that > I haven't added BITINT_TYPE handling to range_check_type. Right now > (unsigned) max + 1 == (unsigned) min for signed _BitInt,l so I think we > don't need to do the extra hops

Re: [PATCH] sccvn: Avoid ICEs on _BitInt load BIT_AND_EXPR mask [PR111338]

2023-09-12 Thread Richard Biener via Gcc-patches
On Mon, 11 Sep 2023, Jakub Jelinek wrote: > Hi! > > The following testcase ICEs, because vn_walk_cb_data::push_partial_def > uses a fixed size buffer (64 target bytes) for its > construction/deconstruction of partial stores and fails if larger precision > than that is needed, and the PR93582

Re: [PATCH] match: Don't sink comparisons into vec_cond operands.

2023-09-12 Thread Richard Biener via Gcc-patches
On Fri, Sep 8, 2023 at 7:55 PM Robin Dapp via Gcc-patches wrote: > > Hi, > > on riscv gcc.dg/pr70252.c ICEs at gimple-isel.cc:283. This is because > we created the gimple statement > > mask__7.36_170 = VEC_COND_EXPR }>; > > during vrp2. > > What happens is that, starting with > maskdest =

Re: [PATCH] math-opts: Add dbgcounter for FMA formation

2023-09-12 Thread Richard Biener via Gcc-patches
On Thu, Sep 7, 2023 at 6:47 PM Martin Jambor wrote: > > Hello, > > This patch is a simple addition of a debug counter to FMA formation in > tree-ssa-math-opts.cc. Given that issues with FMAs do occasionally > pop up, it seems genuinely useful. > > I simply added an if right after the initial

Re: [MAINTAINERS/KERNEL SUMMIT] Trust and maintenance of file systems

2023-09-12 Thread Richard Biener via Gcc-patches
On Thu, Sep 7, 2023 at 2:32 PM Segher Boessenkool wrote: > > On Thu, Sep 07, 2023 at 02:23:00PM +0300, Dan Carpenter wrote: > > On Thu, Sep 07, 2023 at 06:04:09AM -0500, Segher Boessenkool wrote: > > > On Thu, Sep 07, 2023 at 12:48:25PM +0300, Dan Carpenter via Gcc-patches > > > wrote: > > > > I

Re: [PATCH] Tweak language choice in config-list.mk

2023-09-12 Thread Richard Biener via Gcc-patches
On Thu, Sep 7, 2023 at 11:30 AM Richard Sandiford via Gcc-patches wrote: > > When I tried to use config-list.mk, the build for every triple except > the build machine's failed for m2. This is because, unlike other > languages, m2 builds target objects during all-gcc. The build will > therefore

Re: [PATCH] Checking undefined_p before using the vr

2023-09-12 Thread Richard Biener via Gcc-patches
On Thu, 7 Sep 2023, Jiufu Guo wrote: > Hi, > > As discussed in PR111303: > > For pattern "(X + C) / N": "div (plus@3 @0 INTEGER_CST@1) INTEGER_CST@2)", > Even if "X" has value-range and "X + C" does not overflow, "@3" may still > be undefined. Like below example: > > _3 = _2 + -5; > if (0 !=

Re: [PATCH] ggc, jit: forcibly clear GTY roots in jit

2023-09-12 Thread Richard Biener via Gcc-patches
On Wed, Sep 6, 2023 at 3:41 PM David Malcolm via Gcc-patches wrote: > > As part of Antoyo's work on supporting LTO in rustc_codegen_gcc, he > noticed an ICE inside libgccjit when compiling certain rust files. > > Debugging libgccjit showed that outdated information from a previous > in-memory

Re: [PATCH] ssa_name_has_boolean_range vs signed-boolean:31 types

2023-09-12 Thread Richard Biener via Gcc-patches
On Sat, Sep 2, 2023 at 4:33 AM Andrew Pinski via Gcc-patches wrote: > > This turns out to be a latent bug in ssa_name_has_boolean_range > where it would return true for all boolean types but all of the > uses of ssa_name_has_boolean_range was expecting 0/1 as the range > rather than [-1,0]. > So

Re: [PATCH] Improve rewrite_to_defined_overflow for lhs already the correct type

2023-09-12 Thread Richard Biener via Gcc-patches
On Sun, Sep 3, 2023 at 6:19 PM Andrew Pinski via Gcc-patches wrote: > > This improves rewrite_to_defined_overflow slightly if we already > have an unsigned type. The only place where this seems to show up > is ifcombine. It removes one extra statement which gets added and > then later on removed.

Re: [PATCH V6] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-09-01 Thread Richard Biener via Gcc-patches
On Fri, 1 Sep 2023, Jiufu Guo wrote: > Hi, > > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" with > the below conditions: > 1. There is no wrap/overflow/underflow. >wrap/overflow/underflow breaks the arithmetic operation. > 2. "X - N * M" and "X" are not of opposite

Re: [PATCH v3] tree-optimization/110279- Check for nested FMA in reassoc

2023-09-01 Thread Richard Biener via Gcc-patches
On Wed, Aug 9, 2023 at 6:53 PM Di Zhao OS wrote: > > Hi, > > The previous version of this patch tries to solve two problems > at the same time. For better clarity, I'll separate them and > only deal with the "nested" FMA in this version. I plan to > propose another patch in avoiding bad shaped

Re: [PATCH] MATCH: `(nop_convert)-a` into -(nop_convert)a if the negate is single use and a is known not to be signed min value

2023-09-01 Thread Richard Biener via Gcc-patches
On Fri, Sep 1, 2023 at 4:27 AM Andrew Pinski via Gcc-patches wrote: > > This pushes the conversion further down the chain which allows to optimize > away more > conversions in many cases. But when building (T1)(T2)-x it will make simplifying (T1)(T2) more difficult as we'd need a (convert

Re: [RFC] gimple ssa: SCCP - A new PHI optimization pass

2023-09-01 Thread Richard Biener via Gcc-patches
On Fri, 1 Sep 2023, Filip Kastl wrote: > > That's interesting. Your placement at > > > > NEXT_PASS (pass_cd_dce, false /* update_address_taken_p */); > > NEXT_PASS (pass_phiopt, true /* early_p */); > > + NEXT_PASS (pass_sccp); > > > > and > > > >NEXT_PASS

Re: [PATCH] MATCH [PR19832]: Optimize some `(a != b) ? a OP b : c`

2023-09-01 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 7:25 PM Andrew Pinski via Gcc-patches wrote: > > This patch adds the following match patterns to optimize these: > /* (a != b) ? (a - b) : 0 -> (a - b) */ > /* (a != b) ? (a ^ b) : 0 -> (a ^ b) */ > /* (a != b) ? (a & b) : a -> (a & b) */ > /* (a != b) ? (a | b) : a ->

Re: [RFC] gimple ssa: SCCP - A new PHI optimization pass

2023-09-01 Thread Richard Biener via Gcc-patches
On Thu, 31 Aug 2023, Andrew Pinski wrote: > On Thu, Aug 31, 2023 at 5:15?AM Richard Biener via Gcc-patches > wrote: > > > > On Thu, 31 Aug 2023, Filip Kastl wrote: > > > > > > The most obvious places would be right after SSA construction and > > > &g

[PATCH] middle-end/111253 - partly revert r11-6508-gabb1b6058c09a7

2023-08-31 Thread Richard Biener via Gcc-patches
The following keeps dumping SSA def stmt RHS during diagnostic reporting only for gimple_assign_single_p defs which means memory loads. This avoids diagnostics containing PHI nodes like warning: 'realloc' called on pointer '*_42 = PHI .t_mem_caches' with nonzero offset 40 instead getting back

Re: [PATCH] [tree-optimization/110279] swap operands in reassoc to reduce cross backedge FMA

2023-08-31 Thread Richard Biener via Gcc-patches
On Wed, Aug 30, 2023 at 11:33 AM Di Zhao OS wrote: > > Hello Richard, > > > -Original Message- > > From: Richard Biener > > Sent: Tuesday, August 29, 2023 7:11 PM > > To: Di Zhao OS > > Cc: Jeff Law ; Martin Jambor ; gcc- > > patc...@gcc.gnu.org > > Subject: Re: [PATCH]

Re: [PATCH] MATCH: extend min_value/max_value match to vectors

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 12:27 AM Andrew Pinski via Gcc-patches wrote: > > This simple patch extends the min_value/max_value match to vector integer > types. > Using uniform_integer_cst_p makes this easy. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > The testcases

Re: [RFC] gimple ssa: SCCP - A new PHI optimization pass

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, 31 Aug 2023, Filip Kastl wrote: > > The most obvious places would be right after SSA construction and before > > RTL expansion. > > Can you provide measurements for those positions? > > The algorithm should only remove PHIs that break SSA form minimality. Since > GCC's SSA construction

Re: [PATCH] testsuite/vect: Make match patterns more accurate.

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, 31 Aug 2023, Robin Dapp wrote: > Hi, > > on some targets we fail to vectorize with the first type the vectorizer > tries but succeed with the second. This patch changes several regex > patterns to reflect that behavior. > > Before we would look for a single occurrence of e.g. >

[PATCH] Fix gcc.dg/tree-ssa/forwprop-42.c

2023-08-31 Thread Richard Biener via Gcc-patches
The testcase requires hardware support for V2DImode vectors because otherwise we do not rewrite inserts via BIT_FIELD_REF to BIT_INSERT_EXPR. There's no effective target for this so the following makes the testcase x86 specific, requiring and enabling SSE2. Pushed. *

Re: [PATCH 11/13] [APX EGPR] Handle legacy insns that only support GPR16 (3/5)

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 11:26 AM Richard Biener wrote: > > On Thu, Aug 31, 2023 at 10:25 AM Hongyu Wang via Gcc-patches > wrote: > > > > From: Kong Lingling > > > > Disable EGPR usage for below legacy insns in opcode map2/3 that have vex > > but no evex counterpart. > > > > insn list: > > 1.

Re: [PATCH 11/13] [APX EGPR] Handle legacy insns that only support GPR16 (3/5)

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 10:25 AM Hongyu Wang via Gcc-patches wrote: > > From: Kong Lingling > > Disable EGPR usage for below legacy insns in opcode map2/3 that have vex > but no evex counterpart. > > insn list: > 1. phminposuw/vphminposuw > 2. ptest/vptest > 3. roundps/vroundps,

Re: [PATCH 00/13] [RFC] Support Intel APX EGPR

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 10:22 AM Hongyu Wang via Gcc-patches wrote: > > Intel Advanced performance extension (APX) has been released in [1]. > It contains several extensions such as extended 16 general purpose registers > (EGPRs), push2/pop2, new data destination (NDD), conditional compare >

Re: [PATCH] Adjust costing of emulated vectorized gather/scatter

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, Aug 31, 2023 at 10:06 AM Hongtao Liu wrote: > > On Wed, Aug 30, 2023 at 8:18 PM Richard Biener via Gcc-patches > wrote: > > > > On Wed, Aug 30, 2023 at 12:38 PM liuhongt via Gcc-patches > > wrote: > > > > > > r14-332-g24905a4bd1375c adjust

Re: [r14-3571 Regression] FAIL: gcc.target/i386/pr52252-atom.c scan-assembler palignr on Linux/x86_64

2023-08-31 Thread Richard Biener via Gcc-patches
On Thu, 31 Aug 2023, Jiang, Haochen wrote: > On Linux/x86_64, > > caa7a99a052929d5970677c5b639e1fa5166e334 is the first bad commit > commit caa7a99a052929d5970677c5b639e1fa5166e334 > Author: Richard Biener > Date: Wed Aug 30 11:57:47 2023 +0200 > > tree-optimization/111228 - combine two

Re: [PATCH 6/8] vect: Add vector_mode paramater to simd_clone_usable

2023-08-31 Thread Richard Biener via Gcc-patches
On Wed, Aug 30, 2023 at 5:02 PM Andre Vieira (lists) wrote: > > > > On 30/08/2023 14:01, Richard Biener wrote: > > On Wed, Aug 30, 2023 at 11:15 AM Andre Vieira (lists) via Gcc-patches > > wrote: > >> > >> This patch adds a machine_mode parameter to the TARGET_SIMD_CLONE_USABLE > >> hook to

Re: RFC: Introduce -fhardened to enable security-related flags

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, Aug 30, 2023 at 12:51 PM Jakub Jelinek via Gcc-patches wrote: > > On Tue, Aug 29, 2023 at 03:42:27PM -0400, Marek Polacek via Gcc-patches wrote: > > + if (UNLIKELY (flag_hardened) > > + && (opt->code == OPT_D || opt->code == OPT_U)) > > + { > > + if

Re: [PATCH7/8] vect: Add TARGET_SIMD_CLONE_ADJUST_RET_OR_PARAM

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote: > This patch adds a new target hook to enable us to adapt the types of return > and parameters of simd clones. We use this in two ways, the first one is to > make sure we can create valid SVE types, including the SVE type attribute, > when

Re: [PATCH 6/8] vect: Add vector_mode paramater to simd_clone_usable

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, Aug 30, 2023 at 11:15 AM Andre Vieira (lists) via Gcc-patches wrote: > > This patch adds a machine_mode parameter to the TARGET_SIMD_CLONE_USABLE > hook to enable rejecting SVE modes when the target architecture does not > support SVE. How does the graph node of the SIMD clone lack this

Re: [PATCH 4/8] vect: don't allow fully masked loops with non-masked simd clones [PR 110485]

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote: > When analyzing a loop and choosing a simdclone to use it is possible to choose > a simdclone that cannot be used 'inbranch' for a loop that can use partial > vectors. This may lead to the vectorizer deciding to use partial vectors > which are

Re: [Patch 3/8] vect: Fix vect_get_smallest_scalar_type for simd clones

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote: > The vect_get_smallest_scalar_type helper function was using any argument to a > simd clone call when trying to determine the smallest scalar type that would > be vectorized. This included the function pointer type in a MASK_CALL for > instance,

Re: [Patch 2/8] parloops: Allow poly nit and bound

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote: > Teach parloops how to handle a poly nit and bound e ahead of the changes to > enable non-constant simdlen. Can you use poly_int_tree_p to combine INTEGER_CST || POLY_INT_CST please? OK with that change. > gcc/ChangeLog: > > *

Re: [PATCH 1/8] parloops: Copy target and optimizations when creating a function clone

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote: > > SVE simd clones require to be compiled with a SVE target enabled or the > argument types will not be created properly. To achieve this we need to copy > DECL_FUNCTION_SPECIFIC_TARGET from the original function declaration to the > clones. I

Re: [PATCH] tree-optimization/111228 - combine two VEC_PERM_EXPRs

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Jakub Jelinek wrote: > On Wed, Aug 30, 2023 at 01:54:46PM +0200, Richard Biener via Gcc-patches > wrote: > > * gcc.dg/tree-ssa/forwprop-42.c: New testcase. > > > --- /dev/null > > +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-42.c > >

Re: [PATCH] test: Add xfail into slp-reduc-7.c for RVV VLA vectorization

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Juzhe-Zhong wrote: > Like ARM SVE, add RVV variable length xfail. OK > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/slp-reduc-7.c: Add RVV. > > --- > gcc/testsuite/gcc.dg/vect/slp-reduc-7.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

Re: [PATCH] test: Adapt slp-26.c check for RVV

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Juzhe-Zhong wrote: > Fix FAILs: > FAIL: gcc.dg/vect/slp-26.c -flto -ffat-lto-objects scan-tree-dump-times vect > "vectorized 0 loops" 1 > FAIL: gcc.dg/vect/slp-26.c -flto -ffat-lto-objects scan-tree-dump-times vect > "vectorizing stmts using SLP" 0 > FAIL:

Re: [PATCH] Adjust costing of emulated vectorized gather/scatter

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, Aug 30, 2023 at 12:38 PM liuhongt via Gcc-patches wrote: > > r14-332-g24905a4bd1375c adjusts costing of emulated vectorized > gather/scatter. > > commit 24905a4bd1375ccd99c02510b9f9529015a48315 > Author: Richard Biener > Date: Wed Jan 18 11:04:49 2023 +0100 > > Adjust costing

[PATCH] tree-optimization/111228 - combine two VEC_PERM_EXPRs

2023-08-30 Thread Richard Biener via Gcc-patches
The following adds simplification of two VEC_PERM_EXPRs where the later one replaces all elements from either the first or the second input of the earlier permute. This allows a three input permute to be simplified to a two input one. I'm following the existing two input simplification case and

Re: [PATCH] test: Fix XPASS of RVV

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Juzhe-Zhong wrote: > XPASS: gcc.dg/vect/vect-outer-4e.c -flto -ffat-lto-objects > scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1 > XPASS: gcc.dg/vect/vect-outer-4e.c scan-tree-dump-times vect "OUTER LOOP > VECTORIZED" 1 > XPASS: gcc.dg/vect/vect-outer-4f.c -flto

Re: [PATCH] tree-ssa-strlen: Fix up handling of conditionally zero memcpy [PR110914]

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Jakub Jelinek wrote: > Hi! > > The following testcase is miscompiled since r279392 aka > r10-5451-gef29b12cfbb4979 > The strlen pass has adjust_last_stmt function, which performs mainly strcat > or strcat-like optimizations (say strcpy (x, "abcd"); strcat (x, p); > or

Re: [PATCH] test: Add xfail for riscv_vector

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Juzhe-Zhong wrote: > Like ARM SVE, when we enable scalable vectorization for RVV, > we can't do constant fold for these yet for both ARM SVE and RVV. > > > Ok for trunk ? OK. > gcc/testsuite/ChangeLog: > > * gcc.dg/vect/pr88598-1.c: Add riscv_vector. > *

Re: [PATCH] store-merging: Fix up >= 64 bit insertion [PR111015]

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Jakub Jelinek wrote: > Hi! > > The following testcase shows that we mishandle bit insertion for > info->bitsize >= 64. The problem is in using unsigned HOST_WIDE_INT > shift + subtraction + build_int_cst to compute mask, the shift invokes > UB at compile time for

Re: [PATCH] middle-end: Apply MASK_LEN_LOAD_LANES/MASK_LEN_STORE_LANES to ivopts/alias

2023-08-30 Thread Richard Biener via Gcc-patches
On Wed, 30 Aug 2023, Juzhe-Zhong wrote: > Like MASK_LOAD_LANES/MASK_STORE_LANES, add MASK_LEN_ variant. > > Bootstrap and Regression on X86 passed. > > Ok for trunk? OK. > gcc/ChangeLog: > > * tree-ssa-alias.cc (ref_maybe_used_by_call_p_1): Add MASK_LEN_ variant. >

Re: [PATCH] IFCOMBINE: Remove outer condition for two same conditionals

2023-08-29 Thread Richard Biener via Gcc-patches
On Mon, Aug 28, 2023 at 12:58 AM Andrew Pinski via Gcc-patches wrote: > > This adds a simple case to remove an outer condition if the two inner > condtionals are the same and lead the same location. > This can show up due to jump threading or inlining or someone wrote code > like this. > >

Re: [PATCH] [tree-optimization/110279] swap operands in reassoc to reduce cross backedge FMA

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, Aug 29, 2023 at 10:59 AM Di Zhao OS wrote: > > Hi, > > > -Original Message- > > From: Richard Biener > > Sent: Tuesday, August 29, 2023 4:09 PM > > To: Di Zhao OS > > Cc: Jeff Law ; Martin Jambor ; gcc- > > patc...@gcc.gnu.org > > Subject: Re: [PATCH] [tree-optimization/110279]

Re: [RFC] > WIDE_INT_MAX_PREC support in wide-int

2023-08-29 Thread Richard Biener via Gcc-patches
On Mon, 28 Aug 2023, Jakub Jelinek wrote: > Hi! > > While the _BitInt series isn't committed yet, I had a quick look at > lifting the current lowest limitation on maximum _BitInt precision, > that wide_int can only support wide_int until WIDE_INT_MAX_PRECISION - 1. > > Note, other limits if

Re: Bind RTL to a TREE expr (Re: [Bug target/111166])

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, 29 Aug 2023, Jiufu Guo wrote: > > Hi Richard, > > Thanks a lot for your quick reply! > > Richard Biener writes: > > > On Tue, 29 Aug 2023, Jiufu Guo wrote: > > > >> > >> Hi All! > >> > >> "rguenth at gcc dot gnu.org" writes: > >> > >> >

Re: [PATCH V1 1/2] light expander sra v0

2023-08-29 Thread Richard Biener via Gcc-patches
On Wed, 23 Aug 2023, Jiufu Guo wrote: > > Hi, > > I just updated the patch. We could review this one. > > Compare with previous patch: > https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627287.html > This version: > * Supports bitfield access from one register. > * Allow return scalar

Re: [PATCH] tree-ssa-math-opts: Improve uaddc/usubc pattern matching [PR111209]

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, 29 Aug 2023, Jakub Jelinek wrote: > Hi! > > The uaddc/usubc usual matching is of the .{ADD,SUB}_OVERFLOW pair in the > middle, which adds/subtracts carry-in (from lower limbs) and computes > carry-out (to higher limbs). Before optimizations (unless user writes > it intentionally that

Re: [PATCH] [tree-optimization/110279] swap operands in reassoc to reduce cross backedge FMA

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, Aug 29, 2023 at 9:49 AM Di Zhao OS wrote: > > Hi, > > > -Original Message- > > From: Richard Biener > > Sent: Tuesday, August 29, 2023 3:41 PM > > To: Jeff Law ; Martin Jambor > > Cc: Di Zhao OS ; gcc-patches@gcc.gnu.org > > Subject: Re: [PATCH] [tree-optimization/110279] swap

Re: [PATCH] [tree-optimization/110279] swap operands in reassoc to reduce cross backedge FMA

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, Aug 29, 2023 at 1:23 AM Jeff Law via Gcc-patches wrote: > > > > On 8/28/23 02:17, Di Zhao OS via Gcc-patches wrote: > > This patch tries to fix the 2% regression in 510.parest_r on > > ampere1 in the tracker. (Previous discussion is here: > >

Re: [PATCH] MATCH: Move `(x | y) & (~x ^ y)` over to use bitwise_inverted_equal_p

2023-08-29 Thread Richard Biener via Gcc-patches
On Mon, Aug 28, 2023 at 10:15 PM Andrew Pinski via Gcc-patches wrote: > > This moves the match pattern `(x | y) & (~x ^ y)` over to use > bitwise_inverted_equal_p. > This now also allows to optmize comparisons and also catches the missed `(~x > | y) & (x ^ y)` > transformation into `~x & y`. >

Re: [PATCH] vect test: Remove xfail for riscv

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, 29 Aug 2023, Juzhe-Zhong wrote: > We are planning to enable "vect" testsuite with scalable vector > auto-vectorization. > > This case XPASS: > XPASS: gcc.dg/vect/no-scevccp-outer-12.c scan-tree-dump-times vect "OUTER > LOOP VECTORIZED." 1 > > like ARM SVE. OK > --- >

Re: Bind RTL to a TREE expr (Re: [Bug target/111166])

2023-08-29 Thread Richard Biener via Gcc-patches
On Tue, 29 Aug 2023, Jiufu Guo wrote: > > Hi All! > > "rguenth at gcc dot gnu.org" writes: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66 > ... > > > > > > At RTL expansion time we store to D.2865 where it's DECL_RTL is r82:TI so > > we can hardly fix it there. Only a later pass

Re: Ping^^ [PATCH V5 2/2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-08-28 Thread Richard Biener via Gcc-patches
On Wed, 23 Aug 2023, guojiufu wrote: > Hi, > > I would like to have a gentle ping... > > BR, > Jeff (Jiufu Guo) > > On 2023-08-07 10:45, guojiufu via Gcc-patches wrote: > > Hi, > > > > Gentle ping... > > > > On 2023-07-18 22:05, Jiufu Guo wrote: > >> Hi, > >> > >> Integer expression "(X - N

  1   2   3   4   5   6   7   8   9   10   >