Index: testsuite/gcc.target/arm/pr40457-1.c
===================================================================
--- testsuite/gcc.target/arm/pr40457-1.c	(revision 0)
+++ testsuite/gcc.target/arm/pr40457-1.c	(revision 0)
@@ -0,0 +1,10 @@
+/* { dg-options "-Os" }  */
+/* { dg-do compile } */
+
+int bar(int* p)
+{
+  int x = p[0] + p[1];
+  return x;
+}
+
+/* { dg-final { scan-assembler "ldm" } } */
Index: testsuite/gcc.target/arm/pr40457-2.c
===================================================================
--- testsuite/gcc.target/arm/pr40457-2.c	(revision 0)
+++ testsuite/gcc.target/arm/pr40457-2.c	(revision 0)
@@ -0,0 +1,10 @@
+/* { dg-options "-O2" }  */
+/* { dg-do compile } */
+
+void foo(int* p)
+{
+  p[0] = 1;
+  p[1] = 0;
+}
+
+/* { dg-final { scan-assembler "stm" } } */
