aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-06-09 14:48:35 +0200
committerRichard Biener <rguenther@suse.de>2021-06-09 16:33:18 +0200
commit374f93da97fb0378453d503f3cfea4d7a923a89c (patch)
tree2899c3123df63912049f2fa094987f262084701c /libgomp
parentce670e4faafb296d1f1a7828d20f8c8ba4686797 (diff)
downloadgcc-374f93da97fb0378453d503f3cfea4d7a923a89c.zip
gcc-374f93da97fb0378453d503f3cfea4d7a923a89c.tar.gz
gcc-374f93da97fb0378453d503f3cfea4d7a923a89c.tar.bz2
tree-optimization/100981 - fix SLP patterns involving reductions
The following fixes the SLP FMA patterns to preserve reduction info and the reduction vectorization to consider internal function call defs for the reduction stmt. 2021-06-09 Richard Biener <rguenther@suse.de> PR tree-optimization/100981 gcc/ * tree-vect-loop.c (vect_create_epilog_for_reduction): Use gimple_get_lhs to also handle calls. * tree-vect-slp-patterns.c (complex_pattern::build): Transfer reduction info. gcc/testsuite/ * gfortran.dg/vect/pr100981-1.f90: New testcase. libgomp/ * testsuite/libgomp.fortran/pr100981-2.f90: New testcase.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/testsuite/libgomp.fortran/pr100981-2.f9031
1 files changed, 31 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.fortran/pr100981-2.f90 b/libgomp/testsuite/libgomp.fortran/pr100981-2.f90
new file mode 100644
index 0000000..12836d4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/pr100981-2.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+! { dg-additional-options "-O3 -ftree-parallelize-loops=2 -fno-signed-zeros -fno-trapping-math" }
+
+complex function cdcdot(n, cx)
+ implicit none
+
+ integer :: n, i, kx
+ complex :: cx(*)
+ double precision :: dsdotr, dsdoti, dt1, dt3
+
+ kx = 1
+ do i = 1, n
+ dt1 = real(cx(kx))
+ dt3 = aimag(cx(kx))
+ dsdotr = dsdotr + dt1 * 2 - dt3 * 2
+ dsdoti = dsdoti + dt1 * 2 + dt3 * 2
+ kx = kx + 1
+ end do
+ cdcdot = cmplx(real(dsdotr), real(dsdoti))
+ return
+end function cdcdot
+program test
+ implicit none
+ complex :: cx(100), ct, cdcdot
+ integer :: i
+ do i = 1, 100
+ cx(i) = cmplx(2*i, i)
+ end do
+ ct = cdcdot (100, cx)
+ if (ct.ne.cmplx(10100.0000,30300.0000)) call abort
+end