aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-24 03:17:40 +0000
committerwschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-24 03:17:40 +0000
commit0440e0678ae8a41cbffed6d3490f05a20544036f (patch)
treee0c3b145a753da9eb995a9ef3a986ee5e5dd22bb
parentedf9e223dd337697202abbec39c3da339e26c72d (diff)
[gcc]
2015-04-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline r222351 2015-04-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rtx_is_swappable_p): Commentary adjustments. (insn_is_swappable_p): Return 1 for a convert from double to single precision when all of its uses are splats of BE element zero. [gcc/testsuite] 2015-04-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline r222351 2015-04-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/swaps-p8-18.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222394 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/rs6000/rs6000.c39
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c35
4 files changed, 85 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 09a503122b6..19ba5ab58e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2015-04-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline r222351
+ 2015-04-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rtx_is_swappable_p): Commentary
+ adjustments.
+ (insn_is_swappable_p): Return 1 for a convert from double to
+ single precision when all of its uses are splats of BE element
+ zero.
+
2015-04-23 H.J. Lu <hongjiu.lu@intel.com>
* DEV-PHASE: Set to prerelease.
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d0d82367185..356db9eb0a6 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -34245,7 +34245,8 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
order-dependent element, so additional fixup code would be
needed to make those work. Vector set and non-immediate-form
vector splat are element-order sensitive. A few of these
- cases might be workable with special handling if required. */
+ cases might be workable with special handling if required.
+ Adding cost modeling would be appropriate in some cases. */
int val = XINT (op, 1);
switch (val)
{
@@ -34284,12 +34285,6 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
case UNSPEC_VUPKLPX:
case UNSPEC_VUPKLS_V4SF:
case UNSPEC_VUPKLU_V4SF:
- /* The following could be handled as an idiom with XXSPLTW.
- These place a scalar in BE element zero, but the XXSPLTW
- will currently expect it in BE element 2 in a swapped
- region. When one of these feeds an XXSPLTW with no other
- defs/uses either way, we can avoid the lane change for
- XXSPLTW and things will be correct. TBD. */
case UNSPEC_VSX_CVDPSPN:
case UNSPEC_VSX_CVSPDP:
case UNSPEC_VSX_CVSPDPN:
@@ -34380,6 +34375,36 @@ insn_is_swappable_p (swap_web_entry *insn_entry, rtx insn,
return 0;
}
+ /* A convert to single precision can be left as is provided that
+ all of its uses are in xxspltw instructions that splat BE element
+ zero. */
+ if (GET_CODE (body) == SET
+ && GET_CODE (SET_SRC (body)) == UNSPEC
+ && XINT (SET_SRC (body), 1) == UNSPEC_VSX_CVDPSPN)
+ {
+ df_ref def;
+ struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
+
+ FOR_EACH_INSN_INFO_DEF (def, insn_info)
+ {
+ struct df_link *link = DF_REF_CHAIN (def);
+ if (!link)
+ return 0;
+
+ for (; link; link = link->next) {
+ rtx use_insn = DF_REF_INSN (link->ref);
+ rtx use_body = PATTERN (use_insn);
+ if (GET_CODE (use_body) != SET
+ || GET_CODE (SET_SRC (use_body)) != UNSPEC
+ || XINT (SET_SRC (use_body), 1) != UNSPEC_VSX_XXSPLTW
+ || XEXP (XEXP (SET_SRC (use_body), 0), 1) != const0_rtx)
+ return 0;
+ }
+ }
+
+ return 1;
+ }
+
/* Otherwise check the operands for vector lane violations. */
return rtx_is_swappable_p (body, special);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 566e76870aa..1111b374030 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2015-04-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+ Backport from mainline r222351
+ 2015-04-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/swaps-p8-18.c: New test.
+
+2015-04-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
Backport from mainline r222349
2015-04-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c
new file mode 100644
index 00000000000..c55f527d420
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-18.c
@@ -0,0 +1,35 @@
+/* { 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-not "xxpermdi" } } */
+
+/* This is a test for a specific convert-splat permute removal. */
+
+void compute (float*, float*, float*, int, int);
+double test (void);
+double gorp;
+
+int main (void)
+{
+ float X[10000], Y[256], Z[2000];
+ int i;
+ for (i = 0; i < 2500; i++)
+ compute (X, Y, Z, 256, 2000);
+ gorp = test ();
+}
+
+void compute(float *X, float *Y, float *Z, int m, int n)
+{
+ int i, j;
+ float w, *x, *y;
+
+ for (i = 0; i < n; i++)
+ {
+ w = 0.0;
+ x = X++;
+ y = Y;
+ for (j = 0; j < m; j++)
+ w += (*x++) * (*y++);
+ Z[i] = w;
+ }
+}