From 9393bc31a2a33c7662fe9d11afb059da3b46c2a6 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 17 Dec 2015 01:01:24 +0000 Subject: [PATCH] re PR target/68805 (ICE while var-tracking in simplify_binary_operation_1 with -g and -mvsx-timode) [gcc] 2015-12-15 Michael Meissner 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. [gcc/testsuite] 2015-12-15 Michael Meissner PR target/68805 * gcc.target/powerpc/pr68805.c: New test. From-SVN: r231732 --- gcc/ChangeLog | 13 ++++++++++++ gcc/config/rs6000/rs6000.c | 5 +++-- gcc/config/rs6000/vsx.md | 23 +++++++++++++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/pr68805.c | 15 ++++++++++++++ 5 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr68805.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b0a5e7921d..d7607d7d88b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2015-12-15 Michael Meissner + + 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 PR target/68779 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 6b22f93e0ff..8ffdae2e024 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -8829,8 +8829,9 @@ rs6000_const_vec (machine_mode mode) 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 { diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 2b92d451a54..b95da6f1d0c 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -26,15 +26,13 @@ ;; 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]) @@ -739,6 +737,21 @@ : 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 63d8b443819..cc8779865c5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-15 Michael Meissner + + PR target/68805 + * gcc.target/powerpc/pr68805.c: New test. + 2015-12-16 Martin Sebor PR objc++/68932 diff --git a/gcc/testsuite/gcc.target/powerpc/pr68805.c b/gcc/testsuite/gcc.target/powerpc/pr68805.c new file mode 100644 index 00000000000..f4454a9e2d2 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr68805.c @@ -0,0 +1,15 @@ +/* { 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" } } */ + -- 2.30.2