aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorKelvin Nilsen <kelvin@gcc.gnu.org>2020-05-11 11:01:32 -0500
committerBill Schmidt <wschmidt@linux.ibm.com>2020-05-11 11:01:32 -0500
commit2403d3d7a5e4878f211d868fd4b76a4b70ce2a54 (patch)
tree9228482ac0ba952e4b3d733fa58a15118caf2c5c /gcc/testsuite
parent84f4954c38228e4cb3e6f0b5471883e6c2523631 (diff)
downloadgcc-2403d3d7a5e4878f211d868fd4b76a4b70ce2a54.zip
gcc-2403d3d7a5e4878f211d868fd4b76a4b70ce2a54.tar.gz
gcc-2403d3d7a5e4878f211d868fd4b76a4b70ce2a54.tar.bz2
rs6000: Add scalar cfuged instruction
Add the centifuge-doubleword instruction and built-in access. [gcc] 2020-05-11 Kelvin Nilsen <kelvin@gcc.gnu.org> * config/rs6000/rs6000-builtin.def (BU_FUTURE_MISC_0): New #define. (BU_FUTURE_MISC_1): Likewise. (BU_FUTURE_MISC_2): Likewise. (BU_FUTURE_MISC_3): Likewise. (__builtin_cfuged): New built-in function definition. * config/rs6000/rs6000.md (UNSPEC_CFUGED): New constant. (cfuged): New insn. * doc/extend.texi (Basic PowerPC Built-in Functions Available for a Future Architecture): New subsubsection. [gcc/testsuite] 2020-05-11 Kelvin Nilsen <kelvin@gcc.gnu.org> * gcc.target.powerpc/cfuged-0.c: New test. * gcc.target.powerpc/cfuged-1.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cfuged-0.c50
-rw-r--r--gcc/testsuite/gcc.target/powerpc/cfuged-1.c50
3 files changed, 105 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 92e1d40..ed9b0d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-11 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ * gcc.target.powerpc/cfuged-0.c: New test.
+ * gcc.target.powerpc/cfuged-1.c: New test.
+
2020-05-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/95049
diff --git a/gcc/testsuite/gcc.target/powerpc/cfuged-0.c b/gcc/testsuite/gcc.target/powerpc/cfuged-0.c
new file mode 100644
index 0000000..6c2d5c7a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/cfuged-0.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-mdejagnu-cpu=future" } */
+
+extern void abort (void);
+
+unsigned long long int
+do_cfuged (unsigned long long int source, unsigned long long int mask)
+{
+ return __builtin_cfuged (source, mask);
+}
+
+int main (int argc, char *argv [])
+{
+ unsigned long long int sources [4], masks [4];
+ unsigned long long int results [4][4] = {
+ /* sources[0] with each of masks [0 .. 3] */
+ {0x7e3ca5f0ll, 0xa5f07e3cll, 0xaf7350ecll, 0x50ecaf73ll },
+ /* sources[1] with each of masks [0 .. 3] */
+ { 0xa5f07e3cll, 0x7e3ca5f0ll, 0x73afec50ll, 0xec5073afll },
+ /* sources[2] with each of masks [0 .. 3] */
+ { 0xf07e3ca5ll, 0x3ca5f07ell, 0x3af7c50ell, 0xc50e3af7ll },
+ /* sources[3] with each of masks [0 .. 3] */
+ { 0xe7c35a0fll, 0x5a0fe7c3ll, 0x50ecaf73ll, 0xaf7350ecll },
+ };
+
+ sources[0] = 0xa5f07e3cll;
+ sources[1] = 0x7e3ca5f0ll;
+ sources[2] = 0x3ca5f07ell;
+ sources[3] = 0x5a0fe7c3ll;
+
+ masks[0] = 0xffff0000ll;
+ masks[1] = 0x0000ffffll;
+ masks[2] = 0x0f0f0f0fll;
+ masks[3] = 0xf0f0f0f0ll;
+
+ unsigned long long int result;
+
+ for (int i = 0; i < 4; i++)
+ {
+ for (int j = 0; j < 4; j++)
+ {
+ if (do_cfuged (sources[i], masks[j]) != results [i][j])
+ abort ();
+ }
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler {\mcfuged\M} } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/cfuged-1.c b/gcc/testsuite/gcc.target/powerpc/cfuged-1.c
new file mode 100644
index 0000000..83bf2ae
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/cfuged-1.c
@@ -0,0 +1,50 @@
+/* { dg-do run } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target powerpc_future_hw } */
+/* { dg-options "-mdejagnu-cpu=future" } */
+
+extern void abort (void);
+
+unsigned long long int
+do_cfuged (unsigned long long int source, unsigned long long int mask)
+{
+ return __builtin_cfuged (source, mask);
+}
+
+int main (int argc, char *argv [])
+{
+ unsigned long long int sources [4], masks [4];
+ unsigned long long int results [4][4] = {
+ /* sources[0] with each of masks [0 .. 3] */
+ {0x7e3ca5f0ll, 0xa5f07e3cll, 0xaf7350ecll, 0x50ecaf73ll },
+ /* sources[1] with each of masks [0 .. 3] */
+ { 0xa5f07e3cll, 0x7e3ca5f0ll, 0x73afec50ll, 0xec5073afll },
+ /* sources[2] with each of masks [0 .. 3] */
+ { 0xf07e3ca5ll, 0x3ca5f07ell, 0x3af7c50ell, 0xc50e3af7ll },
+ /* sources[3] with each of masks [0 .. 3] */
+ { 0xe7c35a0fll, 0x5a0fe7c3ll, 0x50ecaf73ll, 0xaf7350ecll },
+ };
+
+ sources[0] = 0xa5f07e3cll;
+ sources[1] = 0x7e3ca5f0ll;
+ sources[2] = 0x3ca5f07ell;
+ sources[3] = 0x5a0fe7c3ll;
+
+ masks[0] = 0xffff0000ll;
+ masks[1] = 0x0000ffffll;
+ masks[2] = 0x0f0f0f0fll;
+ masks[3] = 0xf0f0f0f0ll;
+
+ unsigned long long int result;
+
+ for (int i = 0; i < 4; i++)
+ {
+ for (int j = 0; j < 4; j++)
+ {
+ if (do_cfuged (sources[i], masks[j]) != results [i][j])
+ abort ();
+ }
+ }
+
+ return 0;
+}