+2015-12-15 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/68805
+ * config/rs6000/rs6000.c (rs6000_gen_le_vsx_permute): Use ROTATE
+ instead of VEC_SELECT for TImode.
+
+ * config/rs6000/vsx.md (VSX_LE): Move TImode from VSX_LE to
+ VSX_LE_128, so that we use ROTATE to swap the 64-bit words instead
+ of using VEC_SELECT.
+ (VSX_LE_128): Likewise.
+ (define_peephole2): Add peephole to eliminate double xxpermdi when
+ copying TImode.
+
2015-12-16 John David Anglin <danglin@gcc.gnu.org>
PR target/68779
rtx
rs6000_gen_le_vsx_permute (rtx source, machine_mode mode)
{
- /* Use ROTATE instead of VEC_SELECT on IEEE 128-bit floating point. */
- if (FLOAT128_VECTOR_P (mode))
+ /* Use ROTATE instead of VEC_SELECT on IEEE 128-bit floating point, and
+ 128-bit integers if they are allowed in VSX registers. */
+ if (FLOAT128_VECTOR_P (mode) || mode == TImode)
return gen_rtx_ROTATE (mode, source, GEN_INT (64));
else
{
;; Iterator for the 2 64-bit vector types + 128-bit types that are loaded with
;; lxvd2x to properly handle swapping words on little endian
-(define_mode_iterator VSX_LE [V2DF
- V2DI
- V1TI
- (TI "VECTOR_MEM_VSX_P (TImode)")])
+(define_mode_iterator VSX_LE [V2DF V2DI V1TI])
;; Mode iterator to handle swapping words on little endian for the 128-bit
;; types that goes in a single vector register.
(define_mode_iterator VSX_LE_128 [(KF "FLOAT128_VECTOR_P (KFmode)")
- (TF "FLOAT128_VECTOR_P (TFmode)")])
+ (TF "FLOAT128_VECTOR_P (TFmode)")
+ (TI "TARGET_VSX_TIMODE")])
;; Iterator for the 2 32-bit vector types
(define_mode_iterator VSX_W [V4SF V4SI])
: operands[0];
})
+;; Peephole to catch memory to memory transfers for TImode if TImode landed in
+;; VSX registers on a little endian system. The vector types and IEEE 128-bit
+;; floating point are handled by the more generic swap elimination pass.
+(define_peephole2
+ [(set (match_operand:TI 0 "vsx_register_operand" "")
+ (rotate:TI (match_operand:TI 1 "vsx_register_operand" "")
+ (const_int 64)))
+ (set (match_operand:TI 2 "vsx_register_operand" "")
+ (rotate:TI (match_dup 0)
+ (const_int 64)))]
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && TARGET_VSX_TIMODE
+ && (rtx_equal_p (operands[0], operands[2])
+ || peep2_reg_dead_p (2, operands[0]))"
+ [(set (match_dup 2) (match_dup 1))])
+
;; The post-reload split requires that we re-permute the source
;; register in case it is still live.
(define_split
--- /dev/null
+/* { dg-do compile { target powerpc64le-*-* } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-O2 -mvsx-timode -mcpu=power8" } */
+
+typedef struct bar {
+ void *a;
+ void *b;
+} TYPE;
+
+void foo (TYPE *p, TYPE *q) { *p = *q; }
+
+/* { dg-final { scan-assembler "lxvd2x" } } */
+/* { dg-final { scan-assembler "stxvd2x" } } */
+/* { dg-final { scan-assembler-not "xxpermdi" } } */
+