summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.target/sh/sh4a-memmovua.c')
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-memmovua.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
new file mode 100644
index 000000000..359dd8feb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
@@ -0,0 +1,17 @@
+/* Verify that we generate movua to copy unaligned memory regions to
+ 32-bit-aligned addresses. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O" } */
+/* { dg-final { scan-assembler-times "\tmovua\\.l\t" 2 } } */
+
+#ifdef __SH4A__
+#include <string.h>
+
+struct s { int i; char a[10], b[10]; } x;
+int f() {
+ memcpy(x.a, x.b, 10);
+}
+#else
+asm ("movua.l\t+");
+asm ("movua.l\t+");
+#endif