Commit fa7ccca0 by Renlin Li Committed by Renlin Li

[PATCH][Testsuite]Use user defined memmove in gcc.c-torture/execute/builtins/memops-asm-lib.c

After the change r249278. bcopy is folded into memmove. And in newlib
aarch64 memmove implementation, it will call memcpy in certain conditions.
The memcpy defined in memops-asm-lib.c will abort when the test is running.

A user defined memmove function is defined to bypass the library one.
So that memcpy won't be called accidentally.

gcc/testsuite/

	* gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memmove): New.
	* gcc.c-torture/execute/builtins/memops-asm.c (memmove): Declare memmove.


Co-Authored-By: Szabolcs Nagy <szabolcs.nagy@arm.com>

From-SVN: r249647
parent 5a5c2d16
2017-06-26 Renlin Li <renlin.li@arm.com>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memmove): New.
* gcc.c-torture/execute/builtins/memops-asm.c (memmove): Declare
memmove.
2017-06-26 Richard Biener <rguenther@suse.de> 2017-06-26 Richard Biener <rguenther@suse.de>
PR target/81175 PR target/81175
......
...@@ -37,6 +37,24 @@ my_bcopy (const void *s, void *d, size_t n) ...@@ -37,6 +37,24 @@ my_bcopy (const void *s, void *d, size_t n)
} }
} }
__attribute__ ((used))
void
my_memmove (void *d, const void *s, size_t n)
{
char *dst = (char *) d;
const char *src = (const char *) s;
if (src >= dst)
while (n--)
*dst++ = *src++;
else
{
dst += n;
src += n;
while (n--)
*--dst = *--src;
}
}
/* LTO code is at the present to able to track that asm alias my_bcopy on builtin /* LTO code is at the present to able to track that asm alias my_bcopy on builtin
actually refers to this function. See PR47181. */ actually refers to this function. See PR47181. */
__attribute__ ((used)) __attribute__ ((used))
......
...@@ -12,6 +12,8 @@ extern void *memcpy (void *, const void *, size_t) ...@@ -12,6 +12,8 @@ extern void *memcpy (void *, const void *, size_t)
__asm (ASMNAME ("my_memcpy")); __asm (ASMNAME ("my_memcpy"));
extern void bcopy (const void *, void *, size_t) extern void bcopy (const void *, void *, size_t)
__asm (ASMNAME ("my_bcopy")); __asm (ASMNAME ("my_bcopy"));
extern void *memmove (void *, const void *, size_t)
__asm (ASMNAME ("my_memmove"));
extern void *memset (void *, int, size_t) extern void *memset (void *, int, size_t)
__asm (ASMNAME ("my_memset")); __asm (ASMNAME ("my_memset"));
extern void bzero (void *, size_t) extern void bzero (void *, size_t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment