[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-1729-ga0af6fd825d533

2025-07-16 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #16 from GCC Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:bc5570f7ef796fa7f5ab89b34ed9de2be5299f0e

commit r16-2299-gbc5570f7ef796fa7f5ab89b34ed9de2be5299f0e
Author: Richard Biener 
Date:   Wed Jul 16 15:07:58 2025 +0200

tree-optimization/121049 - avoid loop masking with even/odd reduction

The following disables loop masking when we are using an even/odd
widening operation in a reduction because the loop mask then aligns
to the wrong elements.

PR tree-optimization/121049
* internal-fn.h (widening_evenodd_fn_p): Declare.
* internal-fn.cc (widening_evenodd_fn_p): New function.
* tree-vect-stmts.cc (vectorizable_conversion): When using
an even/odd widening function disable loop masking.

* gcc.dg/vect/pr121049.c: New testcase.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-1729-ga0af6fd825d533

2025-07-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #15 from Richard Biener  ---
I think the issue is that we do

  _79 = _78 > { 0, 1, 2, 3, 4, 5, 6, 7 };
  vect__12.20_57 = .MASK_LOAD (vectp_mon_lengths.19_51, 256B, _79, { 0, 0, 0,
0, 0, 0, 0, 0 });
  vect_patt_18.21_58 = WIDEN_MULT_EVEN_EXPR ;
  vect_patt_18.21_59 = WIDEN_MULT_ODD_EXPR ;
  _63 = VIEW_CONVERT_EXPR>(_79);
  vect_value_4.23_64 = .COND_ADD (_63, vect_patt_18.21_58, _60, _60);
  _65 = VIEW_CONVERT_EXPR(_79);
  _66 = _65 >> 4;
  _67 = VIEW_CONVERT_EXPR>(_66);
  vect_value_4.23_68 = .COND_ADD (_67, vect_patt_18.21_59, vect_value_4.23_64,
vect_value_4.23_64);

so we use an even/odd widen mult for the reduction - which ultimatively is OK,
but when we do loop masking it is not, since we the mask the wrong elements.
We'd need an lo/hi widen mult or alternatively do an even/odd extract of the
loop mask instead of taking the lo/hi when distributing.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-1729-ga0af6fd825d533

2025-07-14 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Sam James  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=116142

--- Comment #14 from Sam James  ---
(In reply to Sam James from comment #13)
> (In reply to [email protected] from comment #11)
> > Probably related to PR120927 then.
> 
> Thanks for the hint. Indeed that lets me bisect it back to
> r16-1729-ga0af6fd825d533 (w/ --param vect-partial-vector-usage=1 -O3
> -march=x86-64-v4 -mtune=znver4). I fear that is not too helpful either
> though.

If I also heap on r16-1729-ga0af6fd825d533, I can bisect it back to
r15-2791-g2083389a18d366.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-1729-ga0af6fd825d533

2025-07-14 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Sam James  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=120927
Summary|[16 regression] |[16 regression]
   |timezone-data miscompiled   |timezone-data miscompiled
   |with -O3 -march=x86-64-v4   |with -O3 -march=x86-64-v4
   |-mtune=znver4 since |-mtune=znver4 since
   |r16-2088-ge9079e4f43d135|r16-1729-ga0af6fd825d533

--- Comment #13 from Sam James  ---
(In reply to [email protected] from comment #11)
> Probably related to PR120927 then.

Thanks for the hint. Indeed that lets me bisect it back to
r16-1729-ga0af6fd825d533 (w/ --param vect-partial-vector-usage=1 -O3
-march=x86-64-v4 -mtune=znver4). I fear that is not too helpful either though.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-14 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Richard Biener  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #12 from Richard Biener  ---
I will look at this at some point but will prioritize the issues also affecting
GCC 15 first.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-13 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #11 from rguenther at suse dot de  ---
On Sun, 13 Jul 2025, sjames at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049
> 
> --- Comment #9 from Sam James  ---
> Yes, I tried to go further but the compiler hangs with the needed param before
> that commit for a large part of the range.

Probably related to PR120927 then.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Andrew Pinski  changed:

   What|Removed |Added

 Target||x86_64

--- Comment #10 from Andrew Pinski  ---
Unlike the other one, `-O3 -march=x86-64-v4 --param
vect-partial-vector-usage=1` still works.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-13 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #9 from Sam James  ---
Yes, I tried to go further but the compiler hangs with the needed param before
that commit for a large part of the range.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-13 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #8 from Andrew Pinski  ---
(In reply to Sam James from comment #7)
> r16-2088-ge9079e4f43d135

This looks like it just exposed the issue with a costing model change in the
backend.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4 since r16-2088-ge9079e4f43d135

2025-07-12 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Sam James  changed:

   What|Removed |Added

   Keywords|needs-bisection |
 CC||rguenth at gcc dot gnu.org
Summary|[16 regression] |[16 regression]
   |timezone-data miscompiled   |timezone-data miscompiled
   |with -O3 -march=x86-64-v4   |with -O3 -march=x86-64-v4
   |-mtune=znver4   |-mtune=znver4 since
   ||r16-2088-ge9079e4f43d135

--- Comment #7 from Sam James  ---
r16-2088-ge9079e4f43d135

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Andrew Pinski  changed:

   What|Removed |Added

  Attachment #61852|0   |1
is obsolete||

--- Comment #6 from Andrew Pinski  ---
Created attachment 61853
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61853&action=edit
Slightly more reduced

Looks like only the first and last values of the array are added and missing
the middle one.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Andrew Pinski  changed:

   What|Removed |Added

  Attachment #61851|0   |1
is obsolete||

--- Comment #4 from Andrew Pinski  ---
Created attachment 61852
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61852&action=edit
Removed the header

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2025-07-13
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW

--- Comment #5 from Andrew Pinski  ---
Confirmed.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Andrew Pinski  changed:

   What|Removed |Added

  Attachment #61850|0   |1
is obsolete||

--- Comment #3 from Andrew Pinski  ---
Created attachment 61851
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61851&action=edit
Reduced further

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #2 from Sam James  ---
Created attachment 61850
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61850&action=edit
localtime.c

Reduced it a bit more.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

--- Comment #1 from Sam James  ---
May have overreduced, sec.

[Bug tree-optimization/121049] [16 regression] timezone-data miscompiled with -O3 -march=x86-64-v4 -mtune=znver4

2025-07-12 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121049

Sam James  changed:

   What|Removed |Added

   Keywords||wrong-code
   Target Milestone|--- |16.0