[ARM] Fix test armv8_2-fp16-move-1.c
[official-gcc.git] / gcc / testsuite / gcc.target / arm / memset-inline-6.c
blobae226346d4890156ba81a916a99e6221562656f3
1 /* { dg-do run } */
2 /* { dg-skip-if "Don't inline memset using neon instructions" { ! arm_tune_string_ops_prefer_neon } } */
3 /* { dg-options "-save-temps -O2 -fno-inline" } */
4 /* { dg-add-options "arm_neon" } */
6 #include <string.h>
7 #include <stdlib.h>
9 #define LEN (100)
10 int a[LEN];
11 int b[LEN];
12 int c[LEN];
13 void
14 foo1 (void)
16 memset (a, -1, 20);
17 return;
20 void
21 foo2 (void)
23 memset (b, 1, 24);
24 return;
27 void
28 foo3 (void)
30 memset (c, -1, 32);
31 return;
34 void
35 check (signed char *arr, int idx, int len, int v)
37 int i;
38 for (i = 0; i < idx; i++)
39 if (arr[i] != v)
40 abort ();
42 for (i = idx; i < len; i++)
43 if (arr[i] != 0)
44 abort ();
47 int
48 main(void)
50 foo1 ();
51 check ((signed char *)a, 20, sizeof (a), -1);
53 foo2 ();
54 check ((signed char *)b, 24, sizeof (b), 1);
56 foo3 ();
57 check ((signed char *)c, 32, sizeof (c), -1);
59 return 0;
62 /* { dg-final { scan-assembler-not "bl?\[ \t\]+memset" { target { arm_little_endian && arm_neon } } } } */
63 /* { dg-final { scan-assembler-times "vst1" 3 { target { arm_little_endian && arm_neon } } } } */
64 /* { dg-final { scan-assembler-times "vstr" 4 { target { arm_little_endian && arm_neon } } } } */