aarch64: fix strict alignment for vector load/stores (PR 91927)
authorAndrew Pinski <apinski@marvell.com>
Sat, 8 Feb 2020 15:57:54 +0000 (15:57 +0000)
committerAndrew Pinski <apinski@marvell.com>
Sat, 8 Feb 2020 23:48:06 +0000 (15:48 -0800)
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/ChangeLog
gcc/config/aarch64/aarch64-simd.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr91927.c [new file with mode: 0644]

index 0ae8c5442a0bfba4f5da79ee8f4a83d7f7a6a1a1..b46ea4fe14905dd4282875e8e883f39460a8343e 100644 (file)
@@ -1,3 +1,9 @@
+2020-02-08  Andrew Pinski  <apinski@marvell.com>
+
+       PR target/91927
+       * config/aarch64/aarch64-simd.md (movmisalign<mode>): Check
+       STRICT_ALIGNMENT also.
+
 2020-02-08  Jim Wilson  <jimw@sifive.com>
 
        PR target/93532
index c8e1012bd7f7776bc44179d8ff6030a4e305846b..4c651f45d0c116207634770b551ddaa718f3eda7 100644 (file)
@@ -41,7 +41,7 @@
 (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
index b9548b34f01d78849848b8ff467c990dace07ed9..c47f3fb98dd80e29fd88a48609dfd2b1a0a4f52e 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-08  Andrew Pinski  <apinski@marvel.com>
+
+       PR target/91927
+       * gcc.target/aarch64/pr91927.c: New testcase.
+
 2020-02-08  Peter Bergner <bergner@linux.ibm.com>
 
        PR target/93136
diff --git a/gcc/testsuite/gcc.target/aarch64/pr91927.c b/gcc/testsuite/gcc.target/aarch64/pr91927.c
new file mode 100644 (file)
index 0000000..f5cde1a
--- /dev/null
@@ -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" } } */