[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
This commit is contained in:
Renlin Li 2017-06-26 13:28:32 +00:00 committed by Renlin Li
parent 5a5c2d16e7
commit fa7ccca021
3 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,10 @@
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>
PR target/81175

View file

@ -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
actually refers to this function. See PR47181. */
__attribute__ ((used))

View file

@ -12,6 +12,8 @@ extern void *memcpy (void *, const void *, size_t)
__asm (ASMNAME ("my_memcpy"));
extern void bcopy (const void *, void *, size_t)
__asm (ASMNAME ("my_bcopy"));
extern void *memmove (void *, const void *, size_t)
__asm (ASMNAME ("my_memmove"));
extern void *memset (void *, int, size_t)
__asm (ASMNAME ("my_memset"));
extern void bzero (void *, size_t)