Re: [PATCH #3/7] introduce ifcombine_replace_cond

2024-11-01 Thread Alexandre Oliva
On Oct 27, 2024, Jeff Law wrote: > On 10/25/24 5:52 AM, Alexandre Oliva wrote: >> Refactor ifcombine_ifandif, moving the common code from the various >> paths that apply the combined condition to a new function. >> >> for gcc/ChangeLog >> * tree-ssa-ifc

Re: [PATCH #6/7] ifcombine across noncontiguous blocks

2024-11-02 Thread Alexandre Oliva
n laxer. I'm testing an incremental patch that adds simple bounds to the amount of stmt moving, and flow info resetting and UB avoiding for moved stmts, and arranges to reset flow info and avoid UB in inner blocks when the outer cond is relaxed. -- Alexandre Oliva, happy hackerht

[PATCH #1/7] allow vuses in ifcombine blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
unsigned arithmetic but cannot do so for signed division. */ || ((ass = dyn_cast (stmt)) -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for

Re: [PATCH] fold fold_truth_andor field merging into ifcombine

2024-10-25 Thread Alexandre Oliva
On Oct 22, 2024, Richard Biener wrote: > On Mon, Oct 21, 2024 at 4:30 AM Alexandre Oliva wrote: >> >> On Oct 10, 2024, Richard Biener wrote: >> >> > As you special-case hard register uses, do we want to ever make >> > hard-register >> > uses

[PATCH #2/7] drop redundant ifcombine_ifandif parm (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
, ... */ - return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false, - true); + return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false); } return false; -- Alexandre Oliva, happy hacker

[PATCH #0/7] noncontiguous ifcombine patchset (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
useful. Ok to install? -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive

[PATCH #3/7] introduce ifcombine_replace_cond (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
eric_expr (dump_file, t); + if (ts) + { + fprintf (dump_file, " and "); + print_generic_expr (dump_file, ts); + } fprintf (dump_file, "\n"); } -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free S

[PATCH #6/7] ifcombine across noncontiguous blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
/* Clear range info from all stmts in BB which is now executed - conditional on a always true/false condition. */ + conditional on a always true/false condition. ??? When we + combine noncontiguous blocks, do we need to adjust the + intervenin

[PATCH #4/7] adjust update_profile_after_ifcombine for noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
er. */ + + inner_taken->probability *= profile_probability::even (); + inner_not_taken->probability = profile_probability::always () + - inner_taken->probability; + + prob *= inner_taken->probability; + outer2->probability += prob; + outer_to_inner->probability =

[PATCH #5/7] extend ifcombine_replace_cond to handle noncontiguous ifcombine (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
cond_set_condition_from_tree (inner_cond, cond2); + } + else + gimple_cond_set_condition_from_tree (inner_cond, +inner_inv +? boolean_false_node +: boolean_true_node); +

[PATCH #7/7] handle TRUTH_ANDIF cond exprs in ifcombine_replace_cond (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

2024-10-25 Thread Alexandre Oliva
cond2 = TREE_OPERAND (cond, 1); + cond = TREE_OPERAND (cond, 0); +} + bool outer_p = cond2 || (single_pred (gimple_bb (inner_cond)) != gimple_bb (outer_cond)); bool result_inv = outer_p ? outer_inv : inner_inv; -- Alexandre Oliva, happy hackerhttps

Re: [committed] contrib: Add 2 further ignored commits

2024-11-11 Thread Alexandre Oliva
On Nov 10, 2024, Jakub Jelinek wrote: > On Sun, Nov 10, 2024 at 01:30:06PM -0300, Alexandre Oliva wrote: >> I'm surprised the commit-time checker didn't catch them. > I'm surprised too, but don't want to try to push further broken commits just > to double

Re: [committed] contrib: Add 2 further ignored commits

2024-11-10 Thread Alexandre Oliva
very helpful to avoid typos in filenames. -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving &q

[PATCH] fold fold_truth_andor field merging into ifcombine was: [PATCH] assorted improvements for fold_truth_andor_1)

2024-09-26 Thread Alexandre Oliva
This patch introduces various improvements to the logic that merges field compares, moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's fields li

Re: [PATCH 11/15] Support for 64-bit location_t: RTL parts

2024-11-28 Thread Alexandre Oliva
at the best thing to do in case the note doesn't carry location information, or the referenced block is missing or however else it could be NULL. Staying in the previous scope is somewhat sensible, but it amounts to silently dropping debug information; a visible change of scope might be pr

[PATCH] ifcombine: avoid unsound forwarder-enabled combinations [PR117723]

2024-11-28 Thread Alexandre Oliva
B and the @@ -1245,7 +1325,7 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb) of outer, we'd get ([1 ? 0 :] b ? 1 : (a | c) ? 0 : -1), which would yield 1 rather than 0 when (a). */ if (!changed - && !same_phi_args_p (outer_cond_bb, inner_

Re: [PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-11-27 Thread Alexandre Oliva
On Nov 22, 2024, Alexandre Oliva wrote: > - Rework BIT_XOR handling to avoid having to match patterns again. I goofed here, and only an -O3 profiling bootstrap of gcc-14 caught it. Please consider this incremental patchlet as if included as part of the previous one. Bootstrapped on top of

Re: [PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-12-05 Thread Alexandre Oliva
-1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O" } */ +/* { dg-options "-O -fdump-tree-ifcombine-details" } */ /* Check that conversions and selections of similar bit ranges across different types don't prevent combination. */ @@ -25,7 +25,7 @@ void f (void) {

[PATCH v3] fold fold_truth_andor field merging into ifcombine

2024-12-08 Thread Alexandre Oliva
This patch introduces various improvements to the logic that merges field compares, while moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's fie

Re: [PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-12-08 Thread Alexandre Oliva
@1 @2)) -/* These are used by ifcombine fold_truth_andor. */ -(match (any_convert @0) - (convert @0)) -(match (any_convert @0) - (view_convert @0)) -(match (bit_and_cst @0 @1) - (bit_and @0 uniform_integer_cst_p@1)) -(match (rshift_cst @0 @1) - (rshift @0 uniform_integer_cst_p@1) - (if (tree_f

Re: [PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-12-09 Thread Alexandre Oliva
le } */ /* { dg-timeout-factor 2.0 } */ -/* { dg-options "-O1 -fno-reorder-blocks -fno-tree-cselim --save-temps" } */ +/* { dg-options "-O1 -fno-reorder-blocks -fno-tree-cselim -fno-tree-ifcombine --save-temps" } */ __attribute__((noinline, noclone)) int -- Alexa

[PATCH v4] fold fold_truth_andor field merging into ifcombine

2024-12-09 Thread Alexandre Oliva
This patch introduces various improvements to the logic that merges field compares, while moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's field

Re: [PATCH] testsuite: generalized field-merge tests for <32-bit int [PR118025]

2025-01-06 Thread Alexandre Oliva
On Dec 22, 2024, Alexandre Oliva wrote: > for gcc/testsuite/ChangeLog > PR testsuite/118025 > * gcc.dg/field-merge-1.c: Convert constants to desired types. > * gcc.dg/field-merge-3.c: Likewise. > * gcc.dg/field-merge-4.c: Likewise. > * gcc.

Re: [PATCH] ifcombine field-merge: improve handling of dwords

2025-01-06 Thread Alexandre Oliva
On Dec 21, 2024, Alexandre Oliva wrote: > On Dec 20, 2024, Jakub Jelinek wrote: >> On Wed, Dec 18, 2024 at 12:59:11AM -0300, Alexandre Oliva wrote: >>> * gcc.dg/field-merge-16.c: New. >> Note the test FAILs on i686-linux or on x86_64-linux with -m32. > Indeed, t

[PATCH] [testsuite] require profiling support [PR113689]

2025-01-30 Thread Alexandre Oliva
file -mcmodel=large" } */ +/* { dg-require-profiling "-fprofile" } */ /* { dg-skip-if "PR90698" { *-*-darwin* } } */ /* { dg-skip-if "PR113909" { *-*-solaris2* } } */ -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activi

[PATCH] [testsuite] require -Ofast for vect-ifcvt-18 even without avx

2025-01-30 Thread Alexandre Oliva
-target vect_float } */ -/* { dg-additional-options "-Ofast -mavx" { target avx_runtime } } */ +/* { dg-additional-options "-Ofast" { target i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ int A0[4] = {36,39,42,45}; --

[PATCH] [testsuite] [sparc] skip tls tests if emulated

2025-02-06 Thread Alexandre Oliva
b/gcc/testsuite/gcc.target/sparc/tls-ld-uint8.c index 0dcff66eb15e4..7a7492197f952 100644 --- a/gcc/testsuite/gcc.target/sparc/tls-ld-uint8.c +++ b/gcc/testsuite/gcc.target/sparc/tls-ld-uint8.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2" } /* { dg-add-options tls } */

Re: [PATCH] [testsuite] require -Ofast for vect-ifcvt-18 even without avx

2025-02-06 Thread Alexandre Oliva
On Jan 31, 2025, Richard Biener wrote: > On Thu, Jan 30, 2025 at 8:49 PM Alexandre Oliva wrote: >> Split -Ofast out of the avx conditional, so that it is passed on the >> same targets that expect the transformation. > It effectively would require -Ofast on all targets (it&#x

[PATCH] [testsuite] tolerate later success [PR108357]

2025-02-06 Thread Alexandre Oliva
* We expect threadfull1 to eliminate the call to foo(), but not all targets + manage that at that point. Calling conventions (mandatory promotion) play a + role, but there's more than that. */ +/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ -- Alexandre Ol

Re: [PATCH v3] [ifcombine] avoid creating out-of-bounds BIT_FIELD_REFs [PR118514]

2025-02-06 Thread Alexandre Oliva
That's because the assert went in as part of an earlier patch. I take it it should be backed out along with the to-be-split-out bits above, right? -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Enginee

[PATCH] [testsuite] [sparc] select ultrasparc for fsmuld test

2025-02-06 Thread Alexandre Oliva
ilp32 } */ -/* { dg-options "-O1 -mvis3" } */ +/* { dg-skip-if "prevents fsmuld" { *-*-* } { "-mfix-ut699" } { "" } } */ +/* { dg-options "-O1 -mvis3 -mcpu=ultrasparc" } */ float fnegs (float a) { -- Alexandre Oliva, happy hackerhttp

[PATCH] [testsuite] [sparc] use -mtune in alignment tuning test

2025-02-06 Thread Alexandre Oliva
align-functions -mcpu=niagara7" } */ +/* { dg-options "-falign-functions -mtune=niagara7" } */ /* { dg-final { scan-assembler "\.align 64" } } */ void foo(void) {} -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist

[PATCH v4] [ifcombine] avoid creating out-of-bounds BIT_FIELD_REFs [PR118514]

2025-02-07 Thread Alexandre Oliva
On Feb 6, 2025, Sam James wrote: > Richard Biener writes: >> On Thu, Feb 6, 2025 at 2:41 PM Alexandre Oliva wrote: >>> >>> On Jan 27, 2025, Richard Biener wrote: >>> > (I see the assert is no longer in the patch). >>> >>> That

[PATCH] [testsuite] [sparc] skip sparc-ret-1 with -mfix-ut699

2025-02-06 Thread Alexandre Oliva
ts expected asm" { *-*-* } { "-mfix-ut699" } { "" } } */ /* { dg-require-effective-target ilp32 } */ /* { dg-options "-mcpu=ultrasparc -O" } */ -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist

[PATCH] ifcombine field-merge: saturate align at inner object size

2024-12-11 Thread Alexandre Oliva
On Dec 10, 2024, Richard Biener wrote: > On Mon, Dec 9, 2024 at 8:55 PM Alexandre Oliva wrote: >> Regstrapped on x86_64-linux-gnu. The aarch64 CI had reported a >> regression with v3, so I'm also running a regstrap on aarch64-linux-gnu, >> but it will still be a w

Re: [PATCH] ifcombine field-merge: saturate align at inner object size

2024-12-11 Thread Alexandre Oliva
On Dec 11, 2024, Richard Biener wrote: > Am 11.12.2024 um 14:50 schrieb Alexandre Oliva : >> if (get_best_mode (end_bit - first_bit, first_bit, 0, 0, > I think These 0, 0 args are supposed to indicate Maximum extent of the > resulting Access - but Widening to the largest Mode fi

[PATCH] ifcombine field-merge: set upper bound for get_best_mode

2024-12-11 Thread Alexandre Oliva
lr_align, BITS_PER_WORD, volatilep, &rnmode) + || !get_best_mode (end_bit - boundary, boundary, 0, lr_end_region, + lr_align, BITS_PER_WORD, volatilep, &rnmode2)) return 0; r_split_load = tru

[PATCH] ifcombine field merge: stricten loads tests, swap compare to match

2024-12-17 Thread Alexandre Oliva
|| q.c.b != p.c.b + || p.d.b != q.d.b + || q.d.a != p.d.a + ) +__builtin_abort (); + return; +} + +int main () { + f (); + g (); + h (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "optimizing" 9 "ifcombine" } } */ -- Alexandre Oliva, happy hac

[PATCH] ifcombine field merge: do not follow a second conversion [PR118046]

2024-12-17 Thread Alexandre Oliva
+ return 0; +} + +int main() +{ + unsigned char t = 0x81; + int x = t, y; + int tt = f(&x, &y); + if (!tt) +__builtin_abort(); +} + +/* { dg-final { scan-tree-dump-not "optimizing" "ifcombine" } } */ -- Alexandre Oliva, happy hackerhttps://FSFLA.org

[PATCH] ifcombine field merge: adjust testcases [PR118025]

2024-12-17 Thread Alexandre Oliva
? -2 << (__CHAR_BIT__ - 1) -: -1 & ((1 << (__CHAR_BIT__ - 1) << 1) - 1)), 42 }; +struct s2 q = { -2 << (__CHAR_BIT__ - 1), 42 }; void f (void) { if (0 -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software A

[PATCH] noncontiguous ifcombine: skip marking of non-SSA_NAMEs [PR117915]

2024-12-17 Thread Alexandre Oliva
name (data->used, *t, data->outer); return NULL; } -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive

Re: [PATCH] ifcombine field merge: do not follow a second conversion [PR118046]

2024-12-18 Thread Alexandre Oliva
On Dec 17, 2024, Alexandre Oliva wrote: > diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc > index 92f02ddd77408..06913d57f8aec 100644 > --- a/gcc/gimple-fold.cc > +++ b/gcc/gimple-fold.cc > @@ -7554,13 +7554,10 @@ decode_field_reference (tree *pexp, HOST_WIDE_I

Re: [PATCH] noncontiguous ifcombine: skip marking of non-SSA_NAMEs [PR117915]

2024-12-18 Thread Alexandre Oliva
On Dec 17, 2024, Alexandre Oliva wrote: > On Dec 17, 2024, Sam James wrote: >>> +/* { dg-options "-O3 -fno-tree-copy-prop -fno-tree-vrp" */ >> Missing closing '}'. > Thanks, I've fixed that, and retested. Here's the consolidated patch what I

Re: [PATCH] ifcombine field merge: do not follow a second conversion [PR118046]

2024-12-18 Thread Alexandre Oliva
nt even if otherwise unused + if (c < 0 && (b&1)) +return 1; + return 0; +} + +int main() +{ + unsigned char t = 0x81; + int x = t, y; + int tt = f(&x, &y); + if (!tt) +__builtin_abort(); +} + +/* { dg-final { scan-tree-dump-not "optimizing" "

Re: [PATCH] ifcombine field merge: adjust testcases [PR118025]

2024-12-18 Thread Alexandre Oliva
2 }; -struct s2 q = { (le -? -2 << (__CHAR_BIT__ - 1) -: -1 & ((1 << (__CHAR_BIT__ - 1) << 1) - 1)), 42 }; +struct s2 q = { -2 << (__CHAR_BIT__ - 1), 42 }; void f (void) { if (0 -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs

[PATCH] ifcombine field merge: handle bitfield zero tests in range tests

2024-12-17 Thread Alexandre Oliva
+ +void f () +{ + if (p.a || p.b || p.c || p.d) +return; + __builtin_abort (); +} + +void g () +{ + if (q.a || q.b || q.c || q.d) +__builtin_abort (); +} + +int main () { + f (); + g (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "optimizing" 6 "ifcombine&quo

Re: [PATCH] noncontiguous ifcombine: skip marking of non-SSA_NAMEs [PR117915]

2024-12-17 Thread Alexandre Oliva
On Dec 17, 2024, Sam James wrote: >> +/* { dg-options "-O3 -fno-tree-copy-prop -fno-tree-vrp" */ > Missing closing '}'. Thanks, I've fixed that, and retested. -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activi

[PATCH] ifcombine field merge: handle masks with sign extensions

2024-12-17 Thread Alexandre Oliva
/* As we strip non-widening conversions in finding a common name that is tested make sure to end up with an integral @@ -944,7 +944,8 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv, } /* See if we have two comparisons that we can merge into one. */ - else if (TRE

Re: [PATCH] gimple-fold: Fix up decode_field_reference xor handling [PR118081]

2024-12-18 Thread Alexandre Oliva
ncerns you might have, I'd be happy to double-check, and hopefully alleviate them, or at least follow leads to other problems I haven't considered. Thanks, -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain E

[PATCH] avoid trying to set block in barriers [PR113506]

2024-12-18 Thread Alexandre Oliva
=1 -Os -fno-tree-coalesce-vars -finline-stringops" } */ + +typedef unsigned v32su __attribute__((vector_size (32))); + +v32su foo_v32su_4; + +unsigned +foo (v32su v32su_2) +{ + v32su_2 *= v32su_2; + if (foo_v32su_4[3]) +v32su_2 &= (v32su){}; + return v32su_2[1]; +} -- Alexandre

[PATCH] strub: accept indirection of volatile pointer types [PR118007]

2024-12-18 Thread Alexandre Oliva
file mode 100644 index 0..6c24cad652968 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strub-pr118007.c @@ -0,0 +1,5 @@ +/* { dg-require-effective-target strub } */ +/* { dg-do compile } */ +/* { dg-options "-fstrub=all -O2" } */ + +void rb_ec_error_print(struct rb_execution_context_st

[PATCH] expand: drop stack adjustments after barrier [PR118006]

2024-12-18 Thread Alexandre Oliva
abort(); +} + +static int privileged_traced_syscall() { + return _raw_syscall(0, 0, 0); +} + +void privileged_traced_raise() { + privileged_traced_syscall(); + __builtin_unreachable (); +} -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GN

[PATCH] add options to control ifcombine

2024-12-18 Thread Alexandre Oliva
tion entirely, we need not commit to an exit block yet, it's as if we'd merged the blocks and were starting afresh. This is sound as long as we never replace @@ -1369,6 +1373,15 @@ public: {} /* opt_pass methods: */ + bool gate (function *) final override {

Re: [PATCH] add options to control ifcombine

2024-12-20 Thread Alexandre Oliva
ous blocks is needed, I'll be happy to introduce a param for that. Thanks, -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Exclu

[PATCH] ifcombine field-merge: improve handling of dwords

2024-12-20 Thread Alexandre Oliva
On Dec 20, 2024, Jakub Jelinek wrote: > On Wed, Dec 18, 2024 at 12:59:11AM -0300, Alexandre Oliva wrote: >> * gcc.dg/field-merge-16.c: New. > Note the test FAILs on i686-linux or on x86_64-linux with -m32. Indeed, thanks. Here's a fix. On 32-bit hosts, data types with

[PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-11-22 Thread Alexandre Oliva
This patch introduces various improvements to the logic that merges field compares, while moving it into ifcombine. Before the patch, we could merge: (a.x1 EQNE b.x1) ANDOR (a.y1 EQNE b.y1) into something like: (((type *)&a)[Na] & MASK) EQNE (((type *)&b)[Nb] & MASK) if both of A's fie

[PATCH] ifcombine: skip fallback conjunction on noncontiguous blocks

2024-11-22 Thread Alexandre Oliva
nd_bb) + return false; tree t1, t2; bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT; if (param_logical_op_non_short_circuit != -1) -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Act

Re: [PATCH v2] fold fold_truth_andor field merging into ifcombine

2024-12-07 Thread Alexandre Oliva
On Dec 3, 2024, Richard Biener wrote: > On Fri, Nov 22, 2024 at 10:22 PM Alexandre Oliva wrote: >> + /* Identify the load, if there is one. */ >> + if (TREE_CODE (exp) == SSA_NAME >> + && !SSA_NAME_IS_DEFAULT_DEF (exp)) >> +{ >> +

[PATCH] testsuite: generalized field-merge tests for <32-bit int [PR118025]

2024-12-22 Thread Alexandre Oliva
Hello, Dimitar, On Dec 22, 2024, Dimitar Dimitrov wrote: > On Sat, Dec 21, 2024 at 02:28:33AM -0300, Alexandre Oliva wrote: >> On Dec 20, 2024, Jakub Jelinek wrote: >> >> > On Wed, Dec 18, 2024 at 12:59:11AM -0300, Alexandre Oliva wrote: >> >> * gcc.dg/fiel

[PATCH] [ifcombine] reuse left-hand mask to decode right-hand xor operand

2025-01-09 Thread Alexandre Oliva
;rl_load, rl_loc); rr_inner = decode_field_reference (&rr_arg, &rr_bitsize, &rr_bitpos, &rr_unsignedp, &rr_reversep, &volatilep, - &rr_and_mask, &rr_signbit, &r_xor, 0, +

[PATCH] [ifcombine] drop other misuses of uniform_integer_cst_p

2025-01-10 Thread Alexandre Oliva
(lr_inner + && tree_fits_poly_uint64_p (TYPE_SIZE (TREE_TYPE (lr_inner lr_end_region = tree_to_poly_uint64 (TYPE_SIZE (TREE_TYPE (lr_inner))); if (!get_best_mode (end_bit - first_bit, first_bit, 0, lr_end_region, lr_align, BITS_PER_WORD, volatilep, &rnmode)

[PATCH] [ifcombine] fix mask variable test to match use [PR118344]

2025-01-09 Thread Alexandre Oliva
id y() { + for (;;) { +b[w(8, *p)] = h; +for (; a + k; j = o) + i &= c = x(6) < 0; + } +} -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key

[PATCH] [testsuite] rearrange requirements for dfp bitint run tests

2025-01-09 Thread Alexandre Oliva
c.dg/dfp/int128-4.c index b91800989f947..b83e7e4221cec 100644 --- a/gcc/testsuite/gcc.dg/dfp/int128-4.c +++ b/gcc/testsuite/gcc.dg/dfp/int128-4.c @@ -1,5 +1,6 @@ /* PR libgcc/65833 */ -/* { dg-do run { target { int128 && bitint } } } */ +/* { dg-require-effective-target int128 } */ +/* {

[PATCH] [ifcombine] out-of-bounds bitfield refs can trap [PR118514]

2025-01-22 Thread Alexandre Oliva
ECL_P (TREE_OPERAND (expr, 0)) && !bit_field_ref_in_bounds_p (expr)) + return true; + /* Fall through. */ + case COMPONENT_REF: case REALPART_EXPR: case IMAGPART_EXPR: - case BIT_FIELD_REF: case VIEW_CONVERT_EXPR: case WITH_SIZE_EXPR: expr = TREE_

[PATCH v2] [ifcombine] avoid dropping tree_could_trap_p [PR118514]

2025-01-22 Thread Alexandre Oliva
On Jan 22, 2025, Alexandre Oliva wrote: > I have another patch coming up that doesn't raise concerns for me, so > I'll hold off from installing the above, in case you also prefer the > other one. Unlike other access patterns, BIT_FIELD_REFs aren't regarded as

[PATCH] [ifcombine] improve reverse checking and operand swapping

2025-01-22 Thread Alexandre Oliva
On Jan 22, 2025, Alexandre Oliva wrote: > I have another patch coming up that doesn't raise concerns for me, so > I'll hold off from installing the above, in case you also prefer the > other one. And here's an unrelated bit that came to mind while working on this, but

[PATCH] [ifcombine] check for more zero-extension cases [PR118572]

2025-01-22 Thread Alexandre Oliva
{ +return (((0x80 & (c&-1)) != 0) && ((0x1248c0 & (c&-1)) == 0x124880)); +} + +__attribute__((noipa)) +int test4(signed char c) +{ +return (((0x400 & (c&-1)) == 0) && ((0x40 & (c&-1)) == 0x40)); +} + +int main() { + if (test(0x80) == 0 ||

Re: [PATCH v2] [ifcombine] avoid dropping tree_could_trap_p [PR118514]

2025-01-23 Thread Alexandre Oliva
you mentioned, it's also needed to satisfy the assert, because we could pick the wrong load to replace, and then we'd get a mismatch. -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive

[PATCH v3] [ifcombine] avoid creating out-of-bounds BIT_FIELD_REFs [PR118514]

2025-01-24 Thread Alexandre Oliva
ern bool operation_could_trap_p (enum tree_code, bool, bool, tree); +extern bool access_in_bounds_of_type_p (tree, poly_uint64, poly_uint64); extern bool tree_could_trap_p (tree); extern tree rewrite_to_non_trapping_overflow (tree); extern bool stmt_could_throw_p (function *, gimple *); -- Al

[PATCH] [ifcombine] avoid dropping tree_could_trap_p [PR118514]

2025-01-17 Thread Alexandre Oliva
|| !c) { +signed char e = b[10]; +d = e < 0 || b[10] > 1; +if (d) + __builtin_abort (); + } + return 0; +} -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer M

Re: [PATCH] [ifcombine] avoid dropping tree_could_trap_p [PR118514]

2025-01-20 Thread Alexandre Oliva
d)) > & !tree_could_trap_p (inner) > (&& btw) looks like bad style. Oops, yeah, typo (keyboard woes), thanks. > Did you consider not applying this ifcombine to tree_could_trap_p original > refs > at all? Yeah. It works. But then I figured we could take a safe step f

Re: [PATCH] [ifcombine] avoid dropping tree_could_trap_p [PR118514]

2025-01-21 Thread Alexandre Oliva
alignment and size seem to guarantee we won't combine accesses with different trapping properties (though one could presumably be marked as non-trapping if it is dominated by another access to the same word), but I should probably guard against this. Will do. -- Alexandre Oliva, happy ha

[PATCH] [ifcombine] check and extend constants to compare with bitfields [PR118456]

2025-01-13 Thread Alexandre Oliva
on/118456 */ +/* Check that compares with constants take into account sign/zero extension of + both the bitfield and of the shifting type. */ + +#define shift (__CHAR_BIT__ - 4) + +struct S { + signed char a : shift + 2; + signed char b : shift + 2; + short ignore[0]; +} s; + +__attribute__(

[PATCH] [ifcombine] propagate signbit mask to XOR right-hand operand

2025-01-12 Thread Alexandre Oliva
pa)) +int f3 () +{ + if (c.d == a.d + && c.e == a.e) +return 0; + return -1; +} + +__attribute__((noipa)) +int f4 () +{ + if (c.d != a.d + || c.e != a.e) +return -1; + return 0; +} + +int main() { + if (f1 () < 0 + || f2 () < 0 + || f3 () < 0 + |

[PATCH] [ifcombine] robustify decode_field_reference

2025-01-13 Thread Alexandre Oliva
dth and bit position. */ if (l_const.get_precision ()) @@ -8550,10 +8559,6 @@ fold_truth_andor_for_ifcombine (enum tree_code code, tree truth_type, return constant_boolean_node (wanted_code == NE_EXPR, truth_type); } - /* When we set l_const, we also set r_const, so we need

Re: [r15-6361 Regression] FAIL: gcc.dg/field-merge-16.c scan-tree-dump-times ifcombine "optimizing" 6 on Linux/x86_64

2024-12-20 Thread Alexandre Oliva
24-December/672161.html https://gcc.gnu.org/pipermail/gcc-patches/2024-December/672162.html They're meant to go together, but each one should suffice. Apologies for the noise -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist

[PATCH] testsuite: generalize ifcombine field-merge tests [PR118025]

2024-12-20 Thread Alexandre Oliva
On Dec 20, 2024, Jakub Jelinek wrote: > On Wed, Dec 18, 2024 at 12:59:11AM -0300, Alexandre Oliva wrote: >> * gcc.dg/field-merge-16.c: New. > Note the test FAILs on i686-linux or on x86_64-linux with -m32. Also fixed herein. A number of tests that check for specific ifcombine tra

Re: [PATCH] [testsuite] rearrange requirements for dfp bitint run tests

2025-01-16 Thread Alexandre Oliva
On Jan 10, 2025, Alexandre Oliva wrote: > dfp.exp sets the default to compile when dfprt is not available, but > some dfp bitint tests override the default without that requirement, > and try to run even when dfprt is not available. > Instead of overriding the default, rewrite the

[PATCH #2/2] [testsuite] drop explicit run overrider in more dfp tests

2025-01-16 Thread Alexandre Oliva
/* { dg-options "-O2" } */ __attribute__((noipa)) int -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive

[PATCH] [testsuite] skip test on non-hosted libstdc++ [PR113994]

2025-01-16 Thread Alexandre Oliva
} +// { dg-skip-if "requires hosted libstdc++ for string" { ! hostedlib } } #include -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and

[PATCH] [testsuite] [arm] adjust wmul expectations [PR113560]

2025-01-16 Thread Alexandre Oliva
dg-final { scan-assembler "umlal" } } */ +/* After zero-extending both to SImode, either signed- or unsigned-widening + multiply will do. */ +/* { dg-final { scan-assembler {[us]mlal} } } */ -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activ

[PATCH] [ifcombine] adjust for narrowing converts before shifts [PR118206]

2025-01-09 Thread Alexandre Oliva
+{ + unsigned short a = 0x78 - 0x80 - 0x80; + if (foo (&a) != 0 || bar (&a) != (a > 0xff)) +__builtin_abort (); + unsigned short b = 0x88; + if (foo (&b) != 1 || bar (&b) != 1) + __builtin_abort (); + unsigned short c = 8; + if (foo (&c) != 0 || bar (&c) != 0) +

[PATCH] [testsuite] [arm] multilibs.exp: adjust float abi opt matching

2025-01-16 Thread Alexandre Oliva
ltilib flags override anything we can apply to a test, so # skip if any of the above options are set there. -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for in

[PATCH] [ifcombine] cope with signbit tests of extended values

2025-02-13 Thread Alexandre Oliva
/* PR tree-optimization/118805 */ + +/* Test that ifcombine doesn't get confused by tests for the sign bit of + extended values that would normally be folded before. */ + +unsigned char a = 255; +int b; +int main() { + int c = 0; + if (c > a && a >= 255) +__builtin_abor

[PATCH] [testsuite] adjust expectations of x86 vect-simd-clone tests

2025-02-13 Thread Alexandre Oliva
] == "N" } { + return +} + +# Evaluate selector, return if it does not match. +switch [dg-process-target-1 [lindex $args 1]] { + "N" { return } + "P" { return } +} + +eval dg-do $args +} + # Skip the test (report it as UNS

[PATCH] [testsuite] add x86 effective target

2025-02-13 Thread Alexandre Oliva
ap-trampoline, 0 otherwise. proc check_effective_target_heap_trampoline {} { if { [istarget aarch64*-*-linux*] -|| [istarget i?86-*-darwin*] -|| [istarget x86_64-*-darwin*] -|| [istarget i?86-*-linux*] -|| [istarget x86_64-*-linux*] } { +|| { [check_effective_target_x86] + && { [istarget *-*-darwin*] + || [istarget *-*-linux*] } } } { return 1 } return 0 -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive

[PATCH, FYI] [testsuite] fix check-function-bodies usage

2025-02-13 Thread Alexandre Oliva
k-function-bodies PREFIX TERMINATOR[ OPTION[ SELECTOR [MATCHED]]] } } # # See sourcebuild.texi for details. -- Alexandre Oliva, happy hackerhttps://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for

[FYI, PATCH v3] [testsuite] add x86 effective target

2025-02-26 Thread Alexandre Oliva
et riscv*-*-*] } { return 1 @@ -14093,10 +14098,9 @@ proc dg-require-python-h { args } { # Return 1 if the target supports heap-trampoline, 0 otherwise. proc check_effective_target_heap_trampoline {} { if { [istarget aarch64*-*-linux*] -|| [istarget i?86-*-darwin*] -

Re: [PATCH] [testsuite] adjust expectations of x86 vect-simd-clone tests

2025-02-26 Thread Alexandre Oliva
On Feb 24, 2025, Mike Stump wrote: > I thought I saw one more needing review. Thanks, Richard Sandiford reviewed it. https://gcc.gnu.org/pipermail/gcc-patches/2025-February/676031.html -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FS

[PATCH v2] [testsuite] add x86 effective target

2025-02-17 Thread Alexandre Oliva
On Feb 13, 2025, Alexandre Oliva wrote: > @@ -14108,10 +14113,9 @@ proc dg-require-python-h { args } { > # Return 1 if the target supports heap-trampoline, 0 otherwise. > proc check_effective_target_heap_trampoline {} { > if { [istarget aarch64*-*-linux*] > - ||

Re: [PATCH] middle-end/118801 - excessive redundant DEBUG BEGIN_STMT

2025-03-06 Thread Alexandre Oliva
o please go ahead with your patch. Sorry about the delay. -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer Learn the truth about Richard Stallman at https://stallmansupport.org/

Re: [PATCH] [testsuite] [riscv] xfail update-threading on riscv [PR110628]

2025-03-31 Thread Alexandre Oliva
the trunk, only gcc-14. Patch withdrawn. H-P, perhaps it's time to drop the XFAIL on cris in the trunk? -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer More tolerance and less prejudice

[PATCH]

2025-03-31 Thread Alexandre Oliva
dg-do compile { target { ! riscv_abi_e } } } */ +/* { dg-do compile { target { { ! riscv_abi_e } && rv64 } } } */ /* { dg-add-options riscv_v } */ /* { dg-additional-options "-std=gnu99 -O3 -fno-schedule-insns -fno-schedule-insns2" } */ -- Alexandre Oliva, happy

Re: [PATCH] [testsuite] [riscv] limit vwaddsub-1.c to rv64

2025-03-31 Thread Alexandre Oliva
On Mar 31, 2025, Jeff Law wrote: > On 3/31/25 1:05 PM, Alexandre Oliva wrote: >> The desired vw{add,sub}.wx instructions don't come up on rv32 for >> the >> first two functions, we get v{add,sub}.vx instead. >> I suppose this is an oversight, and something a

[PATCH] [testsuite] [ppc] compile [PR112822] with -mvsx

2025-04-11 Thread Alexandre Oliva
ion/112822 */ /* { dg-do compile { target c++17 } } */ /* { dg-options "-w -O2" } */ +/* Required for altivec double vectors. */ +/* { dg-additional-options "-mvsx" { target powerpc*-*-* } } */ /* Verify we do not ICE on the following noisy creduced test case. */ --

[PATCH] [testsuite] [ppc] require float128 available for copysign

2025-04-11 Thread Alexandre Oliva
|| [istarget alpha*-*-*] || [istarget aarch64*-*-*] || [is-effective-target arm_neon] -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer More tolerance and less prejudice are key for

[PATCH] [testsuite] [ppc] ipa-sra-19.c: pass -Wno-psabi on powerpc-*-elf as well

2025-04-11 Thread Alexandre Oliva
powerpc-ibm-aix* powerpc-wrs-vxworks* } } */ +/* { dg-additional-options "-Wno-psabi" { target powerpc-ibm-aix* powerpc-wrs-vxworks* powerpc-*-elf } } */ typedef int __attribute__((__vector_size__(16))) vectype; -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom

[PATCH] [testsuite] [ppc] add -mfloat128 to __ieee128-using bfp tests

2025-04-11 Thread Alexandre Oliva
cc.target/powerpc/bfp/scalar-test-neg-5.c @@ -1,6 +1,8 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ -/* { dg-options "-mdejagnu-cpu=power8 -mvsx" } */ +/* { dg-options "-mdejagnu-cpu=power8 -mvsx -mfloat128" } */ +/* { dg-require-effective-target ppc_ieee128_ok }

[PATCH] [testsuite] [ppc] xfail pr52451.c on ppc [PR58684]

2025-04-11 Thread Alexandre Oliva
ieee } */ /* { dg-require-effective-target fenv_exceptions_long_double } */ /* { dg-skip-if "fenv" { powerpc-ibm-aix* } } */ -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer More toleranc

[PATCH] [testsuite] [ppc] newlib sets FE_VXSOFT on raise FE_INVALID

2025-04-11 Thread Alexandre Oliva
ns are correctly expanded and match the expected result. -- Alexandre Oliva, happy hackerhttps://blog.lx.oliva.nom.br/ Free Software Activist FSFLA co-founder GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity. Excluding neuro-others

<    10   11   12   13   14   15   16   17   18   19   >