* [PATCH, rs6000] Fix PR77613 (swap optimization for splat-with-truncate)
@ 2016-09-16 15:27 Bill Schmidt
2016-09-16 16:31 ` Segher Boessenkool
0 siblings, 1 reply; 2+ messages in thread
From: Bill Schmidt @ 2016-09-16 15:27 UTC (permalink / raw)
To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn, anton
Hi,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77613 identifies a case
where we fail to remove swaps from a region because it contains a form
of splat that we don't yet recognize. This patch adds support for splat
insns that have an embedded truncate, such as the vsx_vsplth_di pattern.
Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
regressions. Ok for trunk, and eventual backport to 6 and 5 branches?
Thanks,
Bill
[gcc]
2016-09-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/77613
* config/rs6000/rs6000.c (rtx_is_swappable_p): Add support for
splat with truncate.
[gcc/testsuite]
2016-09-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR target/77613
* gcc.target/powerpc/swaps-p8-25.c: New.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 240187)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -39105,6 +39105,11 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
&& 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
+ && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
+ && 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. */
Index: gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c (revision 0)
+++ gcc/testsuite/gcc.target/powerpc/swaps-p8-25.c (working copy)
@@ -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];
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH, rs6000] Fix PR77613 (swap optimization for splat-with-truncate)
2016-09-16 15:27 [PATCH, rs6000] Fix PR77613 (swap optimization for splat-with-truncate) Bill Schmidt
@ 2016-09-16 16:31 ` Segher Boessenkool
0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2016-09-16 16:31 UTC (permalink / raw)
To: Bill Schmidt; +Cc: GCC Patches, David Edelsohn, anton
On Fri, Sep 16, 2016 at 10:13:09AM -0500, Bill Schmidt wrote:
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no
> regressions. Ok for trunk, and eventual backport to 6 and 5 branches?
Okay and okay. One nit...
> --- gcc/config/rs6000/rs6000.c (revision 240187)
> +++ gcc/config/rs6000/rs6000.c (working copy)
> @@ -39105,6 +39105,11 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
> && 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
> + && GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
Please use REG_P here.
> + && 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. */
Thanks,
Segher
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-16 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 15:27 [PATCH, rs6000] Fix PR77613 (swap optimization for splat-with-truncate) Bill Schmidt
2016-09-16 16:31 ` Segher Boessenkool
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).