mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
Use __inhibit_loop_to_libcall in all memset/memcpy implementations
This macro selects a compiler option that disables recognition of common memset/memcpy patterns and converting those to direct memset/memcpy calls. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
088a45cdf6
commit
82dfae9ab0
@ -31,6 +31,7 @@
|
||||
than what we describe. An assembly file should be used instead. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include "../../string/local.h"
|
||||
|
||||
/* Break even between movem and move16 is really at 38.7 * 2, but
|
||||
modulo 44, so up to the next multiple of 44, we use ordinary code. */
|
||||
@ -40,6 +41,7 @@
|
||||
__asm__ (".syntax no_register_prefix");
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy(void *__restrict pdst, const void *__restrict psrc, size_t pn)
|
||||
{
|
||||
/* Now we want the parameters put in special registers.
|
||||
|
@ -11,10 +11,12 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "../../string/local.h"
|
||||
|
||||
#define unlikely(X) __builtin_expect (!!(X), 0)
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy(void *__restrict aa, const void *__restrict bb, size_t n)
|
||||
{
|
||||
#define BODY(a, b, t) { \
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <spu_intrinsics.h>
|
||||
#include <stddef.h>
|
||||
#include <vec_literal.h>
|
||||
#include "../../string/local.h"
|
||||
|
||||
/* Copy n bytes from memory area src to memory area dest.
|
||||
* The memory areas may not overlap. The memcpy subroutine
|
||||
@ -42,7 +43,9 @@
|
||||
* either with prior knowledge of the alignment or special
|
||||
* casing specific optimal alignments.
|
||||
*/
|
||||
void * memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n)
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy(void * __restrict__ dest, const void * __restrict__ src, size_t n)
|
||||
{
|
||||
int adjust, delta;
|
||||
unsigned int soffset1, doffset1, doffset2;
|
||||
|
@ -34,10 +34,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "ea_internal.h"
|
||||
#include <ea.h>
|
||||
#include <spu_cache.h>
|
||||
#include "../../string/local.h"
|
||||
|
||||
COMPAT_EA_ALIAS (memcpy_ea);
|
||||
|
||||
__ea void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy_ea (__ea void *dest, __ea const void *src, size_ea_t n)
|
||||
{
|
||||
__ea void *curr_dest = dest;
|
||||
|
@ -34,10 +34,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <spu_cache.h>
|
||||
#include "ea_internal.h"
|
||||
#include <ea.h>
|
||||
#include "../../string/local.h"
|
||||
|
||||
COMPAT_EA_ALIAS (memset_ea);
|
||||
|
||||
__ea void *
|
||||
__inhibit_loop_to_libcall
|
||||
memset_ea (__ea void *dest, int c, size_ea_t n)
|
||||
{
|
||||
__ea void *curr_dest = dest;
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include "memcpy.h"
|
||||
#include "../../string/local.h"
|
||||
|
||||
#define INST_BARRIER __asm__ __volatile__ ("":::"memory");
|
||||
|
||||
@ -422,6 +423,7 @@ do { \
|
||||
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -562,6 +564,7 @@ __int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
}
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__shrt_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -703,6 +706,7 @@ __shrt_int_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__byte_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -846,6 +850,7 @@ __byte_memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
/* Exposed interface. */
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy (void *__restrict s1, const void *__restrict s2, size_t n)
|
||||
{
|
||||
void *result = s1;
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include "memset.h"
|
||||
#include "../../string/local.h"
|
||||
|
||||
#define SET_32_OBJECTS(out) \
|
||||
do { \
|
||||
@ -228,8 +229,8 @@ do { \
|
||||
out += 1; \
|
||||
} while(0)
|
||||
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__int_memset (void *__restrict s1, int val, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -369,6 +370,7 @@ __int_memset (void *__restrict s1, int val, size_t n)
|
||||
}
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__short_int_memset (void *__restrict s1, int val, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -508,6 +510,7 @@ __short_int_memset (void *__restrict s1, int val, size_t n)
|
||||
}
|
||||
|
||||
static inline void
|
||||
__inhibit_loop_to_libcall
|
||||
__byte_memset (void *__restrict s1, int val, size_t n)
|
||||
{
|
||||
int value = n;
|
||||
@ -650,6 +653,7 @@ __byte_memset (void *__restrict s1, int val, size_t n)
|
||||
/* Exposed interface. */
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memset (void *s, int c, size_t n)
|
||||
{
|
||||
void *result = s;
|
||||
|
@ -6,8 +6,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "xscale.h"
|
||||
#include "../../string/local.h"
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy (void *__restrict dst0, const void *__restrict src0, size_t len)
|
||||
{
|
||||
int dummy;
|
||||
|
@ -6,8 +6,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "xscale.h"
|
||||
#include "../../string/local.h"
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memset (void *dst, int c, size_t len)
|
||||
{
|
||||
int dummy;
|
||||
|
@ -29,6 +29,7 @@ QUICKREF
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <string.h>
|
||||
#include "local.h"
|
||||
|
||||
/* Nonzero if either X or Y is not aligned on a "long" boundary. */
|
||||
#define UNALIGNED(X, Y) \
|
||||
@ -44,6 +45,7 @@ QUICKREF
|
||||
#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE)
|
||||
|
||||
void *
|
||||
__inhibit_loop_to_libcall
|
||||
memcpy (void *__restrict dst0,
|
||||
const void *__restrict src0,
|
||||
size_t len0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user