aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2024-01-18 17:53:01 +0000
committerAlex Coplan <alex.coplan@arm.com>2024-01-23 10:57:33 +0000
commit20e18106fac2d11ee43683291ff11d76da41d50b (patch)
tree674ad2da10260e8cf42f9b6db89cdad8fbcf9623 /gcc/testsuite/gcc.c-torture
parentbd1703b79c14331ce4d894ac0432db5e098b6244 (diff)
downloadgcc-20e18106fac2d11ee43683291ff11d76da41d50b.zip
gcc-20e18106fac2d11ee43683291ff11d76da41d50b.tar.gz
gcc-20e18106fac2d11ee43683291ff11d76da41d50b.tar.bz2
aarch64: Don't assert recog success in ldp/stp pass [PR113114]
The PR shows two different cases where try_promote_writeback produces an RTL pattern which isn't recognized. Currently this leads to an ICE, as we assert recog success, but I think it's better just to back out of the changes gracefully if recog fails (as we do in the main fuse_pair case). In theory since we check the ranges here recog shouldn't fail (which is why I had the assert in the first place), but the PR shows an edge case in the patterns where if we form a pre-writeback pair where the writeback offset is exactly -S, where S is the size in bytes of one transfer register, we fail to match the expected pattern as the patterns look explicitly for plus operands in the mems. I think fixing this would require adding at least four new special-case patterns to aarch64.md for what doesn't seem to be a particularly useful variant of the insns. Even if we were to do that, I think it would be GCC 15 material, and it's better to just punt for GCC 14. The ILP32 case in the PR is a bit different, as that shows us trying to combine a pair with DImode base register operands in the mems together with an SImode trailing update of the base register. This leads to us forming an RTL pattern which references the base register in both SImode and DImode, which also fails to recog. Again, I think it's best just to take the missed optimization for now. If we really want to make this (try_promote_writeback) work for ILP32, we can try to do it for GCC 15. gcc/ChangeLog: PR target/113114 * config/aarch64/aarch64-ldp-fusion.cc (try_promote_writeback): Don't assert recog success, just punt if the writeback pair isn't recognized. gcc/testsuite/ChangeLog: PR target/113114 * gcc.c-torture/compile/pr113114.c: New test. * gcc.target/aarch64/pr113114.c: New test.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr113114.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr113114.c b/gcc/testsuite/gcc.c-torture/compile/pr113114.c
new file mode 100644
index 0000000..978e594
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr113114.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-funroll-loops" } */
+float val[128];
+float x;
+void bar() {
+ int i = 55;
+ for (; i >= 0; --i)
+ x += val[i];
+}