aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2019-08-24 00:19:40 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2019-08-24 00:19:40 +0200
commit457dac402027dd7e14543fbd59a75858422cf6c6 (patch)
tree47934832a3d5d2b5782465f4f5c1af80d9099a39
parent5857042a2b3dd635fc6cae214abd60d3a8336060 (diff)
downloadgcc-457dac402027dd7e14543fbd59a75858422cf6c6.zip
gcc-457dac402027dd7e14543fbd59a75858422cf6c6.tar.gz
gcc-457dac402027dd7e14543fbd59a75858422cf6c6.tar.bz2
rs6000: New darn testcase (PR91481)
We used to implement darn with unspecs, not unspec_volatiles, which means two darn instructions could be CSEd together. This testcase tests it by adding together four random numbers. If all is well that means we get four darn instructions, because such a small loop is unrolled fine at -O2 already. If things go bad, combine will combine it all to one darn and a shift left by two. gcc/testsuite/ PR target/91481 * gcc.target/powerpc/darn-3.c: New testcase. From-SVN: r274889
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/darn-3.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e90713..f657cfa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-23 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR target/91481
+ * gcc.target/powerpc/darn-3.c: New testcase.
+
2019-08-23 Marek Polacek <polacek@redhat.com>
PR c++/79817 - attribute deprecated on namespace.
diff --git a/gcc/testsuite/gcc.target/powerpc/darn-3.c b/gcc/testsuite/gcc.target/powerpc/darn-3.c
new file mode 100644
index 0000000..477901f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/darn-3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-aix* } } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+
+static int darn32(void) { return __builtin_darn_32(); }
+
+int four(void)
+{
+ int sum = 0;
+ int i;
+ for (i = 0; i < 4; i++)
+ sum += darn32();
+ return sum;
+}
+
+/* { dg-final { scan-assembler-times {(?n)\mdarn .*,0\M} 4 } } */