[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.