This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] V12 patch #14 of 14, Add tests for generating prefixed instructions when using vec_extract with large offsets with -mcpu=future
- From: Michael Meissner <meissner at linux dot ibm dot com>
- To: Michael Meissner <meissner at linux dot ibm dot com>, gcc-patches at gcc dot gnu dot org, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Thu, 9 Jan 2020 20:12:28 -0500
- Subject: [PATCH] V12 patch #14 of 14, Add tests for generating prefixed instructions when using vec_extract with large offsets with -mcpu=future
- References: <20200109225010.GA21999@ibm-toto.the-meissners.org>
While this patch is similar in spirit to V11 #15, I lost that patch, and I
re-implemented the check. Can I check this test into the trunk?
2020-01-09 Michael Meissner <meissner@linux.ibm.com>
* gcc.target/powerpc/vec-extract-large-si.c: New test for
vec_extract from a vector unsigned int in memory with a large
offset.
* gcc.target/powerpc/vec-extract-large-di.c: New test for
vec_extract from a vector long in memory with a large offset.
* gcc.target/powerpc/vec-extract-large-sf.c: New test for
vec_extract from a vector float in memory with a large offset.
* gcc.target/powerpc/vec-extract-large-df.c: New test for
vec_extract from a vector double in memory with a large offset.
Index: gcc/testsuite/gcc.target/powerpc/vec-extract-large-df.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/vec-extract-large-df.c (revision 280092)
+++ gcc/testsuite/gcc.target/powerpc/vec-extract-large-df.c (working copy)
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test if we can support vec_extract on V2DF vectors with a large numeric
+ offset address. */
+
+#include <altivec.h>
+
+#ifndef TYPE
+#define TYPE double
+#endif
+
+#ifndef OFFSET
+#define OFFSET 0x12345
+#endif
+
+TYPE
+get0 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 0);
+}
+
+TYPE
+get1 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 1);
+}
+
+TYPE
+getn (vector TYPE *p, unsigned long n)
+{
+ return vec_extract (p[OFFSET], n);
+}
+
+/* { dg-final { scan-assembler-times {\mplfd\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mpaddi\M} 1 } } */
Index: gcc/testsuite/gcc.target/powerpc/vec-extract-large-di.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/vec-extract-large-di.c (revision 280092)
+++ gcc/testsuite/gcc.target/powerpc/vec-extract-large-di.c (working copy)
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test if we can support vec_extract on V2DI vectors with a large numeric
+ offset address. */
+
+#include <altivec.h>
+
+#ifndef TYPE
+#define TYPE unsigned long long
+#endif
+
+#ifndef OFFSET
+#define OFFSET 0x12345
+#endif
+
+TYPE
+get0 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 0);
+}
+
+TYPE
+get1 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 1);
+}
+
+TYPE
+getn (vector TYPE *p, unsigned long n)
+{
+ return vec_extract (p[OFFSET], n);
+}
+
+/* { dg-final { scan-assembler-times {\mpld\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mpaddi\M} 1 } } */
Index: gcc/testsuite/gcc.target/powerpc/vec-extract-large-sf.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/vec-extract-large-sf.c (revision 280092)
+++ gcc/testsuite/gcc.target/powerpc/vec-extract-large-sf.c (working copy)
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test if we can support vec_extract on V4SF vectors with a large numeric
+ offset address. */
+
+#include <altivec.h>
+
+#ifndef TYPE
+#define TYPE float
+#endif
+
+#ifndef OFFSET
+#define OFFSET 0x12345
+#endif
+
+TYPE
+get0 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 0);
+}
+
+TYPE
+get1 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 1);
+}
+
+TYPE
+getn (vector TYPE *p, unsigned long n)
+{
+ return vec_extract (p[OFFSET], n);
+}
+
+/* { dg-final { scan-assembler-times {\mplfs\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mpaddi\M} 1 } } */
Index: gcc/testsuite/gcc.target/powerpc/vec-extract-large-si.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/vec-extract-large-si.c (revision 280092)
+++ gcc/testsuite/gcc.target/powerpc/vec-extract-large-si.c (working copy)
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_prefixed_addr } */
+/* { dg-options "-O2 -mdejagnu-cpu=future" } */
+
+/* Test if we can support vec_extract on V4SI vectors with a large numeric
+ offset address. */
+
+#include <altivec.h>
+
+#ifndef TYPE
+#define TYPE unsigned int
+#endif
+
+#ifndef OFFSET
+#define OFFSET 0x12345
+#endif
+
+TYPE
+get0 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 0);
+}
+
+TYPE
+get1 (vector TYPE *p)
+{
+ return vec_extract (p[OFFSET], 1);
+}
+
+TYPE
+getn (vector TYPE *p, unsigned long n)
+{
+ return vec_extract (p[OFFSET], n);
+}
+
+/* { dg-final { scan-assembler-times {\mplwz\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mpaddi\M} 1 } } */
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797