A libgomp test demonstrated a problem with reduction code in the Power back end
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87064) for little-endian code.  
The 
define_insn_and_split at the heart of the problem depends on big-endian data 
layout, 
and should have been disabled when little-endian support was added around 2012.
We missed that.  The pattern in question was used for V2DF mode; there is a 
similar
pattern for V4SF mode that should also have been disabled.  This patch disables
both patterns.  Thanks to Jakub for analyzing the problem!

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions.
The failing testcase now passes.  Is this okay for trunk, and eventually for
backports to all supported releases?

Thanks,
Bill


2019-01-22  Jakub Jelinek  <ja...@redhat.com>
            Bill Schmidt  <wschm...@linux.ibm.com>

        * config/rs6000/vsx.md (*vsx_reduc_<VEC_reduc_name>_v2df_scalar):
        Disable for little endian.
        (*vsx_reduc_<VEC_reduc_name>_v4sf_scalar): Likewise.


Index: gcc/config/rs6000/vsx.md
===================================================================
--- gcc/config/rs6000/vsx.md    (revision 268115)
+++ gcc/config/rs6000/vsx.md    (working copy)
@@ -4351,7 +4351,7 @@
          (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)]
@@ -4378,7 +4378,7 @@
    (clobber (match_scratch:V4SF 2 "=&wf,&wa"))
    (clobber (match_scratch:V4SF 3 "=&wf,&wa"))
    (clobber (match_scratch:V4SF 4 "=0,0"))]
-  "VECTOR_UNIT_VSX_P (V4SFmode)"
+  "BYTES_BIG_ENDIAN && VECTOR_UNIT_VSX_P (V4SFmode)"
   "#"
   ""
   [(const_int 0)]

Reply via email to