[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2017-05-19 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #10 from Bill Schmidt  ---
Author: wschmidt
Date: Fri May 19 14:30:02 2017
New Revision: 248287

URL: https://gcc.gnu.org/viewcvs?rev=248287&root=gcc&view=rev
Log:
2017-05-19  Bill Schmidt  

Backport from mainline
2016-08-11  Bill Schmidt  

PR target/72863
* vsx.md (vsx_load_): For P8LE, emit swaps at expand time.
(vsx_store_): Likewise.


Modified:
branches/ibm/gcc-5-branch/gcc/ChangeLog.ibm
branches/ibm/gcc-5-branch/gcc/REVISION
branches/ibm/gcc-5-branch/gcc/config/rs6000/vsx.md

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

Bill Schmidt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Bill Schmidt  ---
Work is complete.

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #8 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Aug 25 16:12:23 2016
New Revision: 239762

URL: https://gcc.gnu.org/viewcvs?rev=239762&root=gcc&view=rev
Log:
[gcc]

2016-08-25  Bill Schmidt  

Backport from mainline (minus test for POWER9 support)
2016-08-11  Bill Schmidt  

PR target/72863
* vsx.md (vsx_load_): For P8LE, emit swaps at expand time.
(vsx_store_): Likewise.

[gcc/testsuite]

2016-08-25  Bill Schmidt  

Backport from mainline
2016-08-11  Bill Schmidt  

PR target/72863
* gcc.target/powerpc/pr72863.c: New test.


Added:
branches/gcc-5-branch/gcc/testsuite/gcc.target/powerpc/pr72863.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/config/rs6000/vsx.md
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-25 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #7 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Aug 25 14:24:17 2016
New Revision: 239761

URL: https://gcc.gnu.org/viewcvs?rev=239761&root=gcc&view=rev
Log:
[gcc]

2016-08-25  Bill Schmidt  

Backport from mainline
2016-08-11  Bill Schmidt  

PR target/72863
* vsx.md (vsx_load_): For P8LE, emit swaps at expand time.
(vsx_store_): Likewise.

[gcc/testsuite]

2016-08-25  Bill Schmidt  

Backport from mainline
2016-08-11  Bill Schmidt  

PR target/72863
* gcc.target/powerpc/pr72863.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr72863.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/vsx.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-11 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #6 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Aug 11 21:39:49 2016
New Revision: 239394

URL: https://gcc.gnu.org/viewcvs?rev=239394&root=gcc&view=rev
Log:
[gcc]

2016-08-11  Bill Schmidt  

PR target/72863
* vsx.md (vsx_load_): For P8LE, emit swaps at expand time.
(vsx_store_): Likewise.

[gcc/testsuite]

2016-08-11  Bill Schmidt  

PR target/72863
* gcc.target/powerpc/pr72863.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/powerpc/pr72863.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/vsx.md
trunk/gcc/testsuite/ChangeLog

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-10 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #5 from Bill Schmidt  ---
Regstrap passes.  I'll prepare the formal patch tomorrow.  Thanks for the
report!

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-10 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

Bill Schmidt  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |wschmidt at gcc dot 
gnu.org

--- Comment #4 from Bill Schmidt  ---
Created attachment 39134
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39134&action=edit
Proposed patch

Attached patch fixes the problem.  Regstrap in progress.

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-10 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #3 from Bill Schmidt  ---
This is a phase ordering issue involving the expanders for the built-ins.  In
vsx.md:

;; Explicit  load/store expanders for the builtin functions
(define_expand "vsx_load_"
  [(set (match_operand:VSX_M 0 "vsx_register_operand" "")
(match_operand:VSX_M 1 "memory_operand" ""))]
  "VECTOR_MEM_VSX_P (mode)"
  "")

(define_expand "vsx_store_"
  [(set (match_operand:VSX_M 0 "memory_operand" "")
(match_operand:VSX_M 1 "vsx_register_operand" ""))]
  "VECTOR_MEM_VSX_P (mode)"
  "")

This delays expanding into swaps until after the next split phase, instead of
right at expand time.  Since the swap optimization runs immediately following
expand, this is too late.

A normal assignment, on the other hand, goes through the mov expander in
vector.md, which takes us here:

  if (!BYTES_BIG_ENDIAN
  && VECTOR_MEM_VSX_P (mode)
  && !TARGET_P9_VECTOR
  && !gpr_or_gpr_p (operands[0], operands[1])
  && (memory_operand (operands[0], mode)
  ^ memory_operand (operands[1], mode)))
{
  rs6000_emit_le_vsx_move (operands[0], operands[1], mode);
  DONE;
}

thus generating the permuting load/store with the register permute.

We should be able to add similar logic to the intrinsic expanders in order to
get the swaps to show up in time to be optimized.

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-10 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

Bill Schmidt  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-08-10
 Ever confirmed|0   |1

--- Comment #2 from Bill Schmidt  ---
Confirmed.

[Bug target/72863] Powerpc64le: redundant swaps when using vec_vsx_ld/st

2016-08-10 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72863

--- Comment #1 from Bill Schmidt  ---
Egad.  How appalling.  I'll have a look soon.