|
|
8178f7 |
2016-08-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
|
|
8178f7 |
|
|
|
8178f7 |
Backport from mainline (minus test for POWER9 support)
|
|
|
8178f7 |
2016-08-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
|
|
|
8178f7 |
|
|
|
8178f7 |
PR target/72863
|
|
|
8178f7 |
* vsx.md (vsx_load_<mode>): For P8LE, emit swaps at expand time.
|
|
|
8178f7 |
(vsx_store_<mode>): Likewise.
|
|
|
8178f7 |
|
|
|
8178f7 |
* gcc.target/powerpc/pr72863.c: New test.
|
|
|
8178f7 |
|
|
|
8178f7 |
--- gcc/config/rs6000/vsx.md (revision 239761)
|
|
|
8178f7 |
+++ gcc/config/rs6000/vsx.md (revision 239762)
|
|
|
8178f7 |
@@ -716,13 +716,27 @@ (define_expand "vsx_load_<mode>"
|
|
|
8178f7 |
[(set (match_operand:VSX_M 0 "vsx_register_operand" "")
|
|
|
8178f7 |
(match_operand:VSX_M 1 "memory_operand" ""))]
|
|
|
8178f7 |
"VECTOR_MEM_VSX_P (<MODE>mode)"
|
|
|
8178f7 |
- "")
|
|
|
8178f7 |
+{
|
|
|
8178f7 |
+ /* Expand to swaps if needed, prior to swap optimization. */
|
|
|
8178f7 |
+ if (!BYTES_BIG_ENDIAN)
|
|
|
8178f7 |
+ {
|
|
|
8178f7 |
+ rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
|
|
|
8178f7 |
+ DONE;
|
|
|
8178f7 |
+ }
|
|
|
8178f7 |
+})
|
|
|
8178f7 |
|
|
|
8178f7 |
(define_expand "vsx_store_<mode>"
|
|
|
8178f7 |
[(set (match_operand:VSX_M 0 "memory_operand" "")
|
|
|
8178f7 |
(match_operand:VSX_M 1 "vsx_register_operand" ""))]
|
|
|
8178f7 |
"VECTOR_MEM_VSX_P (<MODE>mode)"
|
|
|
8178f7 |
- "")
|
|
|
8178f7 |
+{
|
|
|
8178f7 |
+ /* Expand to swaps if needed, prior to swap optimization. */
|
|
|
8178f7 |
+ if (!BYTES_BIG_ENDIAN)
|
|
|
8178f7 |
+ {
|
|
|
8178f7 |
+ rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
|
|
|
8178f7 |
+ DONE;
|
|
|
8178f7 |
+ }
|
|
|
8178f7 |
+})
|
|
|
8178f7 |
|
|
|
8178f7 |
|
|
|
8178f7 |
;; VSX vector floating point arithmetic instructions. The VSX scalar
|
|
|
8178f7 |
--- gcc/testsuite/gcc.target/powerpc/pr72863.c (nonexistent)
|
|
|
8178f7 |
+++ gcc/testsuite/gcc.target/powerpc/pr72863.c (revision 239762)
|
|
|
8178f7 |
@@ -0,0 +1,27 @@
|
|
|
8178f7 |
+/* { dg-do compile { target { powerpc64le-*-* } } } */
|
|
|
8178f7 |
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
|
|
|
8178f7 |
+/* { dg-options "-mcpu=power8 -O3" } */
|
|
|
8178f7 |
+/* { dg-final { scan-assembler "lxvd2x" } } */
|
|
|
8178f7 |
+/* { dg-final { scan-assembler "stxvd2x" } } */
|
|
|
8178f7 |
+/* { dg-final { scan-assembler-not "xxpermdi" } } */
|
|
|
8178f7 |
+
|
|
|
8178f7 |
+#include <altivec.h>
|
|
|
8178f7 |
+
|
|
|
8178f7 |
+extern unsigned char *src, *dst;
|
|
|
8178f7 |
+
|
|
|
8178f7 |
+void b(void)
|
|
|
8178f7 |
+{
|
|
|
8178f7 |
+ int i;
|
|
|
8178f7 |
+
|
|
|
8178f7 |
+ unsigned char *s8 = src;
|
|
|
8178f7 |
+ unsigned char *d8 = dst;
|
|
|
8178f7 |
+
|
|
|
8178f7 |
+ for (i = 0; i < 100; i++) {
|
|
|
8178f7 |
+ vector unsigned char vs = vec_vsx_ld(0, s8);
|
|
|
8178f7 |
+ vector unsigned char vd = vec_vsx_ld(0, d8);
|
|
|
8178f7 |
+ vector unsigned char vr = vec_xor(vs, vd);
|
|
|
8178f7 |
+ vec_vsx_st(vr, 0, d8);
|
|
|
8178f7 |
+ s8 += 16;
|
|
|
8178f7 |
+ d8 += 16;
|
|
|
8178f7 |
+ }
|
|
|
8178f7 |
+}
|