From: Bill Schmidt Date: Fri, 16 Sep 2016 21:28:52 +0000 (+0000) Subject: re PR target/77613 (Powerpc64le: redundant swaps in autovectorised loop) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a42726b2e41d0d0d45bdf0c08ef59b9b6fde07d;p=gcc.git re PR target/77613 (Powerpc64le: redundant swaps in autovectorised loop) [gcc] 2016-09-16 Bill Schmidt PR target/77613 * config/rs6000/rs6000.c (rtx_is_swappable_p): Add support for splat with truncate. [gcc/testsuite] 2016-09-16 Bill Schmidt PR target/77613 * gcc.target/powerpc/swaps-p8-25.c: New. From-SVN: r240199 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 660bd9580b4..f87ea00dfd8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-16 Bill Schmidt + + PR target/77613 + * config/rs6000/rs6000.c (rtx_is_swappable_p): Add support for + splat with truncate. + 2016-09-16 Jason Merrill * hwint.h (least_bit_hwi, pow2_or_zerop, pow2p_hwi, ctz_or_zero): diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 557009f8099..ed24d96006f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -39101,10 +39101,15 @@ rtx_is_swappable_p (rtx op, unsigned int *special) handling. */ if (GET_CODE (XEXP (op, 0)) == CONST_INT) return 1; - else if (GET_CODE (XEXP (op, 0)) == REG + else if (REG_P (XEXP (op, 0)) && GET_MODE_INNER (GET_MODE (op)) == GET_MODE (XEXP (op, 0))) /* This catches V2DF and V2DI splat, at a minimum. */ return 1; + else if (GET_CODE (XEXP (op, 0)) == TRUNCATE + && REG_P (XEXP (XEXP (op, 0), 0)) + && GET_MODE_INNER (GET_MODE (op)) == GET_MODE (XEXP (op, 0))) + /* This catches splat of a truncated value. */ + return 1; else if (GET_CODE (XEXP (op, 0)) == VEC_SELECT) /* If the duplicated item is from a select, defer to the select processing to see if we can change the lane for the splat. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dfcccf7726e..b2bded06ac6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-16 Bill Schmidt + + PR target/77613 + * gcc.target/powerpc/swaps-p8-25.c: New. + 2016-09-16 Jakub Jelinek PR c++/77482 diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c new file mode 100644 index 00000000000..5b999488539 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3 " } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +/* Verify that swap optimization works correctly for a truncating splat. */ + +/* Test case to resolve PR77613. */ + +void pr77613 (signed short a, signed short *x, signed short *y) +{ + unsigned long i; + + for (i = 0; i < 1024; i++) + y[i] = a * x[i] + y[i]; +}