Hi!

The following patch disables *vsx_reduc_<VEC_reduc_name>_v2df_scalar
define_insn_and_split for little endian, because it both generates
wrong code there (fixable), but also even if fixed, emit much worse code
than when it is not present at all.
The comment on the pattern says:
;; Combiner patterns with the vector reduction patterns that knows we can get
;; to the top element of the V2DF array without doing an extract.
but for little endian that is not the case, the end result is that a vector
is unnecessarily forced into memory.

Fixed thusly, bootstrapped/regtested on powerpc64le-linux, fixes
FAIL: libgomp.oacc-fortran/reduction-3.f90 -DACC_DEVICE_TYPE_host=1 
-DACC_MEM_SHARED=1  -O1  execution test
, ok for trunk?

2019-01-22  Jakub Jelinek  <ja...@redhat.com>

        PR target/87064
        * config/rs6000/vsx.md (*vsx_reduc_<VEC_reduc_name>_v2df_scalar):
        Disable for little endian.

--- gcc/config/rs6000/vsx.md.jj 2019-01-19 09:39:13.224924063 +0100
+++ gcc/config/rs6000/vsx.md    2019-01-21 23:39:27.527774247 +0100
@@ -4351,7 +4351,7 @@ (define_insn_and_split "*vsx_reduc_<VEC_
          (match_dup 1))
         (parallel [(const_int 1)])))
    (clobber (match_scratch:DF 2 "=0,0,&wd,&wa"))]
-  "VECTOR_UNIT_VSX_P (V2DFmode)"
+  "BYTES_BIG_ENDIAN && VECTOR_UNIT_VSX_P (V2DFmode)"
   "#"
   ""
   [(const_int 0)]

        Jakub

Reply via email to