diff mbox series

Disable *vsx_reduc_<VEC_reduc_name>_v2df_scalar on little endian (PR target/87064)

Message ID 20190122163158.GU30353@tucnak
State New
Headers show
Series Disable *vsx_reduc_<VEC_reduc_name>_v2df_scalar on little endian (PR target/87064) | expand

Commit Message

Jakub Jelinek Jan. 22, 2019, 4:31 p.m. UTC
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  <jakub@redhat.com>

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


	Jakub

Comments

Segher Boessenkool Jan. 22, 2019, 7 p.m. UTC | #1
Hi Jakub,

On Tue, Jan 22, 2019 at 05:31:58PM +0100, Jakub Jelinek wrote:
> 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?

Okay.  Thanks!  Also okay for backports.


Segher


> 2019-01-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/87064
> 	* config/rs6000/vsx.md (*vsx_reduc_<VEC_reduc_name>_v2df_scalar):
> 	Disable for little endian.
diff mbox series

Patch

--- 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)]