[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2022-12-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #18 from Andrew Pinski  ---
*** Bug 101634 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-27 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

Richard Biener  changed:

   What|Removed |Added

 CC||gcc at wdqb dot uk

--- Comment #17 from Richard Biener  ---
*** Bug 101634 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

Richard Biener  changed:

   What|Removed |Added

  Known to work||11.1.1
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED
   Priority|P3  |P2

--- Comment #16 from Richard Biener  ---
Fixed.

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #15 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Richard Biener
:

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

commit r11-8722-gf32145c27eec468247353b59ec5f62fcba3ae2c7
Author: Richard Biener 
Date:   Thu Jul 1 10:35:38 2021 +0200

tree-optimization/100778 - fix placement of trapping vectorized ops

This avoids placing possibly trapping vectorized operations where
the corresponding scalar operation was possibly not executed.

2021-01-07  Richard Biener  

PR tree-optimization/100778
* tree-vect-slp.c (vect_schedule_slp_node): Do not place trapping
vectorized ops ahead of their scalar BB.

* gcc.dg/torture/pr100778.c: New testcase.

(cherry picked from commit a3aaba68405751bae3f630669515b7ecdf77efa6)

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #14 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Richard Biener
:

https://gcc.gnu.org/g:1c2e5ab1468d959200334f2f5039d8d6af01f9fb

commit r11-8721-g1c2e5ab1468d959200334f2f5039d8d6af01f9fb
Author: Richard Biener 
Date:   Fri May 28 14:26:06 2021 +0200

tree-optimization/100778 - avoid cross-BB vectorization of trapping op

This avoids vectorizing a possibly trapping operation when lanes
are handled in different BBs.  I spotted this when working on the
originally reported issue in PR100778.

2021-05-28  Richard Biener  

PR tree-optimization/100778
* tree-vect-slp.c (vect_build_slp_tree_1): Prevent possibly
trapping ops in different BBs.

* gcc.dg/vect/bb-slp-pr100778-1.c: New testcase.

(cherry picked from commit f7a07f5a5d8065e7f11133dd1f4ad3510ab2195b)

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778
Bug 100778 depends on bug 101423, which changed state.

Bug 101423 Summary: [12 Regression] ICE in vect_schedule_slp_node, at 
tree-vect-slp.c:7113 since r12-1951-ga3aaba68405751ba
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101423

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-02 Thread gabrielle.hugo at cern dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #13 from Gabrielle Hugo  ---
>Yes, we're usually waiting a bit to see if fallout is detected by 
>autotesters before backporting to release branches.

Oki thanks!

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

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

--- Comment #12 from rguenther at suse dot de  ---
On Fri, 2 Jul 2021, gabrielle.hugo at cern dot ch wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778
> 
> --- Comment #11 from Gabrielle Hugo  ---
> Awesome, thanks a lot Richard!
> 
> 
> Applying your patch in tree-vect-slp.c to gcc 11, I now get the vectorized
> division divpd after the if as expected:
> 
>   if (norm .gt. 1.D+00) then
>   400826:   76 7b   jbe4008a3 
>   400828:   66 0f 28 d0 movapd %xmm0,%xmm2
>  x = x / norm
>  y = y / norm
>  write (*, '(A,F5.3)') 'Normalized x and y.', norm
>   40082c:   48 8b 05 c5 01 00 00mov0x1c5(%rip),%rax# 
> 4009f8
> 
>   400833:   48 8d 6c 24 10  lea0x10(%rsp),%rbp
>   400838:   48 c7 44 24 18 78 09movq   $0x400978,0x18(%rsp)
>   40083f:   40 00 
>   400841:   66 0f 14 d2 unpcklpd %xmm2,%xmm2
>   400845:   48 89 efmov%rbp,%rdi
>   400848:   c7 44 24 20 1d 00 00movl   $0x1d,0x20(%rsp)
>   40084f:   00 
>  x = x / norm
>   400850:   66 0f 5e ca divpd  %xmm2,%xmm1
> 
> 
> So if I understand correctly the fix in SLP vectorization 
> (is_a  (vinfo)), 
> when there are possibly trapping operations 
> (gimple_could_trap_p (stmt_info->stmt)), 
> is to explicitely constrain them to come from the same BB 
> (special handling when gimple_bb (last_stmt) != gimple_bb (stmt_info->stmt) ).

Yes.

> Do I understand correctly that trunk is basically gcc 12.0, which will
> eventually end up being released as gcc 12.1 ?

Yes.

> What about gcc 11, will this fix also make its way to the next gcc 11 release?

Yes, we're usually waiting a bit to see if fallout is detected by
autotesters before backporting to release branches.

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-02 Thread gabrielle.hugo at cern dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

--- Comment #11 from Gabrielle Hugo  ---
Awesome, thanks a lot Richard!


Applying your patch in tree-vect-slp.c to gcc 11, I now get the vectorized
division divpd after the if as expected:

  if (norm .gt. 1.D+00) then
  400826:   76 7b   jbe4008a3 
  400828:   66 0f 28 d0 movapd %xmm0,%xmm2
 x = x / norm
 y = y / norm
 write (*, '(A,F5.3)') 'Normalized x and y.', norm
  40082c:   48 8b 05 c5 01 00 00mov0x1c5(%rip),%rax# 4009f8

  400833:   48 8d 6c 24 10  lea0x10(%rsp),%rbp
  400838:   48 c7 44 24 18 78 09movq   $0x400978,0x18(%rsp)
  40083f:   40 00 
  400841:   66 0f 14 d2 unpcklpd %xmm2,%xmm2
  400845:   48 89 efmov%rbp,%rdi
  400848:   c7 44 24 20 1d 00 00movl   $0x1d,0x20(%rsp)
  40084f:   00 
 x = x / norm
  400850:   66 0f 5e ca divpd  %xmm2,%xmm1


So if I understand correctly the fix in SLP vectorization 
(is_a  (vinfo)), 
when there are possibly trapping operations 
(gimple_could_trap_p (stmt_info->stmt)), 
is to explicitely constrain them to come from the same BB 
(special handling when gimple_bb (last_stmt) != gimple_bb (stmt_info->stmt) ).


Do I understand correctly that trunk is basically gcc 12.0, which will
eventually end up being released as gcc 12.1 ?
What about gcc 11, will this fix also make its way to the next gcc 11 release?

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-07-01 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

Richard Biener  changed:

   What|Removed |Added

  Known to work||12.0
Summary|[11/12 Regression] Get  |[11 Regression] Get SIGFPE
   |SIGFPE on simple test with  |on simple test with
   |-fpe-trap=invalid and SLP   |-fpe-trap=invalid and SLP
   |vectorization ON, with  |vectorization ON, with
   |gfortran 11.1.0 on x86_64   |gfortran 11.1.0 on x86_64

--- Comment #10 from Richard Biener  ---
Fixed on trunk sofar.

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-05-28 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |11.2
 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #3 from Richard Biener  ---
Confirmed.  It's SLP vectorization placing the vectorized division outside of
the if:

[local count: 1073741824]:
+  vectp.9_32 = &(*input_8(D))[0];
+  vect__1.10_33 = MEM  [(real(kind=8) *)vectp.9_32];
+  _35 = BIT_FIELD_REF ;
+  _34 = BIT_FIELD_REF ;
   _1 = (*input_8(D))[0];
-  coordinates.x = _1;
   _2 = (*input_8(D))[1];
-  coordinates.y = _2;
-  _11 = _1 * _1;
-  _12 = _2 * _2;
+  MEM  [(real(kind=8) *)] = vect__1.10_33;
+  _11 = _34 * _34;
+  _12 = _35 * _35;
   _3 = _11 + _12;
   norm_13 = __builtin_sqrt (_3);
+  _37 = {norm_13, norm_13};
+  vect__4.13_38 = vect__1.10_33 / _37;
   if (norm_13 > 1.0e+0)
 goto ; [41.48%]
   else
@@ -34,13 +64,11 @@

[local count: 445388112]:
   _4 = _1 / norm_13;
-  coordinates.x = _4;
   _5 = _2 / norm_13;
-  coordinates.y = _5;
+  MEM  [(real(kind=8) *)] = vect__4.13_38;

[Bug tree-optimization/100778] [11 Regression] Get SIGFPE on simple test with -fpe-trap=invalid and SLP vectorization ON, with gfortran 11.1.0 on x86_64

2021-05-26 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100778

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

  Component|fortran |tree-optimization

--- Comment #2 from anlauf at gcc dot gnu.org ---
Changing component to tree-optimization for inspection by experts.