1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
10 __attribute__((noinline
))
11 my_memcpy (char *d
, char *s
, unsigned l
)
13 return __builtin_memcpy (d
, s
, l
);
17 __attribute__((noinline
))
18 my_mempcpy (char *d
, char *s
, unsigned l
)
20 return __builtin_mempcpy (d
, s
, l
);
24 run_test (char *d
, char *s
, unsigned l
)
26 char *r
= my_mempcpy (d
, s
, l
);
30 r
= my_memcpy (d
, s
, l
);
38 const char* const foo
= "hello world";
39 unsigned l
= __builtin_strlen (foo
) + 1;
41 buffer
= __builtin_malloc (SIZE
);
42 __builtin_memcpy (buffer
, foo
, l
);
43 test
= __builtin_malloc (SIZE
);
45 run_test (test
, buffer
, l
);
50 /* { dg-final { scan-assembler "mempcpy" } } */
51 /* { dg-final { scan-assembler "memcpy" } } */