diff mbox series

[COMMITTED] aarch64: fix strict alignment for vector load/stores (PR 91927)

Message ID 1581205226-22513-1-git-send-email-apinski@marvell.com
State New
Headers show
Series [COMMITTED] aarch64: fix strict alignment for vector load/stores (PR 91927) | expand

Commit Message

Andrew Pinski Feb. 8, 2020, 11:40 p.m. UTC
From: Andrew Pinski <apinski@marvell.com>

Hi,
  The problem here is that the vector mode version of movmisalign<mode>
was only conditionalized on if SIMD was enabled instead of being
also conditionalized on STRICT_ALIGNMENT too.

Applied as pre-approved in the bug report by Richard Sandiford
after a bootstrap/test on aarch64-linux-gnu.

Thanks,
Andrew Pinski

ChangeLog:
PR target/91927
* config/aarch64/aarch64-simd.md (movmisalign<mode>): Check
STRICT_ALIGNMENT also.

testsuite/ChangeLog:
PR target/91927
* gcc.target/aarch64/pr91927.c: New testcase.
---
 gcc/config/aarch64/aarch64-simd.md         |  2 +-
 gcc/testsuite/gcc.target/aarch64/pr91927.c | 38 ++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr91927.c
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index c8e1012bd7f..4c651f45d0c 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -41,7 +41,7 @@  (define_expand "mov<mode>"
 (define_expand "movmisalign<mode>"
   [(set (match_operand:VALL 0 "nonimmediate_operand")
         (match_operand:VALL 1 "general_operand"))]
-  "TARGET_SIMD"
+  "TARGET_SIMD && !STRICT_ALIGNMENT"
 {
   /* This pattern is not permitted to fail during expansion: if both arguments
      are non-registers (e.g. memory := constant, which can be created by the
diff --git a/gcc/testsuite/gcc.target/aarch64/pr91927.c b/gcc/testsuite/gcc.target/aarch64/pr91927.c
new file mode 100644
index 00000000000..f5cde1a5336
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr91927.c
@@ -0,0 +1,38 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mstrict-align -O3" } */
+
+#define NULL 0
+
+typedef unsigned uint32_t;
+typedef struct __attribute__((__packed__))
+{
+	uint32_t nTagID;
+	uint32_t nValueBufferSize;
+	uint32_t nValueLength;
+	
+}	PropertyTags_t;
+
+typedef struct
+{
+	char *szName;
+	uint32_t nBufferSize;
+	uint32_t nLength;
+	
+}	Something_t;
+
+void SetTag(PropertyTags_t *pTag, uint32_t nBufferSize, uint32_t nLength);
+
+void TestCase(Something_t *pSome, uint32_t nBufferSize, uint32_t nLength)
+{
+	if (pSome != NULL)
+	{
+		PropertyTags_t sTag = { 0 };
+		
+		SetTag(&sTag, nBufferSize, nLength);
+		
+		pSome->nBufferSize = sTag.nValueBufferSize;
+		pSome->nLength = sTag.nValueLength;
+	}
+}
+
+/* { dg-final { scan-assembler-not "ldr\td" } } */