From fa7ccca021a5943040fd4d19d88e626a9736758e Mon Sep 17 00:00:00 2001 From: Renlin Li Date: Mon, 26 Jun 2017 13:28:32 +0000 Subject: [PATCH] [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 From-SVN: r249647 --- gcc/testsuite/ChangeLog | 7 +++++++ .../execute/builtins/memops-asm-lib.c | 18 ++++++++++++++++++ .../execute/builtins/memops-asm.c | 2 ++ 3 files changed, 27 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 406db5210bd..7fa3d957950 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-06-26 Renlin Li + Szabolcs Nagy + + * 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 PR target/81175 diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c index 00005298d10..25d4a40a67e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c @@ -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)) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c index ed2b06cf06f..44e336cce7c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c @@ -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) -- 2.30.2