summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog13
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-1.c39
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-2.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-3.c40
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-4.c68
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-5.c78
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-6.c68
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-7.c171
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-8.c44
-rw-r--r--gcc/testsuite/gcc.target/arm/memset-inline-9.c42
10 files changed, 601 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ae3445a7781..b7dd1c2fb45 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,16 @@
+2014-07-21 Bin Cheng <bin.cheng@arm.com>
+
+ PR target/55701
+ * gcc.target/arm/memset-inline-1.c: New test.
+ * gcc.target/arm/memset-inline-2.c: New test.
+ * gcc.target/arm/memset-inline-3.c: New test.
+ * gcc.target/arm/memset-inline-4.c: New test.
+ * gcc.target/arm/memset-inline-5.c: New test.
+ * gcc.target/arm/memset-inline-6.c: New test.
+ * gcc.target/arm/memset-inline-7.c: New test.
+ * gcc.target/arm/memset-inline-8.c: New test.
+ * gcc.target/arm/memset-inline-9.c: New test.
+
2014-07-21 Tom de Vries <tom@codesourcery.com>
PR target/61827
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-1.c b/gcc/testsuite/gcc.target/arm/memset-inline-1.c
new file mode 100644
index 00000000000..ff137b33425
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-1.c
@@ -0,0 +1,39 @@
+/* { dg-do run } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+void
+foo (void)
+{
+ memset (a, -1, 14);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo ();
+ check ((signed char *)a, 14, sizeof (a), -1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]*memset" { target { ! arm_thumb1_ok } } } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-2.c b/gcc/testsuite/gcc.target/arm/memset-inline-2.c
new file mode 100644
index 00000000000..6deaffe232d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-2.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-save-temps -Os -fno-inline" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+void
+foo (void)
+{
+ memset (a, -1, 14);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo ();
+ check ((signed char *)a, 14, sizeof (a), -1);
+
+ return 0;
+}
+/* { dg-final { scan-assembler "bl?\[ \t\]*memset" { target { ! arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-3.c b/gcc/testsuite/gcc.target/arm/memset-inline-3.c
new file mode 100644
index 00000000000..77763952067
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-3.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+void
+foo (void)
+{
+ memset (a, -1, 7);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo ();
+ check ((signed char *)a, 7, sizeof (a), -1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]*memset" { target { ! arm_thumb1_ok } } } } */
+/* { dg-final { scan-assembler-not "strh" { target { ! arm_thumb1 } } } } */
+/* { dg-final { scan-assembler-not "strb" { target { ! arm_thumb1 } } } } */
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-4.c b/gcc/testsuite/gcc.target/arm/memset-inline-4.c
new file mode 100644
index 00000000000..381a2c2099b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-4.c
@@ -0,0 +1,68 @@
+/* { dg-do run } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mcpu=cortex-a9" } { "" } } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mtune=cortex-a9" } { "" } } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+/* { dg-add-options "arm_neon" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+int a[LEN];
+int b[LEN];
+int c[LEN];
+void
+foo1 (void)
+{
+ memset (a, -1, 8);
+ return;
+}
+
+void
+foo2 (void)
+{
+ memset (b, 1, 12);
+ return;
+}
+
+void
+foo3 (void)
+{
+ memset (c, 1, 13);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ int i;
+
+ foo1 ();
+ check ((signed char *)a, 8, sizeof (a), -1);
+
+ foo2 ();
+ check ((signed char *)b, 12, sizeof (b), 1);
+
+ foo3 ();
+ check ((signed char *)c, 13, sizeof (c), 1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]+memset" { target { ! arm_thumb1_ok } } } } */
+/* { dg-final { scan-assembler-times "vst1\.8" 1 { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler "vstr" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-5.c b/gcc/testsuite/gcc.target/arm/memset-inline-5.c
new file mode 100644
index 00000000000..9107d811a94
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-5.c
@@ -0,0 +1,78 @@
+/* { dg-do run } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mcpu=cortex-a9" } { "" } } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mtune=cortex-a9" } { "" } } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+/* { dg-add-options "arm_neon" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+int a[LEN];
+int b[LEN];
+int c[LEN];
+int d[LEN];
+void
+foo1 (void)
+{
+ memset (a, -1, 16);
+ return;
+}
+
+void
+foo2 (void)
+{
+ memset (b, 1, 25);
+ return;
+}
+
+void
+foo3 (void)
+{
+ memset (c, -1, 19);
+ return;
+}
+
+void
+foo4 (void)
+{
+ memset (d, 1, 23);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo1 ();
+ check ((signed char *)a, 16, sizeof (a), -1);
+
+ foo2 ();
+ check ((signed char *)b, 25, sizeof (b), 1);
+
+ foo3 ();
+ check ((signed char *)c, 19, sizeof (c), -1);
+
+ foo4 ();
+ check ((signed char *)d, 23, sizeof (d), 1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]+memset" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler "vst1" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler-not "vstr" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-6.c b/gcc/testsuite/gcc.target/arm/memset-inline-6.c
new file mode 100644
index 00000000000..fcb2e26a95d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-6.c
@@ -0,0 +1,68 @@
+/* { dg-do run } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mcpu=cortex-a9" } { "" } } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mtune=cortex-a9" } { "" } } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+/* { dg-add-options "arm_neon" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+int a[LEN];
+int b[LEN];
+int c[LEN];
+void
+foo1 (void)
+{
+ memset (a, -1, 20);
+ return;
+}
+
+void
+foo2 (void)
+{
+ memset (b, 1, 24);
+ return;
+}
+
+void
+foo3 (void)
+{
+ memset (c, -1, 32);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo1 ();
+ check ((signed char *)a, 20, sizeof (a), -1);
+
+ foo2 ();
+ check ((signed char *)b, 24, sizeof (b), 1);
+
+ foo3 ();
+ check ((signed char *)c, 32, sizeof (c), -1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]+memset" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler-times "vst1" 3 { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler-times "vstr" 4 { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */
+
+
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-7.c b/gcc/testsuite/gcc.target/arm/memset-inline-7.c
new file mode 100644
index 00000000000..7326c5f857c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-7.c
@@ -0,0 +1,171 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+int b[LEN];
+
+void
+init (signed char *arr, int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ arr[i] = 0;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+#define TEST(a,l,v) \
+ init ((signed char*)(a), sizeof (a)); \
+ memset ((a), (v), (l)); \
+ check ((signed char *)(a), (l), sizeof (a), (v));
+int
+main(void)
+{
+ TEST (a, 1, -1);
+ TEST (a, 2, -1);
+ TEST (a, 3, -1);
+ TEST (a, 4, -1);
+ TEST (a, 5, -1);
+ TEST (a, 6, -1);
+ TEST (a, 7, -1);
+ TEST (a, 8, -1);
+ TEST (a, 9, 1);
+ TEST (a, 10, -1);
+ TEST (a, 11, 1);
+ TEST (a, 12, -1);
+ TEST (a, 13, 1);
+ TEST (a, 14, -1);
+ TEST (a, 15, 1);
+ TEST (a, 16, -1);
+ TEST (a, 17, 1);
+ TEST (a, 18, -1);
+ TEST (a, 19, 1);
+ TEST (a, 20, -1);
+ TEST (a, 21, 1);
+ TEST (a, 22, -1);
+ TEST (a, 23, 1);
+ TEST (a, 24, -1);
+ TEST (a, 25, 1);
+ TEST (a, 26, -1);
+ TEST (a, 27, 1);
+ TEST (a, 28, -1);
+ TEST (a, 29, 1);
+ TEST (a, 30, -1);
+ TEST (a, 31, 1);
+ TEST (a, 32, -1);
+ TEST (a, 33, 1);
+ TEST (a, 34, -1);
+ TEST (a, 35, 1);
+ TEST (a, 36, -1);
+ TEST (a, 37, 1);
+ TEST (a, 38, -1);
+ TEST (a, 39, 1);
+ TEST (a, 40, -1);
+ TEST (a, 41, 1);
+ TEST (a, 42, -1);
+ TEST (a, 43, 1);
+ TEST (a, 44, -1);
+ TEST (a, 45, 1);
+ TEST (a, 46, -1);
+ TEST (a, 47, 1);
+ TEST (a, 48, -1);
+ TEST (a, 49, 1);
+ TEST (a, 50, -1);
+ TEST (a, 51, 1);
+ TEST (a, 52, -1);
+ TEST (a, 53, 1);
+ TEST (a, 54, -1);
+ TEST (a, 55, 1);
+ TEST (a, 56, -1);
+ TEST (a, 57, 1);
+ TEST (a, 58, -1);
+ TEST (a, 59, 1);
+ TEST (a, 60, -1);
+ TEST (a, 61, 1);
+ TEST (a, 62, -1);
+ TEST (a, 63, 1);
+ TEST (a, 64, -1);
+
+ TEST (b, 1, -1);
+ TEST (b, 2, -1);
+ TEST (b, 3, -1);
+ TEST (b, 4, -1);
+ TEST (b, 5, -1);
+ TEST (b, 6, -1);
+ TEST (b, 7, -1);
+ TEST (b, 8, -1);
+ TEST (b, 9, 1);
+ TEST (b, 10, -1);
+ TEST (b, 11, 1);
+ TEST (b, 12, -1);
+ TEST (b, 13, 1);
+ TEST (b, 14, -1);
+ TEST (b, 15, 1);
+ TEST (b, 16, -1);
+ TEST (b, 17, 1);
+ TEST (b, 18, -1);
+ TEST (b, 19, 1);
+ TEST (b, 20, -1);
+ TEST (b, 21, 1);
+ TEST (b, 22, -1);
+ TEST (b, 23, 1);
+ TEST (b, 24, -1);
+ TEST (b, 25, 1);
+ TEST (b, 26, -1);
+ TEST (b, 27, 1);
+ TEST (b, 28, -1);
+ TEST (b, 29, 1);
+ TEST (b, 30, -1);
+ TEST (b, 31, 1);
+ TEST (b, 32, -1);
+ TEST (b, 33, 1);
+ TEST (b, 34, -1);
+ TEST (b, 35, 1);
+ TEST (b, 36, -1);
+ TEST (b, 37, 1);
+ TEST (b, 38, -1);
+ TEST (b, 39, 1);
+ TEST (b, 40, -1);
+ TEST (b, 41, 1);
+ TEST (b, 42, -1);
+ TEST (b, 43, 1);
+ TEST (b, 44, -1);
+ TEST (b, 45, 1);
+ TEST (b, 46, -1);
+ TEST (b, 47, 1);
+ TEST (b, 48, -1);
+ TEST (b, 49, 1);
+ TEST (b, 50, -1);
+ TEST (b, 51, 1);
+ TEST (b, 52, -1);
+ TEST (b, 53, 1);
+ TEST (b, 54, -1);
+ TEST (b, 55, 1);
+ TEST (b, 56, -1);
+ TEST (b, 57, 1);
+ TEST (b, 58, -1);
+ TEST (b, 59, 1);
+ TEST (b, 60, -1);
+ TEST (b, 61, 1);
+ TEST (b, 62, -1);
+ TEST (b, 63, 1);
+ TEST (b, 64, -1);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-8.c b/gcc/testsuite/gcc.target/arm/memset-inline-8.c
new file mode 100644
index 00000000000..96c4d798e5b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-8.c
@@ -0,0 +1,44 @@
+/* { dg-do run } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mcpu=cortex-a9" } { "" } } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mtune=cortex-a9" } { "" } } */
+/* { dg-options "-save-temps -O2 -fno-inline" } */
+/* { dg-add-options "arm_neon" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+void
+foo (void)
+{
+ memset (a, -1, 14);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo ();
+ check ((signed char *)a, 14, sizeof (a), -1);
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "bl?\[ \t\]*memset" { target { ! arm_thumb1_ok } } } } */
+/* { dg-final { scan-assembler "vst1" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler-not "vstr" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */
diff --git a/gcc/testsuite/gcc.target/arm/memset-inline-9.c b/gcc/testsuite/gcc.target/arm/memset-inline-9.c
new file mode 100644
index 00000000000..be9323aae51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/memset-inline-9.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mcpu=cortex-a9" } { "" } } */
+/* { dg-skip-if "Don't inline memset using neon instructions on cortex-a9" { *-*-* } { "-mtune=cortex-a9" } { "" } } */
+/* { dg-options "-save-temps -Os -fno-inline" } */
+/* { dg-add-options "arm_neon" } */
+
+#include <string.h>
+#include <stdlib.h>
+
+#define LEN (100)
+short a[LEN];
+void
+foo (void)
+{
+ memset (a, -1, 14);
+ return;
+}
+
+void
+check (signed char *arr, int idx, int len, int v)
+{
+ int i;
+ for (i = 0; i < idx; i++)
+ if (arr[i] != v)
+ abort ();
+
+ for (i = idx; i < len; i++)
+ if (arr[i] != 0)
+ abort ();
+}
+
+int
+main(void)
+{
+ foo ();
+ check ((signed char *)a, 14, sizeof (a), -1);
+
+ return 0;
+}
+/* { dg-final { scan-assembler-not "bl?\[ \t\]*memset" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { scan-assembler "vst1" { target { arm_little_endian && arm_neon } } } } */
+/* { dg-final { cleanup-saved-temps } } */