Message ID | 16ba332c-9a8a-f9f8-5672-96efc7f07d55@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
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
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]; +}