[PATCH] tree-optimization/116241 - ICE with SLP condition reduction

2024-08-06 Thread Richard Biener
When there's a conversion in front of a SLP condition reduction the code following the reduc-idx SLP chain fails because it assumes there's only COND_EXPRs. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/116241 * tree-vect-loop.cc (vect_create_ep

Re: [PATCH] testsuite: Fix up pr116037.c test [PR116245]

2024-08-06 Thread Richard Biener
_ORDER__ == __ORDER_LITTLE_ENDIAN__ >x &= -((VC) vv)[0]; > +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > + x &= -((VC) vv)[sizeof (__int128) - 1]; > +#else > + x &= -(unsigned char) (vv[0]); > +#endif >vi *= (VI) (VS){ -vs[0], vc[0], vs[1], vi[7], vs[7], vl[7],

Re: [PATCH] wide-int: Fix up mul_internal overflow checking [PR116224]

2024-08-06 Thread Richard Biener
23" } */ > +/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */ > +/* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */ > + > +#if __BITINT_MAXWIDTH__ >= 65 > +#define

Re: [PATCH v1] Match: Add type_has_mode_precision_p check for SAT_TRUNC [PR116202]

2024-08-05 Thread Richard Biener
r_type) != INTEGER_TYPE)) scalar_type = build_nonstandard_integer_type (GET_MODE_BITSIZE (inner_mode), TYPE_UNSIGNED (scalar_type)); So possibly vectorizable_internal_function would need to be amended or better, vector pattern matching be constrai

Re: [PATCH v1] Match: Support form 1 for scalar signed integer .SAT_ADD

2024-08-05 Thread Richard Biener
On Mon, Aug 5, 2024 at 9:14 AM wrote: > > From: Pan Li > > This patch would like to support the form 1 of the scalar signed > integer .SAT_ADD. Aka below example: > > Form 1: > #define DEF_SAT_S_ADD_FMT_1(T) \ > T __attribute__((noinline))\ > sat_s_add_##T##_fmt

Re: [PATCH] tree-reassoc.cc: PR tree-optimization/116139 Don't assert when forming fully-pipelined FMAs on wide MULT targets

2024-08-05 Thread Richard Biener
On Mon, Aug 5, 2024 at 8:49 AM Kyrylo Tkachov wrote: > > Hi all, > > The code in get_reassociation_width that forms FMAs aggressively when > they are fully pipelined expects the FMUL reassociation width in the > target to be less than for FMAs. This doesn't hold for all target > tunings. > > This

Re: [PATCH v1] Match: Add type_has_mode_precision_p check for SAT_TRUNC [PR116202]

2024-08-05 Thread Richard Biener
On Sun, Aug 4, 2024 at 1:47 PM wrote: > > From: Pan Li > > The .SAT_TRUNC matching can only perform the type has its mode > precision. > > g_12 = (long unsigned int) _2; > _13 = MIN_EXPR ; > _3 = (_Bool) _13; > > The above pattern cannot be recog as .SAT_TRUNC (g_12) because the dest > only has 1

Re: [PATCH] vect: Multistep float->int conversion only with no trapping math

2024-08-05 Thread Richard Biener
On Fri, Aug 2, 2024 at 2:43 PM Juergen Christ wrote: > > Do not convert floats to ints in multiple step if trapping math is > enabled. This might hide some inexact signals. > > Also use correct sign (the sign of the target integer type) for the > intermediate steps. This only affects undefined b

Re: [PATCH] vect: Add missed opcodes in vect_get_smallest_scalar_type [PR115228]

2024-08-05 Thread Richard Biener
On Mon, Aug 5, 2024 at 12:36 PM Feng Xue OS wrote: > > Some opcodes are missed when determining the smallest scalar type for a > vectorizable statement. Currently, this bug does not cause any problem, > because vect_get_smallest_scalar_type is only used to compute max nunits > vectype, and even st

Re: [PATCH] vect: Allow unsigned-to-signed promotion in vect_look_through_possible_promotion [PR115707]

2024-08-05 Thread Richard Biener
On Mon, Aug 5, 2024 at 12:34 PM Feng Xue OS wrote: > > The function vect_look_through_possible_promotion() fails to figure out root > definition if casts involves more than two promotions with sign change as: > > long a = (long)b; // promotion cast > -> int b = (int)c; // promotion cast

Re: [PATCH] gimplify: Small RAW_DATA_CST gimplification fix

2024-08-03 Thread Richard Biener
> Am 03.08.2024 um 20:14 schrieb Jakub Jelinek : > > Hi! > > I've noticed the following testcase on top of the #embed patchset: > https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655012.html > >

[PATCH] middle-end/111821 - compile-time/memory-hog with large copy

2024-08-02 Thread Richard Biener
The following fixes a compile-time/memory-hog when performing a large aggregate copy to a small object allocated to a register. While store_bit_field_1 called by store_integral_bit_field will do nothign for accesses outside of the target the loop over the source in store_integral_bit_field will sti

Re: [PATCH] MATCH: add abs support for half float

2024-08-02 Thread Richard Biener
On Fri, Aug 2, 2024 at 11:20 AM Kugan Vivekanandarajah wrote: > > > > > On 1 Aug 2024, at 10:46 pm, Richard Biener > > wrote: > > > > External email: Use caution opening links or attachments > > > > > > On Thu, Aug 1, 2024 at 5:31 AM Kugan Vive

Re: [RFC/RFA] [PATCH v2 09/12] Add symbolic execution support.

2024-08-02 Thread Richard Biener
On Wed, Jul 31, 2024 at 12:42 PM Mariam Arutunian wrote: > > Gives an opportunity to execute the code on bit level, >assigning symbolic values to the variables which don't have initial values. >Supports only CRC specific operations. > >Example: > >uint8_t crc; >uint8_t pol

Re: [RFC/RFA] [PATCH 08/12] Add a new pass for naive CRC loops detection

2024-08-02 Thread Richard Biener
On Wed, Jul 31, 2024 at 10:15 AM Mariam Arutunian wrote: > > This patch adds a new compiler pass aimed at identifying naive CRC > implementations, > characterized by the presence of a loop calculating a CRC (polynomial long > division). > Upon detection of a potential CRC, the pass prints an i

Re: [PATCH] forwprop: Don't add uses to dce list if debug statement [PR116156]

2024-08-01 Thread Richard Biener
On Thu, Aug 1, 2024 at 10:40 PM Andrew Pinski wrote: > > The problem here is that when forwprop does a copy prop, into a statement, > we mark the uses of that statement as possibly need to be removed. But it just > happened that statement was a debug statement, there will be a difference when > co

Re: [PATCH] Make may_trap_p_1 return false for constant pool references [PR116145]

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 6:41 PM Richard Sandiford wrote: > > The testcase contains the constant: > > arr2 = svreinterpret_u8(svdup_u32(0x0a0d5c3f)); > > which was initially hoisted by hand, but which gimple optimisers later > propagated to each use (as expected). The constant was then expanded

Re: [PATCH] MATCH: add abs support for half float

2024-08-01 Thread Richard Biener
On Thu, Aug 1, 2024 at 5:31 AM Kugan Vivekanandarajah wrote: > > > On Mon, Jul 29, 2024 at 10:11 AM Andrew Pinski wrote: > > > > On Mon, Jul 29, 2024 at 12:57 AM Kugan Vivekanandarajah > > wrote: > > > > > > On Thu, Jul 25, 2024 at 10:19 PM Richar

Re: [PATCH] middle-end/114563 - improve release_pages

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 5:37 PM Andi Kleen wrote: > > On Wed, Jul 31, 2024 at 04:02:22PM +0200, Richard Biener wrote: > > The following improves release_pages when using the madvise path > > to sort the freelist to get more page entries contiguous and possibly > > relea

Re: [PATCH v2] match: Fix wrong code due to `(a ? e : f) !=/== (b ? e : f)` patterns [PR116120]

2024-08-01 Thread Richard Biener
On Thu, Aug 1, 2024 at 12:30 AM Andrew Pinski wrote: > > When this pattern was converted from being only dealing with 0/-1, we missed > that if `e == f` is true > then the optimization is wrong and needs an extra check for that. > > This changes the patterns to be: > /* (a ? x : y) != (b ? x : y)

Re: [PATCH] testsuite: Adjust fam-in-union-alone-in-struct-2.c to support BE [PR116148]

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 9:00 PM Qing Zhao wrote: > > Hi, Kewen, > > Thanks a lot for fixing this testing case issue. > Yes, the change LGTM though I can’t approve it. OK. Richard. > Qing > > > On Jul 31, 2024, at 05:22, Kewen.Lin wrote: > > > > Hi, > > > > As Andrew pointed out in PR116148, fa

[PATCH] middle-end/114563 - improve release_pages

2024-07-31 Thread Richard Biener
The following improves release_pages when using the madvise path to sort the freelist to get more page entries contiguous and possibly release them. This populates the unused prev pointer so the reclaim can then easily unlink from the freelist without re-ordering it. The paths not having madvise d

Re: [PATCH] tree-optimization/115825 - improve unroll estimates for volatile accesses

2024-07-31 Thread Richard Biener
On Wed, 10 Jul 2024, Richard Biener wrote: > The loop unrolling code assumes that one third of all volatile accesses > can be possibly optimized away which is of course not true. This leads > to excessive unrolling in some cases. The following tracks the number > of stmts with sid

[PATCH 3/3][v3] tree-optimization/114659 - VN and FP to int punning

2024-07-31 Thread Richard Biener
The following addresses another case where x87 FP loads mangle the bit representation and thus are not suitable for a representative in other types. VN was value-numbering a later integer load of 'x' as the same as a former float load of 'x'. We can use the new TARGET_MODE_CAN_TRANSFER_BITS hook

[PATCH 2/3] [x86] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
The following implements the hook, excluding x87 modes for scalar and complex float modes. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK this way? Thanks, Richard. * i386.cc (TARGET_MODE_CAN_TRANSFER_BITS): Define. (ix86_mode_can_transfer_bits): New function. --- gcc/

[PATCH 1/3][v3] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
The following adds a target hook to specify whether regs of MODE can be used to transfer bits. The hook is supposed to be used for value-numbering to decide whether a value loaded in such mode can be punned to another mode instead of re-loading the value in the other mode and for SRA to decide whe

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
On Wed, 31 Jul 2024, Jakub Jelinek wrote: > On Wed, Jul 31, 2024 at 02:43:36PM +0200, Richard Biener wrote: > > diff --git a/gcc/config/i386/i386-modes.def > > b/gcc/config/i386/i386-modes.def > > index 6d8f1946f3a..2cc03e30f13 100644 > > --- a/gcc/config/i386/i386-mod

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
On Wed, 31 Jul 2024, Uros Bizjak wrote: > On Wed, Jul 31, 2024 at 11:33 AM Richard Biener wrote: > > > > On Wed, 31 Jul 2024, Uros Bizjak wrote: > > > > > On Wed, Jul 31, 2024 at 10:48 AM Richard Biener wrote: > > > > > > > > On Wed, 31 Jul

Re: [Patch,v3] omp-offload.cc: Fix value-expr handling of 'declare target link' vars [PR115637] (was: [Patch] gimplify.cc: Handle VALUE_EXPR of MEM_REF's ADDR_EXPR argument [PR115637])

2024-07-31 Thread Richard Biener
On Wed, Jul 31, 2024 at 1:21 PM Tobias Burnus wrote: > > Hi Richard, hi all, > > Richard Biener wrote: > > Looking at pass_omp_target_link::execute I wonder iff find_link_var_op > shouldn't simply do the substitution? Aka > > This seems to work ... > > --

Re: [PATCH 2/2] match: Fix wrong code due to `(a ? e : f) !=/== (b ? e : f)` patterns [PR116120]

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 5:26 PM Andrew Pinski wrote: > > When this pattern was converted from being only dealing with 0/-1, we missed > that if `e == f` is true > then the optimization is wrong and needs an extra check for that. > > This changes the patterns to be: > /* (a ? x : y) != (b ? x : y)

Re: [PATCH 1/2] match: Fix types matching for `(?:) !=/== (?:)` [PR116134]

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 5:25 PM Andrew Pinski wrote: > > The problem here is that in generic types of comparisons don't need > to be boolean types (or vector boolean types). And fixes that by making > sure the types of the conditions match before doing the optimization. > > Bootstrapped and tested

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
On Wed, 31 Jul 2024, Uros Bizjak wrote: > On Wed, Jul 31, 2024 at 10:48 AM Richard Biener wrote: > > > > On Wed, 31 Jul 2024, Uros Bizjak wrote: > > > > > On Wed, Jul 31, 2024 at 10:24 AM Jakub Jelinek wrote: > > > > > > > > On We

Re: [PATCH 1/3][v2] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
On Tue, 30 Jul 2024, Paul Koning wrote: > > > > On Jul 30, 2024, at 6:17 AM, Richard Biener wrote: > > > > The following adds a target hook to specify whether regs of MODE can be > > used to transfer bits. The hook is supposed to be used for value-numbering

[PATCH] middle-end/101478 - ICE with degenerate address during gimplification

2024-07-31 Thread Richard Biener
When we gimplify &MEM[0B + 4] we are re-folding the address in case types are not canonical which ends up with a constant address that recompute_tree_invariant_for_addr_expr ICEs on. Properly guard that call. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR middle-end/1014

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-31 Thread Richard Biener
On Wed, 31 Jul 2024, Uros Bizjak wrote: > On Wed, Jul 31, 2024 at 10:24 AM Jakub Jelinek wrote: > > > > On Wed, Jul 31, 2024 at 10:11:44AM +0200, Uros Bizjak wrote: > > > OK. Richard, can you please mention the above in the comment why > > > XFmode is rejected in the hook? > > > > > > Later, we c

Re: [PATCH] [x86] Mention _Float16 and __bf16 changes in GCC14.

2024-07-31 Thread Richard Biener
On Wed, Jul 31, 2024 at 6:32 AM liuhongt wrote: > > Ok for trunk? OK for www. Richard. > --- > htdocs/gcc-14/changes.html| 7 +++ > htdocs/gcc-14/porting_to.html | 9 + > 2 files changed, 16 insertions(+) > > diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html

Re: [RFA][PR rtl-optimization/116136] Fix previously latent SUBREG simplification bug

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 10:24 PM Jeff Law wrote: > > > This fixes a testsuite regression seen on m68k after some of the recent > ext-dce changes. Ultimately Richard S and I have concluded the bug was > a latent issue in subreg simplification. > > Essentially when simplifying something like > > (s

Re: [Patch] gimplify.cc: Handle VALUE_EXPR of MEM_REF's ADDR_EXPR argument [PR115637]

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 7:33 PM Tobias Burnus wrote: > > Richard Biener wrote: > > On Mon, Jul 29, 2024 at 9:26 PM Tobias Burnus wrote: > >> Inside pass_omp_target_link::execute, there is a call to > >> gimple_regimplify_operands but the value e

Re: [PATCH] c: Add support for unsequenced and reproducible attributes

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 7:05 PM Jakub Jelinek wrote: > > Hi! > > C23 added in N2956 ( https://open-std.org/JTC1/SC22/WG14/www/docs/n2956.htm ) > two new attributes, which are described as similar to GCC const and pure > attributes, but they aren't really same and it seems that even the paper > is

Re: [PATCH 1/2] Remove MMX code path in lexer

2024-07-31 Thread Richard Biener
On Tue, Jul 30, 2024 at 5:43 PM Andi Kleen wrote: > > From: Andi Kleen > > Host systems with only MMX and no SSE2 should be really rare now. > Let's remove the MMX code path to keep the number of custom > implementations the same. > > The SSE2 code path is also somewhat dubious now (nearly everyt

Re: [PATCH 2/2] Add AVX2 code path to lexer

2024-07-30 Thread Richard Biener
> Am 30.07.2024 um 19:22 schrieb Alexander Monakov : > >  > On Tue, 30 Jul 2024, Andi Kleen wrote: >>> I have looked at this code before. When AVX2 is available, so is SSSE3, >>> and then a much more efficient approach is available: instead of comparing >>> against \r \n \\ ? one-by-one, build

[PATCH] c/106800 - support vector condition operation in C

2024-07-30 Thread Richard Biener
The following adds support for vector conditionals in C. The support was nearly there already but c_objc_common_truthvalue_conversion rejecting vector types. Instead of letting them pass there unchanged I chose to instead skip it when parsing conditionals instead as a variant with less possible f

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Alexander Monakov wrote: > > On Tue, 30 Jul 2024, Richard Biener wrote: > > > > Oh, and please add a small comment why we don't use XFmode here. > > > > Will do. > > > > /* Do not enable XFmode, there is p

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Jakub Jelinek wrote: > On Tue, Jul 30, 2024 at 02:26:05PM +0200, Richard Biener wrote: > > > > (Which implies that we should introduce TARGET_I387_MATH to parallel > > > > TARGET_SSE_MATH some day...) > > > > > > > &g

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Filip Kastl wrote: > > > > Ah, I see you fix those up. Then 2.) is left - the final block. Iff > > > > the final block needs adjustment you know there was a path from > > > > the default case to it which means one of its predecessors is dominated > > > > by the default case?

Re: [PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Uros Bizjak wrote: > On Tue, Jul 30, 2024 at 1:07 PM Uros Bizjak wrote: > > > > On Tue, Jul 30, 2024 at 12:18 PM Richard Biener wrote: > > > > > > The following implements the hook, excluding x87 modes for scalar > > > and complex

Re: [PATCH] middle-end: Add and use few helper methods for current_properties

2024-07-30 Thread Richard Biener
On Sat, Jul 27, 2024 at 4:29 AM Andrew Pinski wrote: > > While working on isel, I found that the current way of doing > current_properties > in function can easily make a mistake and having to do stuff like `(a & b ) > == 0` > and `a |= b;` and `a &= ~b;` is not so obvious what was going on. > S

Re: [PATCH v1] gcc/: Rename array_type_nelts() => array_type_nelts_minus_one()

2024-07-30 Thread Richard Biener
* cp/tree.cc: Likewise. > * expr.cc: Likewise. > * fortran/trans-array.cc: Likewise. > * fortran/trans-openmp.cc: Likewise. > * rust/backend/rust-tree.cc: Likewise. > > Suggested-by: Richard Biener > Signed-off-by: Alejandro Col

[PATCH 3/3][v2] tree-optimization/114659 - VN and FP to int punning

2024-07-30 Thread Richard Biener
The following addresses another case where x87 FP loads mangle the bit representation and thus are not suitable for a representative in other types. VN was value-numbering a later integer load of 'x' as the same as a former float load of 'x'. We can use the new TARGET_MODE_CAN_TRANSFER_BITS hook

[PATCH 2/3][x86][v2] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
The following implements the hook, excluding x87 modes for scalar and complex float modes. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK? Thanks, Richard. * i386.cc (TARGET_MODE_CAN_TRANSFER_BITS): Define. (ix86_mode_can_transfer_bits): New function. --- gcc/config/i3

[PATCH 1/3][v2] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
The following adds a target hook to specify whether regs of MODE can be used to transfer bits. The hook is supposed to be used for value-numbering to decide whether a value loaded in such mode can be punned to another mode instead of re-loading the value in the other mode and for SRA to decide whe

RE: [RFC][middle-end] SLP Early break and control flow support in GCC

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Tamar Christina wrote: > > -Original Message- > > From: Richard Biener > > Sent: Thursday, July 18, 2024 10:00 AM > > To: Tamar Christina > > Cc: GCC Patches ; Richard Sandiford > > > > Subject: RE: [RFC][middle-end] S

Re: Support streaming of poly_int for offloading when it's degree <= accel's NUM_POLY_INT_COEFFS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Richard Sandiford wrote: > Richard Biener writes: > > On Tue, 30 Jul 2024, Richard Sandiford wrote: > > > >> Richard Biener writes: > >> > On Tue, 30 Jul 2024, Prathamesh Kulkarni wrote: > >> > > >> >> > &

Re: Support streaming of poly_int for offloading when it's degree <= accel's NUM_POLY_INT_COEFFS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Richard Sandiford wrote: > Richard Biener writes: > > On Tue, 30 Jul 2024, Prathamesh Kulkarni wrote: > > > >> > >> > >> > -Original Message- > >> > From: Richard Sandiford > >> > Sent: Monday, J

Re: [PATCH v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103]

2024-07-30 Thread Richard Biener
On Tue, Jul 30, 2024 at 5:08 AM wrote: > > From: Pan Li > > For some target like target=amdgcn-amdhsa, we need to take care of > vector bool types prior to general vector mode types. Or we may have > the asm check failure as below. > > gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_

Re: [Patch] gimplify.cc: Handle VALUE_EXPR of MEM_REF's ADDR_EXPR argument [PR115637]

2024-07-30 Thread Richard Biener
On Mon, Jul 29, 2024 at 9:26 PM Tobias Burnus wrote: > > The problem is code like: > >MEM [(c_char * {ref-all})&arr2] > > where arr2 is the value expr '*arr2$13$linkptr' > (i.e. indirect ref + decl name). > > Insidepass_omp_target_link::execute, there is a call to > gimple_regimplify_operands

RE: Support streaming of poly_int for offloading when it's degree <= accel's NUM_POLY_INT_COEFFS

2024-07-30 Thread Richard Biener
On Tue, 30 Jul 2024, Prathamesh Kulkarni wrote: > > > > -Original Message- > > From: Richard Sandiford > > Sent: Monday, July 29, 2024 9:43 PM > > To: Richard Biener > > Cc: Prathamesh Kulkarni ; gcc- > > patc...@gcc.gnu.org > >

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-30 Thread Richard Biener
On Mon, 29 Jul 2024, Filip Kastl wrote: > Hi Richard, > > > > Sorry, I'm not sure if I understand. Are you suggesting something like > > > this? > > > > > > if (idom(default bb) == cond bb) > > > { > > > if (exists a path from default bb to final bb) > > > { > > > idom(final bb) = cond

Re: [PATCH 1/3] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-30 Thread Richard Biener
On Mon, 29 Jul 2024, Richard Sandiford wrote: > Richard Biener writes: > > On Mon, 29 Jul 2024, Jakub Jelinek wrote: > >> And, for the GET_MODE_INNER, I also meant it for Aarch64/RISC-V VL vectors, > >> I think those should be considered as true by the hook, not

Re: [PATCH 1/3] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-29 Thread Richard Biener
On Mon, 29 Jul 2024, Jakub Jelinek wrote: > On Mon, Jul 29, 2024 at 02:52:24PM +0200, Richard Biener wrote: > > > mode = GET_MODE_INNER (mode); > > > ? > > > > I specifically wanted to avoid this (at least for the purpose of the > > hook). > > &g

Re: [PATCH 2/3] [x86] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-29 Thread Richard Biener
On Mon, 29 Jul 2024, Richard Biener wrote: > The following implements the hook, excluding x87 modes. Jakub correctly pointed out complex modes, so I've adjusted the hook to the following which might be easier to parse (and handles decimal FP modes as returning true). Re-testing in

Re: [PATCH 1/3] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-29 Thread Richard Biener
On Mon, 29 Jul 2024, Jakub Jelinek wrote: > On Mon, Jul 29, 2024 at 02:14:40PM +0200, Richard Biener wrote: > > The following adds a target hook to specify whether regs of MODE can be > > used to transfer bits. The hook is supposed to be used for value-numbering > > to d

[PATCH 3/3] tree-optimization/114659 - VN and FP to int punning

2024-07-29 Thread Richard Biener
The following addresses another case where x87 FP loads mangle the bit representation and thus are not suitable for a representative in other types. VN was value-numbering a later integer load of 'x' as the same as a former float load of 'x'. We can use the new TARGET_MODE_CAN_TRANSFER_BITS hook

[PATCH 2/3] [x86] implement TARGET_MODE_CAN_TRANSFER_BITS

2024-07-29 Thread Richard Biener
The following implements the hook, excluding x87 modes. * i386.cc (TARGET_MODE_CAN_TRANSFER_BITS): Define. (ix86_mode_can_transfer_bits): New function. --- gcc/config/i386/i386.cc | 11 +++ 1 file changed, 11 insertions(+) diff --git a/gcc/config/i386/i386.cc b/gcc/config

[PATCH 1/3] Add TARGET_MODE_CAN_TRANSFER_BITS

2024-07-29 Thread Richard Biener
The following adds a target hook to specify whether regs of MODE can be used to transfer bits. The hook is supposed to be used for value-numbering to decide whether a value loaded in such mode can be punned to another mode instead of re-loading the value in the other mode and for SRA to decide whe

Re: Support streaming of poly_int for offloading when it's degree <= accel's NUM_POLY_INT_COEFFS

2024-07-29 Thread Richard Biener
upper bound, like 2? Maybe even have MAX_NUM_POLY_INT_COEFFS or NUM_POLY_INT_COEFFS_BITS in poly-int.h and constrain NUM_POLY_INT_COEFFS. The patch looks reasonable over all, but Richard S. should have a say about the abstraction you chose and the poly-int adjustment. Thanks, Richard. > S

Re: [RFC v1 1/2] Merge definitions of array_type_nelts_top()

2024-07-29 Thread Richard Biener
On Mon, Jul 29, 2024 at 10:55 AM Alejandro Colomar wrote: > > Hi Richard, > > On Mon, Jul 29, 2024 at 10:27:35AM GMT, Richard Biener wrote: > > On Sun, Jul 28, 2024 at 4:16 PM Alejandro Colomar wrote: > > > > > > There were two identical definitions, and no

Re: [PATCH v1] Widening-Mul: Try .SAT_SUB for PLUS_EXPR when one op is IMM

2024-07-29 Thread Richard Biener
On Sun, Jul 28, 2024 at 5:25 AM wrote: > > From: Pan Li > > After add the matching for .SAT_SUB when one op is IMM, there > will be a new root PLUS_EXPR for the .SAT_SUB pattern. For example, > > Form 3: > #define DEF_SAT_U_SUB_IMM_FMT_3(T, IMM) \ > T __attribute__((noinline)) \

Re: [PATCH] MATCH: add abs support for half float

2024-07-29 Thread Richard Biener
On Mon, Jul 29, 2024 at 10:11 AM Andrew Pinski wrote: > > On Mon, Jul 29, 2024 at 12:57 AM Kugan Vivekanandarajah > wrote: > > > > On Thu, Jul 25, 2024 at 10:19 PM Richard Biener > > wrote: > > > > > > On Thu, Jul 25, 2024 at 4:42 AM Kugan Vivekana

Re: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103]

2024-07-29 Thread Richard Biener
On Mon, Jul 29, 2024 at 9:57 AM wrote: > > From: Pan Li > > For some target like target=amdgcn-amdhsa, we need to take care of > vector bool types prior to general vector mode types. Or we may have > the asm check failure as below. > > gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_

Re: [RFC v1 1/2] Merge definitions of array_type_nelts_top()

2024-07-29 Thread Richard Biener
On Sun, Jul 28, 2024 at 4:16 PM Alejandro Colomar wrote: > > There were two identical definitions, and none of them are available > where they are needed for implementing _Lengthof(). Merge them, and > provide the single definition in gcc/tree.{h,cc}, where it's available > for _Lengthof(). > > S

Re: [PATCH] gcc: Make exec-tool.in handle missing Binutils more gracefully

2024-07-28 Thread Richard Biener
> Am 28.07.2024 um 16:27 schrieb Jonathan Wakely : > > Bootstrapped on x86_64-linux and for msp430-elf cross with and without > binutils for the target to verify the error is printed as expected. > > The $invoked variable will be one of as, collect-ld, nm, or dsymutil, > i.e. the tool that th

Re: [PATCH 2/2] testsuite: fix dg-add-options vs. dg-options ordering

2024-07-27 Thread Richard Biener
> Am 28.07.2024 um 01:34 schrieb Sam James : > > Per gccint, dg-add-options must be placed after all dg-options directives. > > gcc/testsuite/ChangeLog: > >* gcc.target/riscv/rvv/base/cmpmem-2.c: Fix dg-add-options order. Ok for both patches Richard > --- > Simple dejagnu directive f

Re: [PATCH 2/2] middle-end: Move the function current properties over to a .def file [PR116118]

2024-07-27 Thread Richard Biener
> Am 28.07.2024 um 06:41 schrieb Andrew Pinski : > > While doing some other cleanups with the properties I noticed that > debug_properties > was not updated for some of the new properties. So instead of just updating > the function, > this moves the properties over to its own .def file so we

Re: [PATCH v1] Match: Support .SAT_SUB with IMM op for form 1-4

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 11:20 AM wrote: > > From: Pan Li > > This patch would like to support .SAT_SUB when one of the op > is IMM. Aka below 1-4 forms. > > Form 1: > #define DEF_SAT_U_SUB_IMM_FMT_1(T, IMM) \ > T __attribute__((noinline)) \ > sat_u_sub_imm##IMM##_##T##_fmt_1 (T y)

Re: [PATCH v3 2/2] Prevent divide-by-zero

2024-07-26 Thread Richard Biener
On Thu, May 30, 2024 at 2:11 AM Patrick O'Neill wrote: > > From: Greg McGary > > gcc/ChangeLog: > * gcc/tree-vect-stmts.cc (gcc/tree-vect-stmts.cc): Prevent > divide-by-zero. > * testsuite/gcc.target/riscv/rvv/autovec/no-segment.c: Remove dg-ice. > --- > No changes in v3. Depends

Re: [PATCH] fold: Allow SSA names in inverse_conditions_p and fold VCOND_MASK.

2024-07-26 Thread Richard Biener
On Thu, Jul 25, 2024 at 3:34 PM Robin Dapp wrote: > > Hi, > > In preparation for the maskload else operand I split off this patch. The > patch > looks through SSA names for the conditions passed to inverse_conditions_p > which > helps match.pd recognize more redundant vec_cond expressions. It

Re: [RFC] Generalize formation of lane-reducing ops in loop reduction

2024-07-26 Thread Richard Biener
On Sun, Jul 21, 2024 at 11:12 AM Feng Xue OS wrote: > > Hi, > > I composed some patches to generalize lane-reducing (dot-product is a > typical representative) pattern recognition, and prepared a RFC document so > as to help > review. The original intention was to make a complete solution for

Re: [RFC][PATCH 1/5] vect: Fix single_imm_use in tree_vect_patterns

2024-07-26 Thread Richard Biener
On Sun, Jul 21, 2024 at 11:15 AM Feng Xue OS wrote: > > The work for RFC > (https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657860.html) > involves not a little code change, so I have to separate it into several > batches > of patchset. This and the following patches constitute the first bat

Re: [PATCH v2] gimple ssa: Teach switch conversion to optimize powers of 2 switches

2024-07-26 Thread Richard Biener
On Thu, 18 Jul 2024, Filip Kastl wrote: > On Thu 2024-07-18 12:07:42, Richard Biener wrote: > > On Wed, 17 Jul 2024, Filip Kastl wrote: > > > > > + } > > > > > + > > > > > + vec v; > > > >

Re: [PATCH]AArch64: check for vector mode in get_mask_mode [PR116074]

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 1:15 PM Richard Sandiford wrote: > > Tamar Christina writes: > >> -Original Message- > >> From: Richard Sandiford > >> Sent: Friday, July 26, 2024 10:43 AM > >> To: Tamar Christina > >> Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw > >> ; Marcus Shawcroft >

Re: [PATCH] i386: Mark target option with optimization when enabled with opt level [PR116065]

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 10:50 AM Hongyu Wang wrote: > > Hi, > > When introducing munroll-only-small-loops, the option was marked as > Target Save and added to -O2 default which makes attribute(optimize) > resets target option and causing error when cmdline has O1 and > funciton attribute has O2 an

Re: [PATCH v2] i386: Fix AVX512 intrin macro typo

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 10:14 AM Haochen Jiang wrote: > > Hi all, > > I have added related testcases into the patch. > > Ok for trunk and backport to GCC 14, GCC 13 and GCC 12? Hmm, it might be OK for 14.2 still, even without a new RC. But please wait until after 14.2 is released unless Jakub al

Re: [PATCH v1 1/2] PR116080: Fix tail call dejagnu checks

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 12:55 AM Andi Kleen wrote: > > From: Andi Kleen > > - Run the target_effective tail_call checks without optimization to > match the actual test cases. > - Add an extra check for external tail calls to handle targets like > powerpc that cannot tail call between different ob

Re: [PATCH v1 2/2] PR116019: Improve tail call error message

2024-07-26 Thread Richard Biener
On Fri, Jul 26, 2024 at 12:55 AM Andi Kleen wrote: > > From: Andi Kleen > > The "tail call must be the same type" message is common on some > targets with C++, or without optimization. It is generated > when gcc believes there is an access of the return value > after the call. However usually it

Re: [PATCH]middle-end: check for vector mode before in get_mask_mode [PR116074]

2024-07-26 Thread Richard Biener
> Am 26.07.2024 um 11:40 schrieb Tamar Christina : > > Hi All, > > For historical reasons AArch64 has TI mode vector types but does not consider > TImode a vector mode. > > What's happening in the PR is that get_vectype_for_scalar_type is returning > vector(1) TImode for a TImode scalar. Th

Re: [PATCH]AArch64: check for vector mode in get_mask_mode [PR116074]

2024-07-26 Thread Richard Biener
> Am 26.07.2024 um 11:29 schrieb Tamar Christina : > >  >> >> -Original Message- >> From: Richard Sandiford >> Sent: Friday, July 26, 2024 10:24 AM >> To: Tamar Christina >> Cc: gcc-patches@gcc.gnu.org; nd ; Richard Earnshaw >> ; Marcus Shawcroft >> ; ktkac...@gcc.gnu.org >> Subject

Re: [PATCH 2/3] isel: Small cleanup of duplicating comparisons

2024-07-25 Thread Richard Biener
On Fri, Jul 26, 2024 at 6:37 AM Andrew Pinski wrote: > > This is a small cleanup of the duplicating comparison code. > There is code generation difference but only for -O0 and -fno-tree-ter > (both of which will be fixed in a later patch). > The difference is instead of skipping the first use if t

Re: [PATCH 1/3] isel: Move duplicate comparisons to its own function

2024-07-25 Thread Richard Biener
On Fri, Jul 26, 2024 at 6:37 AM Andrew Pinski wrote: > > This is just a small cleanup to isel and no functional changes just. > The loop inside pass_gimple_isel::execute looked was getting too > deap so let's fix that by moving it to its own function. > > Bootstrapped and tested on x86_64-linux-gn

Re: [PATCH 3/3] isel: Don't duplicate comparisons for -O0 nor -fno-tree-ter [PR116101]

2024-07-25 Thread Richard Biener
On Fri, Jul 26, 2024 at 6:37 AM Andrew Pinski wrote: > > While doing cleanups on this code I noticed that we do the duplicate > of comparisons at -O0. For C and C++ code this makes no difference as > the gimplifier never produces COND_EXPR. But it could make a difference > for other front-ends. >

Re: [PATCH] MATCH: Optimize `VEC_SHL_INSERT (dup (A), A)` to just `dup (A) [PR116075]

2024-07-25 Thread Richard Biener
On Thu, Jul 25, 2024 at 10:57 PM Andrew Pinski wrote: > > On Thu, Jul 25, 2024 at 10:20 AM Richard Biener > wrote: > > > > > > > > > Am 25.07.2024 um 17:56 schrieb Andrew Pinski : > > > > > > It was noticed if we have `.VEC_SHL_INSERT ({ 0,

Re: [PATCH] aarch64: Fix target/optimize option handling with transiting between O1 to O2

2024-07-25 Thread Richard Biener
On Thu, Jul 25, 2024 at 10:25 PM Andrew Pinski wrote: > > The problem here is the aarch64 backend enables -mearly-ra at -O2 and above > but > it is not marked as an Optimization in the .opt file so enabling it sometimes > reset the target options when going from -O1 to -O2 for the first time. > >

Re: [PATCH] MATCH: Optimize `VEC_SHL_INSERT (dup (A), A)` to just `dup (A) [PR116075]

2024-07-25 Thread Richard Biener
> Am 25.07.2024 um 17:56 schrieb Andrew Pinski : > > It was noticed if we have `.VEC_SHL_INSERT ({ 0, ... }, 0)` it was not being > simplified to just `{ 0, ... }`. This was generated from the autovectorizer > (maybe even on accident, see PR tree-optmization/116081). > > This adds a few SVE t

[PATCH] tree-optimization/116083 - improve behavior when SLP discovery limit is reached

2024-07-25 Thread Richard Biener
The following avoids some useless work when the SLP discovery limit is reached, for example allocating a node to cache the failure and starting discovery on split store groups when analyzing BBs. It does not address the issue in the PR which is a gratious budget for discovery when the store group

Re: [PATCH] doc: Document -O1 as the preferred level for large machine-generated code

2024-07-25 Thread Richard Biener
On Tue, Jul 23, 2024 at 4:07 PM Sam James wrote: > > At -O1, the intention is that we compile things in a "reasonable" amount > of time (ditto memory use). In particular, we try to especially avoid > optimizations which scale poorly on pathological cases, as is the case > for large machine-generat

Re: [PATCH] MATCH: add abs support for half float

2024-07-25 Thread Richard Biener
On Thu, Jul 25, 2024 at 4:42 AM Kugan Vivekanandarajah wrote: > > On Tue, Jul 23, 2024 at 11:56 PM Richard Biener > wrote: > > > > On Tue, Jul 23, 2024 at 10:27 AM Kugan Vivekanandarajah > > wrote: > > > > > > On Tue, Jul 23, 2024 at 10:35 AM Andrew

Re: [PATCH 5/5] MATCH: Add an alt pattern for ANDN and IORN with constants

2024-07-25 Thread Richard Biener
On Thu, Jul 25, 2024 at 4:18 AM Andrew Pinski wrote: > > With constants we can match `~(a | CST)` into `CST & ~a`. > Likewise `~(a & CST)` into `CST | ~a`. > > Built and tested for aarch64-linux-gnu with no regressions. Similar, I think this should be in ISEL instead. > PR target/116013

Re: [PATCH 4/5] MATCH: Create BIT_ANDN and BIT_IORN from matching

2024-07-25 Thread Richard Biener
On Thu, Jul 25, 2024 at 4:16 AM Andrew Pinski wrote: > > To better create rtl directly from gimple, we can use > these already internal functions from the gimple. > > That is simplify `a & ~b` into BIT_ANDN. > Likewise `a | ~b` into BIT_IORN. > We only want to do this late after vectorization as s

[PATCH] tree-optimization/116081 - typedef vs. non-typedef in vectorization

2024-07-25 Thread Richard Biener
The following fixes the code generation difference when using a typedef for the scalar type. The issue is using a pointer equality test for an INTEGER_CST which fails when the types are different variants. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/

[PATCH] tree-optimization/116079 - store motion and clobbers

2024-07-25 Thread Richard Biener
When we move a store out of an inner loop and remove a clobber in the process, analysis of the inner loop can run into the clobber via the meta-data and crash when accessing its basic-block. The following avoids this by clearing the VDEF which is how it identifies already processed stores. Bootst

<    1   2   3   4   5   6   7   8   9   10   >