[PATCH 1/3] MATCH: Fix zero_one_valued_p's convert pattern

2023-12-01 Thread Andrew Pinski
(zero_one_valued_p): For convert make sure type is not a signed 1-bit integer. Signed-off-by: Andrew Pinski --- gcc/match.pd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/match.pd b/gcc/match.pd index 26383e55767..4d554ba4721 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2247,6

[PATCH 2/3] Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare.

2023-12-01 Thread Andrew Pinski
From: Andrew Pinski The check for the type seems unnecessary and gets in the way sometimes. Also with a patch I am working on for match.pd, it causes a failure to happen. Before my patch the IR was: _1 = BIT_FIELD_REF ; _2 = _1 & 1; _3 = _2 != 0; _4 = (int) _3; __analyzer_eval

[PATCH 0/3] Fix PR 111972

2023-12-01 Thread Andrew Pinski
nvert)(zero_one == 1)`). Signed-off-by: Andrew Pinski Andrew Pinski (3): MATCH: Fix zero_one_valued_p's convert pattern Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare. MATCH: (convert)(zero_one !=/== 0/1) for outer type and zero_one type are the same gc

[PATCH 3/3] MATCH: (convert)(zero_one !=/== 0/1) for outer type and zero_one type are the same

2023-12-01 Thread Andrew Pinski
New test. * gcc.dg/tree-ssa/pr69270.c: Update testcase. * gcc.target/i386/pr110790-2.c: Update testcase. Signed-off-by: Andrew Pinski --- gcc/match.pd | 21 + gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c | 10 +++ gcc/testsuite/gcc.dg/

Re: [PATCH v2 3/7] aarch64: Add eh_return compile tests

2023-12-02 Thread Andrew Pinski
On Fri, Nov 3, 2023 at 8:37 AM Szabolcs Nagy wrote: > > gcc/testsuite/ChangeLog: > > * gcc.target/aarch64/eh_return-2.c: New test. > * gcc.target/aarch64/eh_return-3.c: New test. gcc.target/aarch64/eh_return-3.c fails when running the testsuite with `-march=armv9-a+sve` . I think

Re: [PATCH] pro_and_epilogue: Call df_note_add_problem () if SHRINK_WRAPPING_ENABLED [PR112760]

2023-12-03 Thread Andrew Pinski
On Sat, Dec 2, 2023 at 3:04 AM Richard Sandiford wrote: > > Jakub Jelinek writes: > > Hi! > > > > The following testcase ICEs on x86_64-linux since df_note_add_problem () > > call has been added to mode switching. > > The problem is that the pro_and_epilogue pass in > > prepare_shrink_wrap -> cop

Re: [RFC PATCH 1/1] nix: add a simple flake nix shell

2023-12-04 Thread Andrew Pinski
On Mon, Dec 4, 2023 at 4:58 PM Vincenzo Palazzo wrote: > > This commit is specifically targeting enhancements in > Nix support for GCC development. This initiative stems > from the recognized need within our community for a more > streamlined and efficient development process when using Nix. I th

Re: [PATCH] libsupc++: try cxa_thread_atexit_impl at runtime

2023-12-05 Thread Andrew Pinski
On Tue, Dec 5, 2023 at 3:15 PM David Edelsohn wrote: > > The error is: > > ld: 0711-317 ERROR: Undefined symbol: __cxa_thread_atexit_impl > > > from the new, weak reference. By the way this seems like the same issue on nvptx too. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112858 which has a

[PATCH] aarch64: Fix wrong code for bfloat when f16 is enabled [PR 111867]

2023-12-10 Thread Andrew Pinski
(aarch64_float_const_representable_p): For BFmode, only accept +0.0. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64.cc | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 5cffdabc62e..d48f5a1ba4b 100644 --- a/gcc/config/aarch64/aarch64

[PATCH] expr: catch more `a*bool` while expanding [PR 112935]

2023-12-10 Thread Andrew Pinski
cast and also and an `&`. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/112935 * expr.cc (expand_expr_real_2): Use gimple_zero_one_valued_p instead of tree_nonzero_bits to find boolean defined expressions. Signed-off-by: Andr

[PATCHv2 0/2] Fix PR 111972: Missed vectorization due to phiopt changes

2023-12-10 Thread Andrew Pinski
canonical form of `(convert_back)(zero_one == 0)` (and `(convert_back)(zero_one != 1)`). * `(convert)a` is the canonical form of `(convert)(zero_one != 0)` (and `(convert)(zero_one == 1)`). Andrew Pinski (2): Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare. MATCH: (convert

[PATCHv2 2/2] MATCH: (convert)(zero_one !=/== 0/1) for outer type and zero_one type are the same

2023-12-10 Thread Andrew Pinski
sa/pr69270.c: Update testcase. * gcc.target/i386/pr110790-2.c: Update testcase. * gcc.dg/fold-even-1.c: Removed. Signed-off-by: Andrew Pinski --- gcc/fold-const.cc | 27 - gcc/match.pd | 16 ++ gcc/testsuite

[PATCH 1/2] analyzer: Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare.

2023-12-10 Thread Andrew Pinski
From: Andrew Pinski The check for the type seems unnecessary and gets in the way sometimes. Also with a patch I am working on for match.pd, it causes a failure to happen. Before my patch the IR was: _1 = BIT_FIELD_REF ; _2 = _1 & 1; _3 = _2 != 0; _4 = (int) _3; __analyzer_eval

Re: [PATCH] -finline-stringops: don't assume ptr_mode ptr in memset [PR112804]

2023-12-10 Thread Andrew Pinski
that are 32bit (zero-extended IIRC). IA64 HPUX has a similar mode to AARCH64:ILP32 but I doubt anyone tests that any more or even supported; it is also where most of the original testing for Pmode!=ptr_mode happened. PowerPC64 has a mode where Pmode==ptr_mode==SImode but word_mode==DImode; this kin

Re: [r14-6420 Regression] FAIL: gcc.target/i386/pr110790-2.c scan-assembler-times shrq 2 on Linux/x86_64

2023-12-11 Thread Andrew Pinski
On Mon, Dec 11, 2023, 21:48 Jiang, Haochen wrote: > > -Original Message- > > From: Jiang, Haochen > > Sent: Tuesday, December 12, 2023 9:11 AM > > To: Andrew Pinski (QUIC) ; haochen.jiang > > ; gcc-regress...@gcc.gnu.org; gcc- > > patc...@gcc.gnu.org &

Re: [PATCH] Treat "p" in asms as addressing VOIDmode

2023-12-11 Thread Andrew Pinski
On Mon, Dec 11, 2023 at 11:46 AM Richard Sandiford wrote: > > Jeff Law writes: > > On 11/27/23 05:12, Richard Sandiford wrote: > >> check_asm_operands was inconsistent about how it handled "p" after > >> RA compared to before RA. Before RA it tested the address with a > >> void (unknown) memory

Re: [PATCH] aarch64: enable mixed-types for aarch64 simdclones

2023-12-12 Thread Andrew Pinski
N2ua32vl_setArray" "optimized { target aarch64*-*-* } } " ERROR: gcc.dg/gomp/simd-clones-2.c: unmatched open quote in list for " dg-final 19 { scan-tree-dump "_ZGVnN2ua32vl_setArray" "optimized { target aarch64*-*-* } } " Looks like you forgot the comment operand to dg-warning. And you forgot the end quote after `"optimized` in those scan-tree-dump. My suggestion is to use contrib/test_summary next time to errors like this. Thanks, Andrew Pinski Thanks, Andrew Pinski

[PATCH] aarch64/expr: Use ccmp when the outer expression is used twice [PR100942]

2023-12-12 Thread Andrew Pinski
_ccmp_expr): Update call to ccmp_candidate_p. * cfgexpand.cc (expand_gimple_stmt_1): Try using ccmp for binary assignments. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ccmp_3.c: New test. * gcc.target/aarch64/ccmp_4.c: New test. Signed-off-by: Andrew Pinski --- g

Re: [PATCH] aarch64/expr: Use ccmp when the outer expression is used twice [PR100942]

2023-12-12 Thread Andrew Pinski
On Tue, Dec 12, 2023 at 12:22 AM Andrew Pinski wrote: > > Ccmp is not used if the result of the and/ior is used by both > a GIMPLE_COND and a GIMPLE_ASSIGN. This improves the code generation > here by using ccmp in this case. > Two changes is required, first we need to allow the ou

Re: [PATCH] Simplify vector ((VCE?(a cmp b ? -1 : 0)) < 0) ? c : d to just (VCE:a cmp VCE:b) ? c : d.

2023-11-09 Thread Andrew Pinski
On Thu, Nov 9, 2023 at 5:52 PM liuhongt wrote: > > When I'm working on PR112443, I notice there's some misoptimizations: after we > fold _mm{,256}_blendv_epi8/pd/ps into gimple, the backend fails to combine it > back to v{,p}blendv{v,ps,pd} since the pattern is too complicated, so I think > maybe

Re: [PATCH v3 2/2]middle-end match.pd: optimize fneg (fabs (x)) to copysign (x, -1) [PR109154]

2023-11-10 Thread Andrew Pinski
On Fri, Nov 10, 2023 at 5:12 AM Richard Biener wrote: > > On Fri, 10 Nov 2023, Tamar Christina wrote: > > > > > Hi Prathamesh, > > > > Yes Arm requires SIMD for copysign. The testcases fail because they don't > > turn on Neon. > > > > I'll update them. > > On x86_64 with -m32 I see > > FAIL: gcc.

Re: [PATCH] Fix (fcopysign x, NEGATIVE_CONST) -> (fneg (fabs x)) simplification [PR112483]

2023-11-12 Thread Andrew Pinski
he internals document too. The gimple level Canonical forms are not documented yet; I started writing some of it on the wiki though: https://gcc.gnu.org/wiki/GimpleCanonical . Thanks, Andrew Pinski > Thanks, > Tamar > > > > OK. > > > > > gcc/ChangeLog:

Re: [PATCH v3 0/2] Replace intl/ with out-of-tree GNU gettext

2023-11-19 Thread Andrew Pinski
On Sun, Nov 19, 2023 at 3:01 PM Bruno Haible wrote: > > I wrote: > > you (Arsen) should state in the documentation > > (gcc/doc/install.texi) that for --disable-threads to have this effect, > > one needs gettext version 0.22.4 or newer. > > Not in gcc/doc/install.texi, but elsewhere. This topic is

Re: [PATCH]AArch64 Add pattern for unsigned widenings (uxtl) to zip{1, 2}

2023-11-21 Thread Andrew Pinski
On Wed, Nov 15, 2023 at 6:42 AM Tamar Christina wrote: > > Hi All, > > This changes unpack instructions to use zip{1,2} when doing a zero-extending > widening operation. Permutes generally have a higher throughput than the > widening operations. Zeros are shuffled into the top half of the registe

Re: [PATCH]AArch64 Add pattern for unsigned widenings (uxtl) to zip{1, 2}

2023-11-21 Thread Andrew Pinski
On Tue, Nov 21, 2023 at 2:43 PM Andrew Pinski wrote: > > On Wed, Nov 15, 2023 at 6:42 AM Tamar Christina > wrote: > > > > Hi All, > > > > This changes unpack instructions to use zip{1,2} when doing a zero-extending > > widening operation. Permutes gene

[PATCH] Fix gcc.target/aarch64/movk.c testcase after IPA-VRP improvement for return values

2023-11-21 Thread Andrew Pinski
This fixes the testcase. gcc/testsuite/ChangeLog: * gcc.target/aarch64/movk.c: Add noipa on dummy_number_generator and remove -fno-inline option. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.target/aarch64/movk.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH] Fix gcc.target/aarch64/movk.c testcase after IPA-VRP improvement for return values

2023-11-21 Thread Andrew Pinski
This fixes the testcase. gcc/testsuite/ChangeLog: * gcc.target/aarch64/movk.c: Add noipa on dummy_number_generator and remove -fno-inline option. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.target/aarch64/movk.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

Re: [PATCH 1/2] testsuite/unroll-8: Avoid triggering undefined behavior

2023-11-22 Thread Andrew Pinski
sting but we should be clear in the changelog that this is NOT undefined behavior. Thanks, Andrew Pinski > > gcc/testsuite/ChangeLog: > > * gcc.dg/unroll-8.c: Remove UB. > --- > I didn't tes this, but it seems trivial enough that I'm just going to > throw it a

Re: [PATCH] gimple-vr-values:Add constraint for gimple-cond optimization

2023-11-22 Thread Andrew Pinski
with ``` To match instead by changing the second @1 with @4 and then using bitwise_equal_p . If @1 != @4 but bitwise_equal_p is true, you need to make sure the outer convert1/convert2 are nop conversions so that you get the same extension I think ... Note you could instead improve minmax_replacemen

Re: [PATCH] gimple-vr-values:Add constraint for gimple-cond optimization

2023-11-22 Thread Andrew Pinski
replacement. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/zbb-min-max-04.c: New test. One more comment, since this is a generic gimple change, you should add a testcase that is not riscv specific that scans the tree dumps. I would scan phiopt1 in this case to make sure we

Re: Propagate value ranges of return values

2023-11-22 Thread Andrew Pinski
) foo32 () { return 1.0; } -float64_t __attribute__ ((noinline)) +float64_t __attribute__ ((noipa)) foo64 () { return 1.0; Thanks, Andrew Pinski > > diff --git a/gcc/testsuite/gcc.target/aarch64/movk.c > b/gcc/testsuite/gcc.target/aarch64/movk.c > index e6e4e3a8961..6b1

[PATCH 2/2] Fix gcc.target/aarch64/simd/vmulxd_{f64, f32}_2.c after after IPA-VRP improvement for return values

2023-11-25 Thread Andrew Pinski
Just like the patch against gcc.target/aarch64/movk.c, the issue here is the two functions, foo32 and foo64 needed to mark as noipa so that IPA-VRP cannot propagate the return value. gcc/testsuite/ChangeLog: * gcc.target/aarch64/simd/vmulx.x (foo32): Mark as noipa rather than noin

[PATCH 1/2] Fix contracts-tmpl-spec2.C on targets where plain char is unsigned by default

2023-11-25 Thread Andrew Pinski
Since contracts-tmpl-spec2.C is just testing contracts, I thought it would be better to just add `-fsigned-char` to the options rather than change the testcase to support both cases. Committed after testing on aarch64-linux-gnu. gcc/testsuite/ChangeLog: PR testsuite/108321 * g+

[COMMITTED] Fix gcc.dg/vla-1.c

2023-11-25 Thread Andrew Pinski
* gcc.dg/vla-1.c: Add -fno-ipa-vrp. Remove noipa from f1. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/vla-1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vla-1.c b/gcc/testsuite/gcc.dg/vla-1.c index 12aa314f385..d16e73d1dc3

Re: [PATCH 2/2] testsuite/unroll-8: Disable vectorization for varibale-factor targets

2023-11-25 Thread Andrew Pinski
On Wed, Nov 22, 2023 at 4:18 PM Jeff Law wrote: > > > > On 11/21/23 16:27, Palmer Dabbelt wrote: > > The vectorizer picks up these loops and disables unrolling on targets > > with variable vector factors. That result in better code here, but it > > trips up the unrolling tests. So just disable v

[PATCH] aarch64: Improve cost of `a ? {-,}1 : b`

2023-11-26 Thread Andrew Pinski
r `-1`. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64.cc | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index f6f6f94bf43..63241c5aaa5 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/c

Re: [PATCH] tree-sra: Avoid returns of references to SRA candidates

2023-11-27 Thread Andrew Pinski
On Mon, Nov 27, 2023 at 10:16 AM Martin Jambor wrote: > > Hi, > > The enhancement to address PR 109849 contained an importsnt thinko, > and that any reference that is passed to a function and does not > escape, must also not happen to be aliased by the return value of the > function. This has qui

Re: [r14-5666 Regression] FAIL: gcc.dg/tree-prof/time-profiler-3.c scan-ipa-dump-times profile "Read tp_first_run: 2" 1 on Linux/x86_64

2023-11-27 Thread Andrew Pinski
On Mon, Nov 27, 2023 at 12:00 AM Sebastian Huber wrote: > > On 26.11.23 12:18, haochen.jiang wrote: > > On Linux/x86_64, > > > > 41aacdea55c5d795a7aa195357d966645845d00e is the first bad commit > > commit 41aacdea55c5d795a7aa195357d966645845d00e > > Author: Sebastian Huber > > Date: Mon Nov 20 1

[COMMITTED] Fix time-profiler-3.c after r14-5628-g53ba8d669550d3

2023-11-27 Thread Andrew Pinski
This testcase started to fail after r14-5628-g53ba8d669550d3 because IPA-VRP can now start to figure out the functions return a constant value and there was nothing that profiling needed to profile any more. This disables IPA-VRP for this testcase to be able to profile again. Bootrapped/tested on

[PATCH] aarch64: Improve cost of `a ? {-,}1 : b`

2023-11-27 Thread Andrew Pinski
: * config/aarch64/aarch64.cc (aarch64_if_then_else_costs): Handle csinv/csinc case of 1/-1. gcc/testsuite/ChangeLog: * gcc.target/aarch64/csinc-3.c: New test. Signed-off-by: Andrew Pinski --- gcc/config/aarch64/aarch64.cc | 12 gcc/testsuite/gcc.target

Re: [PATCH] fold-mem-offsets: Fix powerpc64le-linux profiledbootstrap [PR111601]

2023-11-27 Thread Andrew Pinski
New test. > > --- gcc/fold-mem-offsets.cc.jj 2023-11-02 07:49:17.060865772 +0100 > +++ gcc/fold-mem-offsets.cc 2023-11-27 22:47:21.128591332 +0100 > @@ -154,7 +154,7 @@ static int stats_fold_count; > The definition is desired for REG used in INSN. > Return the

Re: [PATCH v2] gimple-match.pd Add more optimization for gimple_cond

2023-11-27 Thread Andrew Pinski
On Mon, Nov 27, 2023 at 6:56 PM Feng Wang wrote: > > The link of PATCH v1: > https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg326661.html > This patch add another condition for gimple-cond optimization. Refer to > the following test case. > int foo1 (int data, int res) > { > res = data &

[PATCH] MATCH: Fix invalid signed boolean type usage

2023-11-27 Thread Andrew Pinski
-optimization/112738 * match.pd (`(nop_convert)-(convert)a`): Reject when the outer type is boolean. Signed-off-by: Andrew Pinski --- gcc/match.pd | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 95225e4ca5f..294e58ebf44 100644

Re: Re: [PATCH v2] gimple-match.pd Add more optimization for gimple_cond

2023-11-27 Thread Andrew Pinski
On Mon, Nov 27, 2023 at 10:04 PM Feng Wang wrote: > > On 2023-11-28 11:06 Andrew Pinski wrote: > >On Mon, Nov 27, 2023 at 6:56 PM Feng Wang > >wrote: > >> > >> The link of PATCH v1: > >> https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg3266

Re: [PATCH] [GCC] match.pd: Simplify rule for bitwise not with casts

2023-11-28 Thread Andrew Pinski
&& !VECTOR_BOOLEAN_TYPE_P (type))) Note this might also cause issues with enum types which sometimes have constrained type ranges. Thanks, Andrew Pinski > + >/* ~A + A -> -1 */ >(simplify > (plus:c (convert? (bit_not @0)) (convert? @0)) > diff --git

[PATCH] MATCH: Simplify `(A ==/!= B) &/| (((cast)A) CMP C)`

2023-09-20 Thread Andrew Pinski
This patch adds support to the pattern for `(A == B) &/| (A CMP C)` where the second A could be casted to a different type. Some were handled correctly if using seperate `if` statements but not if combined with BIT_AND/BIT_IOR. In the case of pr111456-1.c, the testcase would pass if `--param=logica

[PATCH] PHIOPT: Fix minmax_replacement for three way

2023-09-21 Thread Andrew Pinski
So when diamond bb support was added to minmax_replacement in r13-1950-g9bb19e143cfe, the code was not expecting the alt_middle_bb not to exist if it was empty (for threeway_p). So when factor_out_conditional_conversion was used to factor out conversions, it turns out the assumption for alt_midd

Re: [pushed] c++: unroll pragma in templates [PR111529]

2023-09-22 Thread Andrew Pinski
On Fri, Sep 22, 2023 at 6:01 AM Jason Merrill wrote: > > Tested x86_64-pc-linux-gnu, applying to trunk. > > -- 8< -- > > We were failing to handle ANNOTATE_EXPR in tsubst_copy_and_build, leading to > problems with substitution of any wrapped expressions. > > Let's also not tell users that lambda t

[PATCH] PHIOPT: Fix minmax_replacement for three way

2023-09-22 Thread Andrew Pinski
So when diamond bb support was added to minmax_replacement in r13-1950-g9bb19e143cfe, the code was not expecting the alt_middle_bb not to exist if it was empty (for threeway_p). So when factor_out_conditional_conversion was used to factor out conversions, it turns out the assumption for alt_midd

[PATCH] MATCH: Add `(X & ~Y) & Y` and `(X | ~Y) | Y`

2023-09-23 Thread Andrew Pinski
Even though this gets optimized by reassociation, catching it more often will always be better. Note the reason why I didn't add `(X ^ ~Y) ^ Y` is that it gets caught by prefering `~(X ^ Y)` to `(X ^ ~Y)` which then it is caught by the the pattern for `(X ^ Y) ^ Y` already. PR tree-optimi

[PATCH] Fix PR 110386: backprop vs ABSU_EXPR

2023-09-24 Thread Andrew Pinski
The issue here is that when backprop tries to go and strip sign ops, it skips over ABSU_EXPR but ABSU_EXPR not only does an ABS, it also changes the type to unsigned. Since strip_sign_op_1 is only supposed to strip off sign changing operands and not ones that change types, removing ABSU_EXPR here i

Re: [PATCH v3] aarch64: Fine-grained policies to control ldp-stp formation.

2023-09-25 Thread Andrew Pinski
On Mon, Sep 25, 2023 at 12:50 PM Manos Anagnostakis wrote: > > This patch implements the following TODO in gcc/config/aarch64/aarch64.cc > to provide the requested behaviour for handling ldp and stp: > > /* Allow the tuning structure to disable LDP instruction formation > from combining ins

Re: [PATCH v3] aarch64: Fine-grained policies to control ldp-stp formation.

2023-09-25 Thread Andrew Pinski
On Mon, Sep 25, 2023 at 12:59 PM Philipp Tomsich wrote: > > On Mon, 25 Sept 2023 at 21:54, Andrew Pinski wrote: > > > > On Mon, Sep 25, 2023 at 12:50 PM Manos Anagnostakis > > wrote: > > > > > > This patch implements the following TODO in gcc/conf

Re: [PATCH v3] aarch64: Fine-grained policies to control ldp-stp formation.

2023-09-25 Thread Andrew Pinski
On Mon, Sep 25, 2023 at 1:04 PM Andrew Pinski wrote: > > On Mon, Sep 25, 2023 at 12:59 PM Philipp Tomsich > wrote: > > > > On Mon, 25 Sept 2023 at 21:54, Andrew Pinski wrote: > > > > > > On Mon, Sep 25, 2023 at 12:50 PM Manos Anagnostakis > > >

Re: [PATCH] RISC-V: Use stdint-gcc.h in rvv testsuite

2023-09-26 Thread Andrew Pinski
On Tue, Sep 26, 2023 at 10:59 AM Patrick O'Neill wrote: > > stdint.h can be replaced with stdint-gcc.h to resolve some missing > system headers in non-multilib installations. > > Tested using glibc rv32gcv and rv64gcv on r14-4258-gc9837443075. > > gcc/ChangeLog: > > * config/riscv/riscv_ve

[COMMITTED] Fix pr111456-1.c for targets that use unsigned char by default

2023-09-26 Thread Andrew Pinski
This fixes the testcase to use an explicit `signed char` instead of plain `char`. Committed as obvious after a test with a cross to powerpc64-linux-gnu and x86_64-linux-gnu. gcc/testsuite/ChangeLog: PR testsuite/111603 * gcc.dg/tree-ssa/pr111456-1.c: Use `signed char` instead o

Re: [PATCH]middle-end match.pd: optimize fneg (fabs (x)) to x | (1 << signbit(x)) [PR109154]

2023-09-26 Thread Andrew Pinski
On Tue, Sep 26, 2023 at 5:51 PM Tamar Christina wrote: > > Hi All, > > For targets that allow conversion between int and float modes this adds a new > optimization transforming fneg (fabs (x)) into x | (1 << signbit(x)). Such > sequences are common in scientific code working with gradients. > > T

Re: committed [RISC-V]: Harden test scan patterns

2023-09-27 Thread Andrew Pinski
On Wed, Sep 27, 2023 at 1:14 PM Jeff Law wrote: > > > > On 9/27/23 12:22, Joern Rennecke wrote: > > On Wed, 27 Sept 2023 at 18:22, Jeff Law wrote: > > > >> It would help to describe how these patterns were under specified so > >> that folks don't continue to make the same mistake as new tests get

Re: [PATCH] aarch64: Add support for -mcpu=grace

2024-06-26 Thread Andrew Pinski
this is missing from grace but is included in neoverse-v2. Is that expected? Thanks, Andrew Pinski > I have patches tested for the 14, 13, 12, 11 branches as well that I’d like > to push there to make it simpler for our users to target Grace. > They are the same as this one logically, but the

Re: [PATCH v1] Match: Support more forms for the scalar unsigned .SAT_SUB

2024-06-27 Thread Andrew Pinski
On Wed, Jun 19, 2024 at 12:37 AM Li, Pan2 wrote: > > Hi Richard, > > Given almost all unsigned SAT_ADD/SAT_SUB patches are merged, I revisit the > original code pattern aka zip benchmark. > It may look like below: > > void test (uint16_t *x, uint16_t *y, unsigned wsize, unsigned count) > { > un

Re: [gcc r15-1619] ira: Scale save/restore costs of callee save registers with block frequency

2024-06-27 Thread Andrew Pinski
.org/PR115634 for full analysis) and the fix has since been committed, r15-1695 : https://gcc.gnu.org/pipermail/gcc-cvs/2024-June/404932.html Thanks, Andrew Pinski > > -- > Andreas Schwab, SUSE Labs, sch...@suse.de > GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 > "And now for something completely different."

[PATCH 1/4] Small optimization for complex addition, real/imag parts the same

2024-07-01 Thread Andrew Pinski
addition once. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/complex-8.c: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/complex-8.c | 12 gcc/tree-complex.cc | 7 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create

[PATCH 0/4] Some improvements to complex lowering (cabs related)

2024-07-01 Thread Andrew Pinski
expansion/simplifications to complex lowering which already has a decent lattice and folding which allows `cabs(x+xI)` and `cabs(x+0.0I)` and `cabs(0.0+xI)` be detected. Andrew Pinski (4): Small optimization for complex addition, real/imag parts the same Move cabs expansion from powcabs to complex

[PATCH 2/4] Move cabs expansion from powcabs to complex lowering [PR115710]

2024-07-01 Thread Andrew Pinski
e-ssa/cabs-1.c: New test. * gcc.dg/tree-ssa/cabs-2.c: New test. * gfortran.dg/vect/pr115710.f90: New test. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/cabs-1.c | 14 + gcc/testsuite/gcc.dg/tree-ssa/cabs-2.c | 13 gcc/testsuite/gfortran.dg

[PATCH 3/4] Add some optimizations to gimple_expand_builtin_cabs

2024-07-01 Thread Andrew Pinski
abs-5.c: New test. * gcc.dg/tree-ssa/cabs-6.c: New test. Signed-off-by: Andrew Pinski Fix optimizations Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/tree-ssa/cabs-3.c | 24 +++ gcc/testsuite/gcc.dg/tree-ssa/cabs-4.c | 16 gcc/testsuite/gcc.dg/tree-ssa/cabs-5.c

[PATCH 4/4] Rename expand_powcabs pass to expand_pow

2024-07-01 Thread Andrew Pinski
. (make_pass_expand_powcabs): Rename to ... (make_pass_expand_pow): This. gcc/testsuite/ChangeLog: * gcc.dg/pow-sqrt-synth-1.c: Update testcase for renamed pass. Signed-off-by: Andrew Pinski --- gcc/passes.def | 2 +- gcc/testsuite/gcc.dg/pow-sqrt

[PUSHED] aarch64: Add testcase for vectorconvert lowering [PR110473]

2024-07-02 Thread Andrew Pinski
obvious after testing for aarch64-linux-gnu. PR tree-optimization/110473 PR tree-optimization/107432 gcc/testsuite/ChangeLog: * gcc.target/aarch64/vect-convert-1.c: New test. Signed-off-by: Andrew Pinski --- .../gcc.target/aarch64/vect-convert-1.c | 20

Re: [PATCH 3/3] [x86] Enable flate-combine.

2024-07-03 Thread Andrew Pinski
mption. > > If the reason for the changed codegen is that the picbase load costing has > been > over-estimated in the past, then that means we’d need to adjust both the > generation > of picbase (to cater for multiple instances) and anything that depends on > assuming > there’s only one. > > If the reason for the codegen change is that the picbase load cost is now > under- > estimated - that’s an easier fix. Most likely you just need to define a TARGET_CANNOT_COPY_INSN_P and return true for that insn. Thanks, Andrew Pinski > > Initial investigation only, I’ll try to raise a BZ tomorrow - it took a while > to bisect. > Iain >

[PATCH] Remove expanding complex EQ/NE inside a GIMPLE_RETURN [PR115721]

2024-07-09 Thread Andrew Pinski
15721 * tree-complex.cc (expand_complex_comparison): Remove support for GIMPLE_RETURN. Signed-off-by: Andrew Pinski --- gcc/tree-complex.cc | 8 1 file changed, 8 deletions(-) diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc index d2d9d76827d..dfb45b9d91c 100644 ---

[PATCH] testsuite: Allow matching `{_1, { 0, 0, 0, 0 }}` for vect/slp-gap-1.c

2024-07-09 Thread Andrew Pinski
-gap-1.c: Support matching `(_1, { 0, 0, 0, 0 }}` in addition to `{_1, 0}`. Signed-off-by: Andrew Pinski --- gcc/testsuite/gcc.dg/vect/slp-gap-1.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/slp-gap-1.c b/gcc/testsuite/gcc.dg/vect/slp

Re: libbacktrace patch committed: Add clang optnone attribute

2024-07-11 Thread Andrew Pinski
gnized function attributes. Bootstrapped and ran libbacktrace > testsuite on x86_64-pc-linux-gnu. Committed to mainline. NoteI see they have `noclone` and `noinline`, maybe it should have `noipa` on them too. noipa disables a few more things than noclone/noinline that might make a difference to

Re: [PATCH v1] c++: Hash placeholder constraint in ctp_hasher

2024-07-12 Thread Andrew Pinski
On Tue, Jul 9, 2024 at 6:46 AM Seyed Sajad Kahani wrote: > > This patch addresses a difference between the hash function and the equality > function for canonical types of template parameters (ctp_hasher). The equality > function uses comptypes (typeck.cc) (with COMPARE_STRUCTURAL) and checks > co

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

2024-07-14 Thread Andrew Pinski
ept extended to handle an optional convert. Why didn't you just extend the above pattern to handle the convert instead? Also I think you have an issue with unsigned types with the comparison. Also you should extend the -abs(A) pattern right below it in a similar fashion. Thanks, Andrew Pin

[PATCH] Add debug counter for ext_dce

2024-07-16 Thread Andrew Pinski
(ext_dce_try_optimize_insn): Reject the insn if the debug counter says so. Signed-off-by: Andrew Pinski --- gcc/dbgcnt.def | 1 + gcc/ext-dce.cc | 16 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index e0b9b1b2a76..ac1f8709849

Re: [PATCH] Add debug counter for ext_dce

2024-07-16 Thread Andrew Pinski
On Tue, Jul 16, 2024 at 3:36 PM Andrew Pinski wrote: > > Like r15-1610-gb6215065a5b143 (which adds one for late_combine), > adding one for ext_dce is useful to debug some issues with this pass. > > Bootstrapped and tested on x86_64-linux-gnu with no regressions. &g

Re: [PATCH]middle-end: fix 0 offset creation and folding [PR115936]

2024-07-17 Thread Andrew Pinski
On Tue, Jul 16, 2024 at 4:08 AM Tamar Christina wrote: > > Hi All, > > As shown in PR115936 SCEV and IVOPTS create an invalidate IV when the IV is > a pointer type: > > ivtmp.39_65 = ivtmp.39_59 + 0B; > > where the IVs are DI mode and the offset is a pointer. > This comes from this weird candidate

Re: [PATCH v2] MATCH: Simplify (a ? x : y) eq/ne (b ? x : y) [PR111150]

2024-07-17 Thread Andrew Pinski
On Wed, Jul 17, 2024 at 5:24 AM Richard Biener wrote: > > On Tue, Jul 16, 2024 at 3:36 PM Eikansh Gupta > wrote: > > > > This patch adds match pattern for `(a ? x : y) eq/ne (b ? x : y)`. > > In forwprop1 pass, depending on the type of `a` and `b`, GCC produces > > `vec_cond` or `cond_expr`. Bas

Re: [PATCH v1] Match: Bugfix .SAT_TRUNC honor types has no mode precision [PR115961]

2024-07-17 Thread Andrew Pinski
On Wed, Jul 17, 2024 at 4:13 AM Richard Biener wrote: > > On Wed, Jul 17, 2024 at 11:48 AM wrote: > > > > From: Pan Li > > > > The .SAT_TRUNC matching doesn't check the type has mode precision. Thus > > when bitfield like below will be recog as .SAT_TRUNC. > > > > struct e > > { > > unsigned

Re: [PATCH v1] Match: Bugfix .SAT_TRUNC honor types has no mode precision [PR115961]

2024-07-17 Thread Andrew Pinski
mode_precision_p meaningful for all types? > > > > I was wondering about that, wouldn't VECTOR_BOOLEAN_TYPE_P types fail? > e.g. on AVX where the type precision is 1 but the mode precision QImode? > > Unless I misunderstood the predicate. So type_has_mode_precision_p only

Re: [PATCH v1] Internal-fn: Support new IFN SAT_TRUNC for unsigned scalar int

2024-07-17 Thread Andrew Pinski
* match.pd: Add new matching pattern for unsigned int sat_trunc. > * optabs.def (OPTAB_CL): Add unsigned and signed optab. I just noticed you added ustrunc/sstrunc optabs but didn't add documentation for them in md.texi like the other optabs that are defined. See https://gcc.gnu.or

Re: [PATCH v1] Doc: Add Standard-Names ustrunc and sstrunc for integer modes

2024-07-17 Thread Andrew Pinski
On Wed, Jul 17, 2024 at 9:20 PM wrote: > > From: Pan Li > > This patch would like to add the doc for the Standard-Names > ustrunc and sstrunc, include both the scalar and vector integer > modes. Thanks for doing this and this looks mostly good to me (can't approve it). > > gcc/ChangeLog: > >

Re: [PATCH] MATCH: Add simplification for MAX and MIN to match.pd [PR109878]

2024-07-18 Thread Andrew Pinski
rd. > > > + (if (TYPE_UNSIGNED (type) > > +|| ((tree_int_cst_sgn (@1) <= 0) == (tree_int_cst_sgn (@2) <= 0))) > > +(if ((wi::to_wide (@1) & wi::to_wide (@2)) > > + == ((minmax == MIN_EXPR) ? wi::to_wide (@1) : wi::to_wide (@2))) >

Re: [PATCH] s390: testsuite: Fix vcond-shift.c

2024-07-19 Thread Andrew Pinski
basically the same. We just have to adapt the scan-assembler > directives w.r.t. signed/unsigned shifts which is done by this patch. Note I filed https://gcc.gnu.org/PR115999 because I noticed those 2 form produce slightly different code generation for scalars (I assume it will produce simila

Re: [PATCH] gcc: stop adding -fno-common for checking builds

2024-07-19 Thread Andrew Pinski
t was added back when GCC was written in C and then never removed when GCC started to build as C++. Thanks, Andrew Pinski > > gcc/ChangeLog: > * Makefile.in (NOCOMMON_FLAG): Delete. > (GCC_WARN_CFLAGS): Drop NOCOMMON_FLAG. > (GCC_WARN_CXXFLAGS):

[PATCH] tree-cfg: Move the returns_twice check to be last statement only [PR114301]

2024-05-14 Thread Andrew Pinski
rather than all. Signed-off-by: Andrew Pinski --- gcc/tree-cfg.cc | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index b2d47b72084..7fb7b92966b 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -6495,6 +6495,13

Re: [PATCH] AArch64: Improve costing of ctz

2024-05-15 Thread Andrew Pinski
On Wed, May 15, 2024, 12:17 PM Wilco Dijkstra wrote: > Improve costing of ctz - both TARGET_CSSC and vector cases were not > handled yet. > > Passes regress & bootstrap - OK for commit? > I should note popcount has a similar issue which I hope to fix next week. Popcount cost is used during expan

Re: [PATCH] rs6000: Don't clobber return value when eh_return called [PR114846]

2024-05-15 Thread Andrew Pinski
On Thu, May 16, 2024, 4:09 AM Kewen.Lin wrote: > Hi, > > As the associated test case in PR114846 shows, currently > with eh_return involved some register restoring for EH > RETURN DATA in epilogue can clobber the one which holding > the return value. Referring to the existing handlings in > some

Re: [PATCH] Add extra copy of the ifcombine pass after pre [PR102793]

2024-05-16 Thread Andrew Pinski
On Thu, May 16, 2024, 12:55 PM Oleg Endo wrote: > > On Thu, 2024-05-16 at 10:35 +0200, Richard Biener wrote: > > On Fri, Apr 5, 2024 at 8:14 PM Andrew Pinski wrote: > > > > > > On Fri, Apr 5, 2024 at 5:28 AM Manolis Tsamis > wrote: > &g

Re: [PATCH] middle-end: Drop __builtin_pretech calls in autovectorization [PR114061]'

2024-05-16 Thread Andrew Pinski
On Thu, May 16, 2024, 3:58 PM Victor Do Nascimento < victor.donascime...@arm.com> wrote: > At present the autovectorizer fails to vectorize simple loops > involving calls to `__builtin_prefetch'. A simple example of such > loop is given below: > > void foo(double * restrict a, double * restrict b

Re: [PATCH] middle-end: Expand {u|s}dot product support in autovectorizer

2024-05-16 Thread Andrew Pinski
On Thu, May 16, 2024, 4:40 PM Victor Do Nascimento < victor.donascime...@arm.com> wrote: > From: Victor Do Nascimento > > At present, the compiler offers the `{u|s|us}dot_prod_optab' direct > optabs for dealing with vectorizable dot product code sequences. The > consequence of using a direct opt

Re: [PATCH] middle-end: Expand {u|s}dot product support in autovectorizer

2024-05-16 Thread Andrew Pinski
On Thu, May 16, 2024, 7:46 PM Tamar Christina wrote: > Hi Victor, > > > -Original Message- > > From: Victor Do Nascimento > > Sent: Thursday, May 16, 2024 3:39 PM > > To: gcc-patches@gcc.gnu.org > > Cc: Richard Sandiford ; Richard Earnshaw > > ; Victor Do Nascimento > > > > Subject: [PA

Re: [PATCH] Optab: add isnormal_optab for __builtin_isnormal

2024-05-18 Thread Andrew Pinski
On Fri, Apr 12, 2024 at 1:10 AM HAO CHEN GUI wrote: > > Hi, > This patch adds an optab for __builtin_isnormal. The normal check can be > implemented on rs6000 by a single instruction. It needs an optab to be > expanded to the certain sequence of instructions. > > The subsequent patches will im

Re: [PATCH] Optab: add isfinite_optab for __builtin_isfinite

2024-05-18 Thread Andrew Pinski
On Thu, Apr 11, 2024 at 8:07 PM HAO CHEN GUI wrote: > > Hi, > This patch adds an optab for __builtin_isfinite. The finite check can be > implemented on rs6000 by a single instruction. It needs an optab to be > expanded to the certain sequence of instructions. > > The subsequent patches will im

[PATCH] PHIOPT: Don't transform minmax if middle bb contains a phi [PR115143]

2024-05-18 Thread Andrew Pinski
phi nodes for middle bbs for the case where middle bb is not empty. gcc/testsuite/ChangeLog: * gcc.c-torture/compile/pr115143-1.c: New test. * gcc.c-torture/compile/pr115143-2.c: New test. * gcc.c-torture/compile/pr115143-3.c: New test. Signed-off-by: Andrew

Re: [PATCH v1] Match: Extract integer_types_ternary_match helper to avoid code dup [NFC]

2024-05-18 Thread Andrew Pinski
On Sat, May 18, 2024, 9:17 PM wrote: > From: Pan Li > > There are sorts of match pattern for SAT related cases, there will be > some duplicated code to check the dest, op_0, op_1 are same tree types. > Aka ternary tree type matches. Thus, extract one helper function to > do this and avoid matc

Re: [to-be-committed][RISC-V] Eliminate redundant bitmanip operation

2024-05-19 Thread Andrew Pinski
ion if it was single use. */ (simplify (convert (bit_not:s @0)) (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) (bit_not (convert @0)))) ``` Thanks, Andrew Pinski > > > > Regression tested in Ventana's CI system as well as my own. Waiting on > the Rivos CI system before moving forward. > > > > Jeff

Re: [pshed] testsuite, C++, Darwin: Skip cxa_atexit-6, which is not applicable.

2024-05-19 Thread Andrew Pinski
On Sun, May 19, 2024 at 6:38 AM Iain Sandoe wrote: > > As per the analysis in the PR, tested on x86_64, i686 and aarch64 Darwin > (and on x86_64 linux), pushed to trunk, thanks, > Iain Thanks for doing this. Thanks, Andrew > > --- 8< --- > > For Darwin, non-weak functions defined in a TU always

Re: [PATCH] aarch64: Fold vget_low_* intrinsics to BIT_FIELD_REF [PR102171]

2024-05-20 Thread Andrew Pinski
On Mon, May 20, 2024 at 2:57 AM Richard Sandiford wrote: > > Pengxuan Zheng writes: > > This patch folds vget_low_* intrinsics to BIT_FILED_REF to open up more > > optimization opportunities for gimple optimizers. > > > > While we are here, we also remove the vget_low_* definitions from > > arm_

[PATCH] match: Disable `(type)zero_one_valuep*CST` for 1bit signed types [PR115154]

2024-05-20 Thread Andrew Pinski
/execute/signed1bitfield-1.c: New test. Signed-off-by: Andrew Pinski --- gcc/match.pd | 6 +++-- .../c-c++-common/ubsan/signed1bitfield-1.c| 25 +++ .../gcc.c-torture/execute/signed1bitfield-1.c | 23 + 3 files changed, 52

Re: [PATCH v1 1/2] Match: Support __builtin_add_overflow branch form for unsigned SAT_ADD

2024-05-21 Thread Andrew Pinski
On Tue, May 21, 2024, 3:55 AM wrote: > From: Pan Li > > This patch would like to support the __builtin_add_overflow branch form for > unsigned SAT_ADD. For example as below: > > uint64_t > sat_add (uint64_t x, uint64_t y) > { > uint64_t ret; > return __builtin_add_overflow (x, y, &ret) ? -1

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