[gcc(refs/vendors/AWS/heads/Arm64/gcc-7-branch)] [AArch64] Don't split 64-bit constant stores to volatile location
Sebastian Pop
spop@gcc.gnu.org
Tue Oct 27 15:05:07 GMT 2020
https://gcc.gnu.org/g:aa09a1939811fdc4b0df5fc4c63eec7a4553dcbd
commit aa09a1939811fdc4b0df5fc4c63eec7a4553dcbd
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Tue Oct 1 10:37:55 2019 +0000
[AArch64] Don't split 64-bit constant stores to volatile location
2019-10-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Backport from mainline
2019-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.md (mov<mode>): Don't call
aarch64_split_dimode_const_store on volatile MEM.
* gcc.target/aarch64/nosplit-di-const-volatile_1.c: New test.
(cherry picked from commit 38bf71d294ea2a2fee6372e1d10f19a28197b7e3)
Diff:
---
gcc/config/aarch64/aarch64.md | 4 ++--
.../gcc.target/aarch64/nosplit-di-const-volatile_1.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 90f9ee658c5..3562010b3c4 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -1007,8 +1007,8 @@
(match_operand:GPI 1 "general_operand" ""))]
""
"
- if (MEM_P (operands[0]) && CONST_INT_P (operands[1])
- && <MODE>mode == DImode
+ if (MEM_P (operands[0]) && !MEM_VOLATILE_P (operands[0])
+ && CONST_INT_P (operands[1]) && <MODE>mode == DImode
&& aarch64_split_dimode_const_store (operands[0], operands[1]))
DONE;
diff --git a/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c b/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c
new file mode 100644
index 00000000000..da5975ad165
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/nosplit-di-const-volatile_1.c
@@ -0,0 +1,15 @@
+/* Check that storing the 64-bit immediate to a volatile location is done
+ with a single store. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef unsigned long long u64;
+
+void bar (u64 *x)
+{
+ *(volatile u64 *)x = 0xabcdef10abcdef10ULL;
+}
+
+/* { dg-final { scan-assembler-times "str\tx..?, .*" 1 } } */
+/* { dg-final { scan-assembler-not "str\tw..?, .*" } } */
More information about the Gcc-cvs
mailing list