public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8957] tree-optimization/113896 - testcase for fixed PR
@ 2024-02-13 12:42 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-02-13 12:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:4a1cd5560b9b545eb848eb1d1e06d345fb606f76
commit r14-8957-g4a1cd5560b9b545eb848eb1d1e06d345fb606f76
Author: Richard Biener <rguenther@suse.de>
Date: Tue Feb 13 13:39:29 2024 +0100
tree-optimization/113896 - testcase for fixed PR
The SLP permute optimization rewrite fixed this.
PR tree-optimization/113896
* g++.dg/torture/pr113896.C: New testcase.
Diff:
---
gcc/testsuite/g++.dg/torture/pr113896.C | 35 +++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/gcc/testsuite/g++.dg/torture/pr113896.C b/gcc/testsuite/g++.dg/torture/pr113896.C
new file mode 100644
index 000000000000..534c1c2e1cce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr113896.C
@@ -0,0 +1,35 @@
+// { dg-do run }
+// { dg-additional-options "-ffast-math" }
+
+double a1 = 1.0;
+double a2 = 1.0;
+
+void __attribute__((noipa))
+f(double K[2], bool b)
+{
+ double A[] = {
+ b ? a1 : a2,
+ 0,
+ 0,
+ 0
+ };
+
+ double sum{};
+ for(double a : A) sum += a;
+ for(double& a : A) a /= sum;
+
+ if (b) {
+ K[0] = A[0]; // 1.0
+ K[1] = A[1]; // 0.0
+ } else {
+ K[0] = A[0] + A[1];
+ }
+}
+
+int main()
+{
+ double K[2]{};
+ f(K, true);
+ if (K[0] != 1. || K[1] != 0.)
+ __builtin_abort ();
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-13 12:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 12:42 [gcc r14-8957] tree-optimization/113896 - testcase for fixed PR Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).