This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 5/5] ARC: Add assembly string routines


newlib/ChangeLog:
2015-10-30  Anton Kolesov  <Anton.Kolesov@synopsys.com>

	* libc/machine/arc/Makefile.am: Add assembly string routines.
	* libc/machine/arc/Makefile.in: Regenerate.
	* libc/machine/arc/strchr-bs-norm.S: Add assembly string routines.
	* libc/machine/arc/strchr-bs.S: Likewise.
	* libc/machine/arc/strchr-stub.c: Likewise.
	* libc/machine/arc/strchr.S: Likewise.
	* libc/machine/arc/strcmp-archs.S: Likewise.
	* libc/machine/arc/strcmp-stub.c: Likewise.
	* libc/machine/arc/strcmp.S: Likewise.
	* libc/machine/arc/strcpy-bs-arc600.S: Likewise.
	* libc/machine/arc/strcpy-bs.S: Likewise.
	* libc/machine/arc/strcpy-stub.c: Likewise.
	* libc/machine/arc/strcpy.S: Likewise.
	* libc/machine/arc/strlen-bs-norm.S: Likewise.
	* libc/machine/arc/strlen-bs.S: Likewise.
	* libc/machine/arc/strlen-stub.c: Likewise.
	* libc/machine/arc/strlen.S: Likewise.
	* libc/machine/arc/strncpy-bs.S: Likewise.
	* libc/machine/arc/strncpy-stub.c: Likewise.
	* libc/machine/arc/strncpy.S: Likewise.

---
 newlib/libc/machine/arc/Makefile.am        |  20 ++-
 newlib/libc/machine/arc/Makefile.in        | 139 ++++++++++++++++++-
 newlib/libc/machine/arc/strchr-bs-norm.S   | 165 +++++++++++++++++++++++
 newlib/libc/machine/arc/strchr-bs.S        | 200 +++++++++++++++++++++++++++
 newlib/libc/machine/arc/strchr-stub.c      |  36 +++++
 newlib/libc/machine/arc/strchr.S           | 208 +++++++++++++++++++++++++++++
 newlib/libc/machine/arc/strcmp-archs.S     | 109 +++++++++++++++
 newlib/libc/machine/arc/strcmp-stub.c      |  36 +++++
 newlib/libc/machine/arc/strcmp.S           | 133 ++++++++++++++++++
 newlib/libc/machine/arc/strcpy-bs-arc600.S | 120 +++++++++++++++++
 newlib/libc/machine/arc/strcpy-bs.S        | 103 ++++++++++++++
 newlib/libc/machine/arc/strcpy-stub.c      |  36 +++++
 newlib/libc/machine/arc/strcpy.S           |  90 +++++++++++++
 newlib/libc/machine/arc/strlen-bs-norm.S   | 115 ++++++++++++++++
 newlib/libc/machine/arc/strlen-bs.S        | 122 +++++++++++++++++
 newlib/libc/machine/arc/strlen-stub.c      |  36 +++++
 newlib/libc/machine/arc/strlen.S           | 165 +++++++++++++++++++++++
 newlib/libc/machine/arc/strncpy-bs.S       | 171 ++++++++++++++++++++++++
 newlib/libc/machine/arc/strncpy-stub.c     |  36 +++++
 newlib/libc/machine/arc/strncpy.S          | 134 +++++++++++++++++++
 20 files changed, 2171 insertions(+), 3 deletions(-)
 create mode 100644 newlib/libc/machine/arc/strchr-bs-norm.S
 create mode 100644 newlib/libc/machine/arc/strchr-bs.S
 create mode 100644 newlib/libc/machine/arc/strchr-stub.c
 create mode 100644 newlib/libc/machine/arc/strchr.S
 create mode 100644 newlib/libc/machine/arc/strcmp-archs.S
 create mode 100644 newlib/libc/machine/arc/strcmp-stub.c
 create mode 100644 newlib/libc/machine/arc/strcmp.S
 create mode 100644 newlib/libc/machine/arc/strcpy-bs-arc600.S
 create mode 100644 newlib/libc/machine/arc/strcpy-bs.S
 create mode 100644 newlib/libc/machine/arc/strcpy-stub.c
 create mode 100644 newlib/libc/machine/arc/strcpy.S
 create mode 100644 newlib/libc/machine/arc/strlen-bs-norm.S
 create mode 100644 newlib/libc/machine/arc/strlen-bs.S
 create mode 100644 newlib/libc/machine/arc/strlen-stub.c
 create mode 100644 newlib/libc/machine/arc/strlen.S
 create mode 100644 newlib/libc/machine/arc/strncpy-bs.S
 create mode 100644 newlib/libc/machine/arc/strncpy-stub.c
 create mode 100644 newlib/libc/machine/arc/strncpy.S

diff --git a/newlib/libc/machine/arc/Makefile.am b/newlib/libc/machine/arc/Makefile.am
index 1fc428b..8dee84b 100644
--- a/newlib/libc/machine/arc/Makefile.am
+++ b/newlib/libc/machine/arc/Makefile.am
@@ -18,7 +18,25 @@ lib_a_SOURCES =			\
 	memset-archs.S		\
 	memset-bs.S		\
 	memset-stub.c		\
-	setjmp.S
+	setjmp.S		\
+	strchr.S		\
+	strchr-bs.S		\
+	strchr-bs-norm.S	\
+	strchr-stub.c		\
+	strcmp.S		\
+	strcmp-archs.S		\
+	strcmp-stub.c		\
+	strcpy.S		\
+	strcpy-bs.S		\
+	strcpy-bs-arc600.S	\
+	strcpy-stub.c		\
+	strlen.S		\
+	strlen-bs.S		\
+	strlen-bs-norm.S	\
+	strlen-stub.c		\
+	strncpy.S		\
+	strncpy-stub.c		\
+	strncpy-bs.S
 
 lib_a_CCASFLAGS=$(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
diff --git a/newlib/libc/machine/arc/Makefile.in b/newlib/libc/machine/arc/Makefile.in
index a887463..5a3b761 100644
--- a/newlib/libc/machine/arc/Makefile.in
+++ b/newlib/libc/machine/arc/Makefile.in
@@ -58,7 +58,16 @@ am_lib_a_OBJECTS = lib_a-memcmp.$(OBJEXT) \
 	lib_a-memcpy-bs.$(OBJEXT) lib_a-memcpy-stub.$(OBJEXT) \
 	lib_a-memset.$(OBJEXT) lib_a-memset-archs.$(OBJEXT) \
 	lib_a-memset-bs.$(OBJEXT) lib_a-memset-stub.$(OBJEXT) \
-	lib_a-setjmp.$(OBJEXT)
+	lib_a-setjmp.$(OBJEXT) lib_a-strchr.$(OBJEXT) \
+	lib_a-strchr-bs.$(OBJEXT) lib_a-strchr-bs-norm.$(OBJEXT) \
+	lib_a-strchr-stub.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \
+	lib_a-strcmp-archs.$(OBJEXT) lib_a-strcmp-stub.$(OBJEXT) \
+	lib_a-strcpy.$(OBJEXT) lib_a-strcpy-bs.$(OBJEXT) \
+	lib_a-strcpy-bs-arc600.$(OBJEXT) lib_a-strcpy-stub.$(OBJEXT) \
+	lib_a-strlen.$(OBJEXT) lib_a-strlen-bs.$(OBJEXT) \
+	lib_a-strlen-bs-norm.$(OBJEXT) lib_a-strlen-stub.$(OBJEXT) \
+	lib_a-strncpy.$(OBJEXT) lib_a-strncpy-stub.$(OBJEXT) \
+	lib_a-strncpy-bs.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
@@ -190,7 +199,25 @@ lib_a_SOURCES = \
 	memset-archs.S		\
 	memset-bs.S		\
 	memset-stub.c		\
-	setjmp.S
+	setjmp.S		\
+	strchr.S		\
+	strchr-bs.S		\
+	strchr-bs-norm.S	\
+	strchr-stub.c		\
+	strcmp.S		\
+	strcmp-archs.S		\
+	strcmp-stub.c		\
+	strcpy.S		\
+	strcpy-bs.S		\
+	strcpy-bs-arc600.S	\
+	strcpy-stub.c		\
+	strlen.S		\
+	strlen-bs.S		\
+	strlen-bs-norm.S	\
+	strlen-stub.c		\
+	strncpy.S		\
+	strncpy-stub.c		\
+	strncpy-bs.S
 
 lib_a_CCASFLAGS = $(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
@@ -308,6 +335,84 @@ lib_a-setjmp.o: setjmp.S
 lib_a-setjmp.obj: setjmp.S
 	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.obj `if test -f 'setjmp.S'; then $(CYGPATH_W) 'setjmp.S'; else $(CYGPATH_W) '$(srcdir)/setjmp.S'; fi`
 
+lib_a-strchr.o: strchr.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr.o `test -f 'strchr.S' || echo '$(srcdir)/'`strchr.S
+
+lib_a-strchr.obj: strchr.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr.obj `if test -f 'strchr.S'; then $(CYGPATH_W) 'strchr.S'; else $(CYGPATH_W) '$(srcdir)/strchr.S'; fi`
+
+lib_a-strchr-bs.o: strchr-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr-bs.o `test -f 'strchr-bs.S' || echo '$(srcdir)/'`strchr-bs.S
+
+lib_a-strchr-bs.obj: strchr-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr-bs.obj `if test -f 'strchr-bs.S'; then $(CYGPATH_W) 'strchr-bs.S'; else $(CYGPATH_W) '$(srcdir)/strchr-bs.S'; fi`
+
+lib_a-strchr-bs-norm.o: strchr-bs-norm.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr-bs-norm.o `test -f 'strchr-bs-norm.S' || echo '$(srcdir)/'`strchr-bs-norm.S
+
+lib_a-strchr-bs-norm.obj: strchr-bs-norm.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strchr-bs-norm.obj `if test -f 'strchr-bs-norm.S'; then $(CYGPATH_W) 'strchr-bs-norm.S'; else $(CYGPATH_W) '$(srcdir)/strchr-bs-norm.S'; fi`
+
+lib_a-strcmp.o: strcmp.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp.o `test -f 'strcmp.S' || echo '$(srcdir)/'`strcmp.S
+
+lib_a-strcmp.obj: strcmp.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp.obj `if test -f 'strcmp.S'; then $(CYGPATH_W) 'strcmp.S'; else $(CYGPATH_W) '$(srcdir)/strcmp.S'; fi`
+
+lib_a-strcmp-archs.o: strcmp-archs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp-archs.o `test -f 'strcmp-archs.S' || echo '$(srcdir)/'`strcmp-archs.S
+
+lib_a-strcmp-archs.obj: strcmp-archs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp-archs.obj `if test -f 'strcmp-archs.S'; then $(CYGPATH_W) 'strcmp-archs.S'; else $(CYGPATH_W) '$(srcdir)/strcmp-archs.S'; fi`
+
+lib_a-strcpy.o: strcpy.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy.o `test -f 'strcpy.S' || echo '$(srcdir)/'`strcpy.S
+
+lib_a-strcpy.obj: strcpy.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy.obj `if test -f 'strcpy.S'; then $(CYGPATH_W) 'strcpy.S'; else $(CYGPATH_W) '$(srcdir)/strcpy.S'; fi`
+
+lib_a-strcpy-bs.o: strcpy-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy-bs.o `test -f 'strcpy-bs.S' || echo '$(srcdir)/'`strcpy-bs.S
+
+lib_a-strcpy-bs.obj: strcpy-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy-bs.obj `if test -f 'strcpy-bs.S'; then $(CYGPATH_W) 'strcpy-bs.S'; else $(CYGPATH_W) '$(srcdir)/strcpy-bs.S'; fi`
+
+lib_a-strcpy-bs-arc600.o: strcpy-bs-arc600.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy-bs-arc600.o `test -f 'strcpy-bs-arc600.S' || echo '$(srcdir)/'`strcpy-bs-arc600.S
+
+lib_a-strcpy-bs-arc600.obj: strcpy-bs-arc600.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcpy-bs-arc600.obj `if test -f 'strcpy-bs-arc600.S'; then $(CYGPATH_W) 'strcpy-bs-arc600.S'; else $(CYGPATH_W) '$(srcdir)/strcpy-bs-arc600.S'; fi`
+
+lib_a-strlen.o: strlen.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen.o `test -f 'strlen.S' || echo '$(srcdir)/'`strlen.S
+
+lib_a-strlen.obj: strlen.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen.obj `if test -f 'strlen.S'; then $(CYGPATH_W) 'strlen.S'; else $(CYGPATH_W) '$(srcdir)/strlen.S'; fi`
+
+lib_a-strlen-bs.o: strlen-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-bs.o `test -f 'strlen-bs.S' || echo '$(srcdir)/'`strlen-bs.S
+
+lib_a-strlen-bs.obj: strlen-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-bs.obj `if test -f 'strlen-bs.S'; then $(CYGPATH_W) 'strlen-bs.S'; else $(CYGPATH_W) '$(srcdir)/strlen-bs.S'; fi`
+
+lib_a-strlen-bs-norm.o: strlen-bs-norm.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-bs-norm.o `test -f 'strlen-bs-norm.S' || echo '$(srcdir)/'`strlen-bs-norm.S
+
+lib_a-strlen-bs-norm.obj: strlen-bs-norm.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-bs-norm.obj `if test -f 'strlen-bs-norm.S'; then $(CYGPATH_W) 'strlen-bs-norm.S'; else $(CYGPATH_W) '$(srcdir)/strlen-bs-norm.S'; fi`
+
+lib_a-strncpy.o: strncpy.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strncpy.o `test -f 'strncpy.S' || echo '$(srcdir)/'`strncpy.S
+
+lib_a-strncpy.obj: strncpy.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strncpy.obj `if test -f 'strncpy.S'; then $(CYGPATH_W) 'strncpy.S'; else $(CYGPATH_W) '$(srcdir)/strncpy.S'; fi`
+
+lib_a-strncpy-bs.o: strncpy-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strncpy-bs.o `test -f 'strncpy-bs.S' || echo '$(srcdir)/'`strncpy-bs.S
+
+lib_a-strncpy-bs.obj: strncpy-bs.S
+	$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strncpy-bs.obj `if test -f 'strncpy-bs.S'; then $(CYGPATH_W) 'strncpy-bs.S'; else $(CYGPATH_W) '$(srcdir)/strncpy-bs.S'; fi`
+
 .c.o:
 	$(COMPILE) -c $<
 
@@ -332,6 +437,36 @@ lib_a-memset-stub.o: memset-stub.c
 lib_a-memset-stub.obj: memset-stub.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memset-stub.obj `if test -f 'memset-stub.c'; then $(CYGPATH_W) 'memset-stub.c'; else $(CYGPATH_W) '$(srcdir)/memset-stub.c'; fi`
 
+lib_a-strchr-stub.o: strchr-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strchr-stub.o `test -f 'strchr-stub.c' || echo '$(srcdir)/'`strchr-stub.c
+
+lib_a-strchr-stub.obj: strchr-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strchr-stub.obj `if test -f 'strchr-stub.c'; then $(CYGPATH_W) 'strchr-stub.c'; else $(CYGPATH_W) '$(srcdir)/strchr-stub.c'; fi`
+
+lib_a-strcmp-stub.o: strcmp-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcmp-stub.o `test -f 'strcmp-stub.c' || echo '$(srcdir)/'`strcmp-stub.c
+
+lib_a-strcmp-stub.obj: strcmp-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcmp-stub.obj `if test -f 'strcmp-stub.c'; then $(CYGPATH_W) 'strcmp-stub.c'; else $(CYGPATH_W) '$(srcdir)/strcmp-stub.c'; fi`
+
+lib_a-strcpy-stub.o: strcpy-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy-stub.o `test -f 'strcpy-stub.c' || echo '$(srcdir)/'`strcpy-stub.c
+
+lib_a-strcpy-stub.obj: strcpy-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy-stub.obj `if test -f 'strcpy-stub.c'; then $(CYGPATH_W) 'strcpy-stub.c'; else $(CYGPATH_W) '$(srcdir)/strcpy-stub.c'; fi`
+
+lib_a-strlen-stub.o: strlen-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen-stub.o `test -f 'strlen-stub.c' || echo '$(srcdir)/'`strlen-stub.c
+
+lib_a-strlen-stub.obj: strlen-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen-stub.obj `if test -f 'strlen-stub.c'; then $(CYGPATH_W) 'strlen-stub.c'; else $(CYGPATH_W) '$(srcdir)/strlen-stub.c'; fi`
+
+lib_a-strncpy-stub.o: strncpy-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy-stub.o `test -f 'strncpy-stub.c' || echo '$(srcdir)/'`strncpy-stub.c
+
+lib_a-strncpy-stub.obj: strncpy-stub.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy-stub.obj `if test -f 'strncpy-stub.c'; then $(CYGPATH_W) 'strncpy-stub.c'; else $(CYGPATH_W) '$(srcdir)/strncpy-stub.c'; fi`
+
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
diff --git a/newlib/libc/machine/arc/strchr-bs-norm.S b/newlib/libc/machine/arc/strchr-bs-norm.S
new file mode 100644
index 0000000..2953547
--- /dev/null
+++ b/newlib/libc/machine/arc/strchr-bs-norm.S
@@ -0,0 +1,165 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strchr.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+/* ARC700 has a relatively long pipeline and branch prediction, so we want
+   to avoid branches that are hard to predict.  On the other hand, the
+   presence of the norm instruction makes it easier to operate on whole
+   words branch-free.  */
+#include "asm.h"
+
+#if (defined (__ARC700__) || defined (__EM__) || defined (__HS__)) \
+    && defined (__ARC_NORM__) && defined (__Xbarrel_shifter)
+
+ENTRY (strchr)
+	extb_s	r1,r1
+	asl	r5,r1,8
+	bmsk	r2,r0,1
+	or	r5,r5,r1
+	mov_s	r3,0x01010101
+	breq.d	r2,r0,.Laligned
+	asl	r4,r5,16
+	sub_s	r0,r0,r2
+	asl	r7,r2,3
+	ld_s	r2,[r0]
+#ifdef __LITTLE_ENDIAN__
+	asl	r7,r3,r7
+#else
+	lsr	r7,r3,r7
+#endif
+	or	r5,r5,r4
+	ror	r4,r3
+	sub	r12,r2,r7
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+	brne.d	r12,0,.Lfound0_ua
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+#ifdef __LITTLE_ENDIAN__
+	and	r7,r12,r4
+	breq	r7,0,.Loop ; For speed, we want this branch to be unaligned.
+	b_l	.Lfound_char ; Likewise this one.
+#else
+	and	r12,r12,r4
+	breq_l	r12,0,.Loop ; For speed, we want this branch to be unaligned.
+	lsr_s	r12,r12,7
+	bic	r2,r7,r6
+	b.d	.Lfound_char_b
+	and_s	r2,r2,r12
+#endif
+; /* We require this code address to be unaligned for speed...  */
+.Laligned:
+	ld_s	r2,[r0]
+	or	r5,r5,r4
+	ror	r4,r3
+; /* ... so that this code address is aligned, for itself and ...  */
+.Loop:
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+	brne.d	r12,0,.Lfound0
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r3
+	bic	r12,r12,r6
+	and	r7,r12,r4
+	breq	r7,0,.Loop /* ... so that this branch is unaligned.  */
+	; Found searched-for character.  r0 has already advanced to next word.
+#ifdef __LITTLE_ENDIAN__
+/* We only need the information about the first matching byte
+   (i.e. the least significant matching byte) to be exact,
+   hence there is no problem with carry effects.  */
+.Lfound_char:
+	sub	r3,r7,1
+	bic	r3,r3,r7
+	norm	r2,r3
+	sub_s	r0,r0,1
+	asr_s	r2,r2,3
+	j_l.d	[blink]
+	sub_s	r0,r0,r2
+
+	.balign	4
+.Lfound0_ua:
+	mov_l	r3,r7
+.Lfound0:
+	sub	r3,r6,r3
+	bic	r3,r3,r6
+	and	r2,r3,r4
+	or_s	r12,r12,r2
+	sub_s	r3,r12,1
+	bic_s	r3,r3,r12
+	norm	r3,r3
+	add_s	r0,r0,3
+	asr_s	r12,r3,3
+	asl.f	0,r2,r3
+	sub_s	r0,r0,r12
+	j_s.d	[blink]
+	mov.pl	r0,0
+#else /* BIG ENDIAN */
+.Lfound_char:
+	lsr	r7,r7,7
+
+	bic	r2,r7,r6
+.Lfound_char_b:
+	norm	r2,r2
+	sub_s	r0,r0,4
+	asr_s	r2,r2,3
+	j_l.d	[blink]
+	add_s	r0,r0,r2
+
+.Lfound0_ua:
+	mov_s	r3,r7
+.Lfound0:
+	asl_s	r2,r2,7
+	or	r7,r6,r4
+	bic_s	r12,r12,r2
+	sub	r2,r7,r3
+	or	r2,r2,r6
+	bic	r12,r2,r12
+	bic.f	r3,r4,r12
+	norm	r3,r3
+
+	add.pl	r3,r3,1
+	asr_s	r12,r3,3
+	asl.f	0,r2,r3
+	add_s	r0,r0,r12
+	j_s.d	[blink]
+	mov.mi	r0,0
+#endif /* ENDIAN */
+ENDFUNC (strchr)
+#endif /* (__ARC700__ || __EM__ || __HS__) && __ARC_NORM__ && __Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strchr-bs.S b/newlib/libc/machine/arc/strchr-bs.S
new file mode 100644
index 0000000..47090dd
--- /dev/null
+++ b/newlib/libc/machine/arc/strchr-bs.S
@@ -0,0 +1,200 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strchr.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+/* In order to search for a zero in a W, we calculate
+   X := (W - 0x01010101) & ~W & 0x80808080;
+   In the little endian case:
+     If no byte in W is zero, X will be zero; otherwise, the least significant
+     byte of X which is nonzero indicates the least significant byte of W that
+     is zero.
+   In the big endian case:
+     X will be zero iff no byte in W is zero.
+     If X is nonzero, to find out which is the most significant zero byte
+     in W, we calculate:
+     Y := ~(((W | 0x80808080) - 0x01010101) | W) & 0x80808080;
+     Each byte in Y is 0x80 if the the corresponding byte in
+     W is zero, otherwise that byte of Y is 0.  */
+
+#if defined (__Xbarrel_shifter) && \
+   (defined (__ARC600__) || (!defined (__ARC_NORM__) && !defined (__ARC601__)))
+ENTRY (strchr)
+	bmsk.f	r2,r0,1
+	mov_s	r3,0x01010101
+	extb_s	r1,r1
+	asl	r5,r1,8
+	or	r5,r5,r1
+	beq.d	.Laligned
+	asl	r4,r5,16
+        sub_s   r0,r0,r2
+        asl_s   r2,r2,3
+#ifdef	__LITTLE_ENDIAN__
+        asl     r7,r3,r2
+#else
+        lsr     r7,r3,r2
+#endif
+	ld_s	r2,[r0]
+	or	r5,r5,r4
+	ror	r4,r3
+	sub	r12,r2,r7
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+
+	brne.d	r12,0,.Lfound0_ua
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+#ifdef __LITTLE_ENDIAN__
+	and.f	r7,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+	b.d	.Lfound_char_ua
+	btst	r7,7
+#else
+	and.f	r8,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+	bic	r12,r7,r6
+	asl_s	r12,r12,7
+	and.f	r2,r8,r12
+	b.d	.Lfound_char_ua
+	sub_s	r0,r0,4
+#endif
+
+	.balign	4
+.Laligned:
+	ld_s	r2,[r0]
+	or	r5,r5,r4
+	ror	r4,r3
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+.Loop:
+
+	brne.d	r12,0,.Lfound0
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r3
+	bic	r12,r12,r6
+	and.f	r7,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+; Found searched-for character.  r0 has already advanced to next word.
+#ifdef __LITTLE_ENDIAN__
+/* We only need the information about the first matching byte
+   (i.e. the least significant matching byte) to be exact,
+   hence there is no problem with carry effects.  */
+.Lfound_char:
+	btst	r7,7
+.Lfound_char_ua:
+	sub_s	r0,r0,4
+	add.eq	r0,r0,1
+	btst.eq	r7,15
+	add.eq	r0,r0,1
+	btst.eq	r7,23
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+
+	.balign	4
+.Lfound0_ua:
+	mov_l	r3,r7
+.Lfound0:
+	sub	r2,r6,r3
+	bic	r2,r2,r6
+	and	r2,r2,r4
+	or	r3,r12,r2
+	sub_s	r12,r3,1
+	xor_s	r3,r3,r12
+	tst_s	r2,r3
+	lsr	r2,r3,31
+	lsr	r12,r3,16
+	jeq.d	[blink]
+	mov.eq	r0,0
+	lsr	r3,r3,8
+	sub_s	r2,r2,r12
+	sub_s	r2,r2,r3
+	bmsk_s	r2,r2,1
+	j_s.d	[blink]
+	add_s	r0,r0,r2
+#else /* BIG ENDIAN */
+.Lfound_char:
+	asl	r6,r6,7
+	sub_s	r0,r0,4
+	bic.f	r2,r7,r6
+.Lfound_char_ua:
+	add.pl	r0,r0,1
+	jmi.d	[blink]
+	btst_s	r2,23
+	add.eq	r0,r0,1
+	btst.eq	r2,15
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+
+; N.B. if we searched for a char zero and found it in the MSB,
+; and ignored matches are identical, we will take the early exit
+; like for an ordinary found zero - except for the extra stalls at jhi -
+; but still compute the right result.
+.Lfound0_ua:
+	mov_s	r3,r7
+.Lfound0:
+	asl_s	r2,r2,7
+	or	r7,r6,r4
+	bic_s	r12,r12,r2
+	sub	r2,r7,r3
+	or	r2,r2,r6
+	bic	r2,r4,r2
+	cmp	r12,r2
+	mov.hi	r0,0
+	btst.ls	r2,31
+	jhi.d	[blink]
+	add.eq	r0,r0,1
+	btst.eq	r2,23
+	add.eq	r0,r0,1
+	btst.eq	r2,15
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+#endif /* ENDIAN */
+ENDFUNC (strchr)
+#endif /* __Xbarrel_shifter && (__ARC600__ || (!__ARC_NORM__ && !__ARC601__)) */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strchr-stub.c b/newlib/libc/machine/arc/strchr-stub.c
new file mode 100644
index 0000000..8d84a82
--- /dev/null
+++ b/newlib/libc/machine/arc/strchr-stub.c
@@ -0,0 +1,36 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
+# include "../../string/strchr.c"
+#else
+/* See strchr-*.S.  */
+#endif
diff --git a/newlib/libc/machine/arc/strchr.S b/newlib/libc/machine/arc/strchr.S
new file mode 100644
index 0000000..4c320a8
--- /dev/null
+++ b/newlib/libc/machine/arc/strchr.S
@@ -0,0 +1,208 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strchr.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+/* In order to search for a zero in a W, we calculate
+   X := (W - 0x01010101) & ~W & 0x80808080;
+   In the little endian case:
+     If no byte in W is zero, X will be zero; otherwise, the least significant
+     byte of X which is nonzero indicates the least significant byte of W that
+     is zero.
+   In the big endian case:
+     X will be zero iff no byte in W is zero.
+     If X is nonzero, to find out which is the most significant zero byte
+     in W, we calculate:
+     Y := ~(((W | 0x80808080) - 0x01010101) | W) & 0x80808080;
+     Each byte in Y is 0x80 if the the corresponding byte in
+     W is zero, otherwise that byte of Y is 0.  */
+
+#if defined (__ARC601__) || !defined (__Xbarrel_shifter)
+ENTRY (strchr)
+	bmsk.f	r2,r0,1
+	mov_s	r3,0x01010101
+	extb_s	r1,r1
+	mov	r8,0
+	add3	r5,r8,r1
+	add3	r5,r8,r5
+	add2	r5,r1,r5
+	add3	r4,r8,r5
+	add3	r4,r8,r4
+	add3	r4,r8,r4
+	add3	r4,r8,r4
+	beq.d	.Laligned
+	add3	r4,r8,r4
+        sub_s   r0,r0,r2
+#ifdef	__LITTLE_ENDIAN__
+	add3.f	r2,-1,r2
+	bmsk	r7,r3,r2
+	rsub.pl	r7,r7,r3
+#else
+	mov_s	r12,31
+	sub3	r2,r12,r2
+	bmsk	r7,r3,r2
+#endif
+	ld_s	r2,[r0]
+	add1	r5,r5,r4
+	ror	r4,r3
+	sub	r12,r2,r7
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+
+	brne.d	r12,0,.Lfound0_ua
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+#ifdef __LITTLE_ENDIAN__
+	and.f	r7,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+	b.d	.Lfound_char_ua
+	btst	r7,7
+#else
+	and.f	r8,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+	bic	r12,r7,r6
+	bic	r2,r3,r12
+	sub1	r2,r3,r2
+	sub_s	r0,r0,4
+	b.d	.Lfound_char_ua
+	bic.f	r2,r8,r2
+#endif
+
+	.balign	4
+.Laligned:
+	ld_s	r2,[r0]
+	add1	r5,r5,r4
+	ror	r4,r3
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	and	r12,r12,r4
+.Loop:
+
+	brne.d	r12,0,.Lfound0
+	xor	r6,r2,r5
+	ld.a	r2,[r0,4]
+	sub	r12,r6,r3
+	bic	r12,r12,r6
+	and.f	r7,r12,r4
+	sub	r12,r2,r3
+	bic_s	r12,r12,r2
+	beq.d	.Loop
+	and	r12,r12,r4
+; Found searched-for character.  r0 has already advanced to next word.
+#ifdef __LITTLE_ENDIAN__
+/* We only need the information about the first matching byte
+   (i.e. the least significant matching byte) to be exact,
+   hence there is no problem with carry effects.  */
+.Lfound_char:
+	btst	r7,7
+.Lfound_char_ua:
+	sub_s	r0,r0,4
+	add.eq	r0,r0,1
+	btst.eq	r7,15
+	add.eq	r0,r0,1
+	btst.eq	r7,23
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+
+	.balign	4
+.Lfound0_ua:
+	mov_l	r3,r7
+.Lfound0:
+	sub	r2,r6,r3
+	bic	r2,r2,r6
+	and	r2,r2,r4
+	or	r3,r12,r2
+	sub_s	r12,r3,1
+	xor_s	r3,r3,r12
+	cmp	0xffff,r3
+	; cmp uses limm ; ARC600 would do: asl.f 0,r3,9
+	tst_s	r2,r3
+	mov.eq	r0,0
+	add.mi	r0,r0,1
+	btst.ne	r3,15
+	j_s.d	[blink]
+	adc.ne	r0,r0,1
+#else /* BIG ENDIAN */
+.Lfound_char:
+	and	r2,r6,r3
+	sub1	r2,r3,r2
+	sub_s	r0,r0,4
+	bic.f	r2,r7,r2
+.Lfound_char_ua:
+	add.pl	r0,r0,1
+	jmi.d	[blink]
+	btst_s	r2,23
+	add.eq	r0,r0,1
+	btst.eq	r2,15
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+
+; N.B. if we searched for a char zero and found it in the MSB,
+; and ignored matches are identical, we will take the early exit
+; like for an ordinary found zero - except for the extra stalls at jhi -
+; but still compute the right result.
+.Lfound0_ua:
+	mov_s	r3,r7
+.Lfound0:
+	and_s	r2,r2,r3
+	sub1	r2,r3,r2
+	or	r7,r6,r4
+	bic_s	r12,r12,r2
+	sub	r2,r7,r3
+	or	r2,r2,r6
+	bic	r2,r4,r2
+	cmp_s	r12,r2
+	mov.hi	r0,0
+	btst.ls	r2,31
+	jhi.d	[blink]
+	add.eq	r0,r0,1
+	btst.eq	r2,23
+	add.eq	r0,r0,1
+	btst.eq	r2,15
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+#endif /* ENDIAN */
+ENDFUNC (strchr)
+#endif /* __ARC601__ || !__Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strcmp-archs.S b/newlib/libc/machine/arc/strcmp-archs.S
new file mode 100644
index 0000000..081afeb
--- /dev/null
+++ b/newlib/libc/machine/arc/strcmp-archs.S
@@ -0,0 +1,109 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strcmp.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#ifdef __HS__
+ENTRY (strcmp)
+	or	r2, r0, r1
+	bmsk_s	r2, r2, 1
+	brne	r2, 0, @.Lcharloop
+
+; s1 and s2 are word aligned
+	ld.ab	r2, [r0, 4]
+
+	mov_s	r12, 0x01010101
+	ror	r11, r12
+	.align  4
+.LwordLoop:
+	ld.ab	r3, [r1, 4]
+	; Detect NULL char in str1
+	sub	r4, r2, r12
+	ld.ab	r5, [r0, 4]
+	bic	r4, r4, r2
+	and	r4, r4, r11
+	brne.d.nt	r4, 0, .LfoundNULL
+	; Check if the read locations are the same
+	cmp	r2, r3
+	beq.d	.LwordLoop
+	mov.eq	r2, r5
+
+	; A match is found, spot it out
+#ifdef __LITTLE_ENDIAN__
+	swape	r3, r3
+	mov_s	r0, 1
+	swape	r2, r2
+#else
+	mov_s	r0, 1
+#endif
+	cmp_s	r2, r3
+	j_s.d	[blink]
+	bset.lo	r0, r0, 31
+
+	.align 4
+.LfoundNULL:
+#ifdef __BIG_ENDIAN__
+	swape	r4, r4
+	swape	r2, r2
+	swape	r3, r3
+#endif
+	; Find null byte
+	ffs	r0, r4
+	bmsk	r2, r2, r0
+	bmsk	r3, r3, r0
+	swape	r2, r2
+	swape	r3, r3
+	; make the return value
+	sub.f	r0, r2, r3
+	mov.hi	r0, 1
+	j_s.d	[blink]
+	bset.lo	r0, r0, 31
+
+	.align 4
+.Lcharloop:
+	ldb.ab	r2, [r0, 1]
+	ldb.ab	r3, [r1, 1]
+	nop
+	breq	r2, 0, .Lcmpend
+	breq	r2, r3, .Lcharloop
+
+	.align 4
+.Lcmpend:
+	j_s.d	[blink]
+	sub	r0, r2, r3
+ENDFUNC (strcmp)
+#endif /* __HS__ */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strcmp-stub.c b/newlib/libc/machine/arc/strcmp-stub.c
new file mode 100644
index 0000000..19528e3
--- /dev/null
+++ b/newlib/libc/machine/arc/strcmp-stub.c
@@ -0,0 +1,36 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
+# include "../../string/strcmp.c"
+#else
+/* See strcmp-*.S.  */
+#endif
diff --git a/newlib/libc/machine/arc/strcmp.S b/newlib/libc/machine/arc/strcmp.S
new file mode 100644
index 0000000..2e5e538
--- /dev/null
+++ b/newlib/libc/machine/arc/strcmp.S
@@ -0,0 +1,133 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strcmp.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+/* This is optimized primarily for the ARC700.
+   It would be possible to speed up the loops by one cycle / word
+   respective one cycle / byte by forcing double source 1 alignment, unrolling
+   by a factor of two, and speculatively loading the second word / byte of
+   source 1; however, that would increase the overhead for loop setup / finish,
+   and strcmp might often terminate early.  */
+#ifndef __HS__
+
+ENTRY (strcmp)
+	or	r2,r0,r1
+	bmsk_s	r2,r2,1
+	brne_l	r2,0,.Lcharloop
+	mov_s	r12,0x01010101
+	ror	r5,r12
+.Lwordloop:
+	ld.ab	r2,[r0,4]
+	ld.ab	r3,[r1,4]
+	nop_s
+	sub	r4,r2,r12
+	bic	r4,r4,r2
+	and	r4,r4,r5
+	brne_l	r4,0,.Lfound0
+	breq	r2,r3,.Lwordloop
+#ifdef	__LITTLE_ENDIAN__
+	xor	r0,r2,r3	; mask for difference
+	sub_s	r1,r0,1
+	bic_s	r0,r0,r1	; mask for least significant difference bit
+	sub	r1,r5,r0
+	xor	r0,r5,r1	; mask for least significant difference byte
+	and_s	r2,r2,r0
+	and_s	r3,r3,r0
+#endif /* LITTLE ENDIAN */
+	cmp_s	r2,r3
+	mov_s	r0,1
+	j_s.d	[blink]
+	bset.lo	r0,r0,31
+
+	.balign	4
+#ifdef __LITTLE_ENDIAN__
+.Lfound0:
+	xor	r0,r2,r3	; mask for difference
+	or	r0,r0,r4	; or in zero indicator
+	sub_s	r1,r0,1
+	bic_s	r0,r0,r1	; mask for least significant difference bit
+	sub	r1,r5,r0
+	xor	r0,r5,r1	; mask for least significant difference byte
+	and_s	r2,r2,r0
+	and_s	r3,r3,r0
+	sub.f	r0,r2,r3
+	mov.hi	r0,1
+	j_s.d	[blink]
+	bset.lo	r0,r0,31
+#else /* BIG ENDIAN */
+	/* The zero-detection above can mis-detect 0x01 bytes as zeroes
+	   because of carry-propagateion from a lower significant zero byte.
+	   We can compensate for this by checking that bit0 is zero.
+	   This compensation is not necessary in the step where we
+	   get a low estimate for r2, because in any affected bytes
+	   we already have 0x00 or 0x01, which will remain unchanged
+	   when bit 7 is cleared.  */
+	.balign	4
+.Lfound0:
+#ifndef __ARC601__
+	lsr	r0,r4,8
+	lsr_s	r1,r2
+	bic_s	r2,r2,r0	; get low estimate for r2 and get ...
+	bic_s	r0,r0,r1	; <this is the adjusted mask for zeros>
+	or_s	r3,r3,r0	; ... high estimate r3 so that r2 > r3 will ...
+	cmp_s	r3,r2		; ... be independent of trailing garbage
+	or_s	r2,r2,r0	; likewise for r3 > r2
+	bic_s	r3,r3,r0
+	rlc	r0,0		; r0 := r2 > r3 ? 1 : 0
+	cmp_s	r2,r3
+	j_s.d	[blink]
+	bset.lo	r0,r0,31
+#else /* __ARC601__ */
+	/* Fall through to .Lcharloop.  */
+	sub_s	r0,r0,4
+	sub_s	r1,r1,4
+#endif /* __ARC601__ */
+#endif /* ENDIAN */
+
+	.balign	4
+.Lcharloop:
+	ldb.ab	r2,[r0,1]
+	ldb.ab	r3,[r1,1]
+	nop_s
+	breq_l	r2,0,.Lcmpend
+	breq	r2,r3,.Lcharloop
+.Lcmpend:
+	j_s.d	[blink]
+	sub	r0,r2,r3
+ENDFUNC (strcmp)
+#endif /* !__HS__ */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strcpy-bs-arc600.S b/newlib/libc/machine/arc/strcpy-bs-arc600.S
new file mode 100644
index 0000000..7b9e3fd
--- /dev/null
+++ b/newlib/libc/machine/arc/strcpy-bs-arc600.S
@@ -0,0 +1,120 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strcpy.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#if defined (__ARC600__) && defined (__Xbarrel_shifter)
+/* If dst and src are 4 byte aligned, copy 8 bytes at a time.
+   If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
+   it 8 byte aligned.  Thus, we can do a little read-ahead, without
+   dereferencing a cache line that we should not touch.
+   Note that short and long instructions have been scheduled to avoid
+   branch stalls.
+   This version is optimized for the ARC600 pipeline.  */
+
+ENTRY (strcpy)
+	or	r2,r0,r1
+	bmsk.f	0,r2,1
+	mov	r8,0x01010101
+	bne.d	.Lcharloop
+	mov_s	r10,r0
+	ld_l	r3,[r1,0]
+	bbit0.d	r1,2,.Loop_setup
+	ror	r12,r8
+	sub	r2,r3,r8
+	bic_s	r2,r2,r3
+	and_s	r2,r2,r12
+	brne_s	r2,0,.Lr3z
+	st.ab	r3,[r10,4]
+	ld.a	r3,[r1,4]
+.Loop_setup:
+	ld.a	r4,[r1,4]
+
+	sub	r2,r3,r8
+	and.f	r2,r2,r12
+	sub	r5,r4,r8
+	and.eq.f r5,r5,r12
+	b.d	.Loop_start
+	mov_s	r6,r3
+	.balign	4
+.Loop:
+	ld.a	r3,[r1,4]
+	st	r4,[r10,4]
+	ld.a	r4,[r1,4]
+	sub	r2,r3,r8
+	and.f	r2,r2,r12
+	sub	r5,r4,r8
+	and.eq.f r5,r5,r12
+	st.ab	r6,[r10,8]
+	mov	r6,r3
+.Loop_start:
+	beq.d	.Loop
+	bic_s	r2,r2,r3
+	brne.d	r2,0,.Lr3z
+	and	r5,r5,r12
+	bic	r5,r5,r4
+	breq.d	r5,0,.Loop
+	mov_s	r3,r4
+	st.ab	r6,[r10,4]
+#ifdef __LITTLE_ENDIAN__
+.Lr3z:	bmsk.f	r1,r3,7
+.Lr3z_loop:
+	lsr_s	r3,r3,8
+	stb.ab	r1,[r10,1]
+	bne.d	.Lr3z_loop
+	bmsk.f	r1,r3,7
+	j_s	[blink]
+#else
+.Lr3z:	lsr.f	r1,r3,24
+.Lr3z_loop:
+	asl_s	r3,r3,8
+	stb.ab	r1,[r10,1]
+	bne.d	.Lr3z_loop
+	lsr.f	r1,r3,24
+	j_s	[blink]
+#endif
+
+	.balign	4
+.Lcharloop:
+	ldb.ab	r3,[r1,1]
+
+
+	brne.d	r3,0,.Lcharloop
+	stb.ab	r3,[r10,1]
+	j	[blink]
+ENDFUNC (strcpy)
+#endif /* __ARC600__ && __Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strcpy-bs.S b/newlib/libc/machine/arc/strcpy-bs.S
new file mode 100644
index 0000000..2856d8c
--- /dev/null
+++ b/newlib/libc/machine/arc/strcpy-bs.S
@@ -0,0 +1,103 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strcpy.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#if (defined (__ARC700__) || defined (__EM__) || defined (__HS__)) \
+    && defined (__Xbarrel_shifter)
+
+/* If dst and src are 4 byte aligned, copy 8 bytes at a time.
+   If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
+   it 8 byte aligned.  Thus, we can do a little read-ahead, without
+   dereferencing a cache line that we should not touch.
+   Note that short and long instructions have been scheduled to avoid
+   branch stalls.
+   The beq_s to r3z could be made unaligned & long to avoid a stall
+   there, but the it is not likely to be taken often, and it
+   would also be likey to cost an unaligned mispredict at the next call.  */
+
+ENTRY (strcpy)
+	or	r2,r0,r1
+	bmsk_s	r2,r2,1
+	brne.d	r2,0,charloop
+	mov_s	r10,r0
+	ld_s	r3,[r1,0]
+	mov	r8,0x01010101
+	bbit0.d	r1,2,loop_start
+	ror	r12,r8
+	sub	r2,r3,r8
+	bic_s	r2,r2,r3
+	tst_s	r2,r12
+	bne_l	r3z
+	mov_s	r4,r3
+	.balign 4
+loop:
+	ld.a	r3,[r1,4]
+	st.ab	r4,[r10,4]
+loop_start:
+	ld.a	r4,[r1,4]
+	sub	r2,r3,r8
+	bic_s	r2,r2,r3
+	tst_l	r2,r12
+	bne_l	r3z
+	st.ab	r3,[r10,4]
+	sub	r2,r4,r8
+	bic	r2,r2,r4
+	tst_l	r2,r12
+	beq_l	loop
+	mov_s	r3,r4
+#ifdef __LITTLE_ENDIAN__
+r3z:	bmsk.f	r1,r3,7
+	lsr_s	r3,r3,8
+#else
+r3z:	lsr.f	r1,r3,24
+	asl_s	r3,r3,8
+#endif
+	bne.d	r3z
+	stb.ab	r1,[r10,1]
+	j_s	[blink]
+
+	.balign	4
+charloop:
+	ldb.ab	r3,[r1,1]
+
+
+	brne.d	r3,0,charloop
+	stb.ab	r3,[r10,1]
+	j	[blink]
+ENDFUNC (strcpy)
+#endif /* (__ARC700__ || __EM__ || __HS__) && __Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strcpy-stub.c b/newlib/libc/machine/arc/strcpy-stub.c
new file mode 100644
index 0000000..80ea0e8
--- /dev/null
+++ b/newlib/libc/machine/arc/strcpy-stub.c
@@ -0,0 +1,36 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
+# include "../../string/strcpy.c"
+#else
+/* See strcpy-*.S.  */
+#endif
diff --git a/newlib/libc/machine/arc/strcpy.S b/newlib/libc/machine/arc/strcpy.S
new file mode 100644
index 0000000..2d2630f
--- /dev/null
+++ b/newlib/libc/machine/arc/strcpy.S
@@ -0,0 +1,90 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strcpy.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#if defined (__ARC601__) || !defined (__Xbarrel_shifter)
+/* If dst and src are 4 byte aligned, copy 8 bytes at a time.
+   If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
+   it 8 byte aligned.  Thus, we can do a little read-ahead, without
+   dereferencing a cache line that we should not touch.
+   This version is a compromise between speed for the 601 pipeline and code
+   size.  */
+
+ENTRY (strcpy)
+	or	r2,r0,r1
+	bmsk.f	0,r2,1
+	mov	r8,0x01010101
+	bne.d	.Lcharloop
+	mov_s	r10,r0
+	ld_s	r3,[r1]
+	bbit0.d	r1,2,.Loop_start
+	ror	r12,r8
+	sub	r2,r3,r8
+	bic_s	r2,r2,r3
+	and_s	r2,r2,r12
+	brne_s	r2,0,.Lr3z
+	mov	r4,r3
+	sub_s	r1,r1,4
+	.balign	4
+.Loop:
+	ld.a	r3,[r1,8]
+	st.ab	r4,[r10,4]
+.Loop_start:
+	ld	r4,[r1,4]
+	sub	r2,r3,r8
+	bic_s	r2,r2,r3
+	tst_s	r2,r12
+	sub	r5,r4,r8
+	bic	r5,r5,r4
+	bne_s	.Lr3z
+	and	r5,r5,r12
+	breq.d	r5,0,.Loop
+	st.ab	r3,[r10,4]
+
+	;mov_s	r3,r4
+	add_s	r1,r1,4
+
+	.balign	4
+.Lr3z:
+.Lcharloop:
+	ldb.ab	r3,[r1,1]
+	brne.d	r3,0,.Lcharloop
+	stb.ab	r3,[r10,1]
+	j_s	[blink]
+ENDFUNC (strcpy)
+#endif /* __ARC601__ || !__Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strlen-bs-norm.S b/newlib/libc/machine/arc/strlen-bs-norm.S
new file mode 100644
index 0000000..3231240
--- /dev/null
+++ b/newlib/libc/machine/arc/strlen-bs-norm.S
@@ -0,0 +1,115 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strlen.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+#if (defined (__ARC700__) || defined (__EM__) || defined (__HS__)) \
+    && defined (__ARC_NORM__) && defined (__Xbarrel_shifter)
+
+ENTRY (strlen)
+	or	r3,r0,7
+	ld	r2,[r3,-7]
+	ld.a	r6,[r3,-3]
+	mov	r4,0x01010101
+	; uses long immediate
+#ifdef __LITTLE_ENDIAN__
+	asl_s	r1,r0,3
+	btst_s	r0,2
+	asl	r7,r4,r1
+	ror	r5,r4
+	sub	r1,r2,r7
+	bic_s	r1,r1,r2
+	mov.eq	r7,r4
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#else /* BIG ENDIAN */
+	ror	r5,r4
+	btst_s	r0,2
+	mov_s	r1,31
+	sub3	r7,r1,r0
+	sub	r1,r2,r4
+	bic_s	r1,r1,r2
+	bmsk	r1,r1,r7
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	bmsk.ne	r12,r12,r7
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#endif /* ENDIAN */
+
+.Loop:
+	ld_s	r2,[r3,4]
+	ld.a	r6,[r3,8]
+	; stall for load result
+	sub	r1,r2,r4
+	bic_s	r1,r1,r2
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	or_l	r12,r12,r1
+	and	r12,r12,r5
+	breq_l	r12,0,.Loop
+.Lend:
+	and.f	r1,r1,r5
+	sub.ne	r3,r3,4
+	mov.eq	r1,r12
+#ifdef __LITTLE_ENDIAN__
+	sub_s	r2,r1,1
+	bic_s	r2,r2,r1
+	norm	r1,r2
+	sub_s	r0,r0,3
+	lsr_s	r1,r1,3
+	sub	r0,r3,r0
+	j_s.d	[blink]
+	sub_l	r0,r0,r1
+#else /* BIG ENDIAN */
+	lsr_s	r1,r1,7
+	mov.eq	r2,r6
+	bic_s	r1,r1,r2
+	norm	r1,r1
+	sub	r0,r3,r0
+	lsr_s	r1,r1,3
+	j_s.d	[blink]
+	add_l	r0,r0,r1
+#endif /* ENDIAN */
+.Learly_end:
+	b.d	.Lend
+	sub_s.ne r1,r1,r1
+ENDFUNC (strlen)
+#endif /* (__ARC700__ || __EM__ || __HS__) && __ARC_NORM__ && _Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strlen-bs.S b/newlib/libc/machine/arc/strlen-bs.S
new file mode 100644
index 0000000..44b7c4c
--- /dev/null
+++ b/newlib/libc/machine/arc/strlen-bs.S
@@ -0,0 +1,122 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strlen.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#if (defined (__ARC600__) || !defined (__ARC_NORM__)) && !defined (__ARC601__) \
+    && defined (__Xbarrel_shifter)
+/* This code is optimized for the ARC600 pipeline.  */
+
+ENTRY (strlen)
+	or	r3,r0,7
+	ld	r2,[r3,-7]
+	ld.a	r6,[r3,-3]
+	mov	r4,0x01010101
+	; uses long immediate
+#ifdef __LITTLE_ENDIAN__
+	asl_s	r1,r0,3
+	btst_s	r0,2
+	asl	r7,r4,r1
+	ror	r5,r4
+	sub	r1,r2,r7
+	bic_l	r1,r1,r2
+	mov.eq	r7,r4
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#else /* BIG ENDIAN */
+	ror	r5,r4
+	btst_s	r0,2
+	mov_s	r1,31
+	sub3	r7,r1,r0
+	sub	r1,r2,r4
+	bic_l	r1,r1,r2
+	bmsk	r1,r1,r7
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	bmsk.ne	r12,r12,r7
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#endif /* ENDIAN */
+
+.Loop:
+	ld_s	r2,[r3,4]
+	ld.a	r6,[r3,8]
+	; stall for load result
+	sub	r1,r2,r4
+	bic_s	r1,r1,r2
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	or_s	r12,r12,r1
+	and	r12,r12,r5
+	breq_s	r12,0,.Loop
+.Lend:
+	and.f	r1,r1,r5
+	sub.ne	r3,r3,4
+#ifdef __LITTLE_ENDIAN__
+	mov.eq	r1,r12
+	asr.f	0,r1,8
+	bmsk.f	0,r1,15
+	sub	r0,r3,r0
+	add.cc	r0,r0,1
+	jne.d	[blink]
+	asl.f	0,r1,9
+	j_s.d	[blink]
+	sbc	r0,r0,-2
+#else /* BIG ENDIAN */
+	mov.eq	r2,r6
+	asl_s	r2,r2,7
+	mov.eq	r1,r12
+	bic_s	r1,r1,r2
+	asr.f	0,r1,16
+	sub	r0,r3,r0
+	add.pl	r0,r0,1
+	jne.d	[blink]
+	add.eq	r0,r0,1
+	j_s.d	[blink]
+	add.cc	r0,r0,1
+#endif /* ENDIAN */
+
+	.balign	4
+.Learly_end:
+	b.d	.Lend
+	sub_s.ne r1,r1,r1
+ENDFUNC (strlen)
+#endif /* (__ARC600__ || !__ARC_NORM__) && !__ARC601__ && __Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strlen-stub.c b/newlib/libc/machine/arc/strlen-stub.c
new file mode 100644
index 0000000..942e9be
--- /dev/null
+++ b/newlib/libc/machine/arc/strlen-stub.c
@@ -0,0 +1,36 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
+# include "../../string/strlen.c"
+#else
+/* See strlen-*.S.  */
+#endif
diff --git a/newlib/libc/machine/arc/strlen.S b/newlib/libc/machine/arc/strlen.S
new file mode 100644
index 0000000..e9825ce
--- /dev/null
+++ b/newlib/libc/machine/arc/strlen.S
@@ -0,0 +1,165 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strlen.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+#if defined(__ARC601__) || !defined (__Xbarrel_shifter)
+/* This code is optimized for the ARC601 pipeline without barrel shifter.  */
+
+ENTRY (strlen)
+	or	r3,r0,7
+	ld	r2,[r3,-7]
+	ld.a	r6,[r3,-3]
+	mov	r4,0x01010101
+	; uses long immediate
+#ifdef __LITTLE_ENDIAN__
+	bmsk.f	0,r0,1
+	mov_s	r1,31
+	add3_s	r1,r1,r0
+	bmsk	r7,r4,r1
+	xor.ne	r7,r7,r4
+	btst_s	r0,2
+	ror	r5,r4
+	sub	r1,r2,r7
+	bic_s	r1,r1,r2
+	mov.eq	r7,r4
+	sub	r12,r6,r7
+	bic	r12,r12,r6
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#else /* BIG ENDIAN */
+	add.f	r1,r4,30 ; r1 mod 31 := -1; clear carry
+	ror	r5,r4
+	sub3	r7,r1,r0
+	btst_s	r0,2
+	sub	r1,r2,r4
+	bic_s	r1,r1,r2
+	bmsk	r1,r1,r7
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	bmsk.ne	r12,r12,r7
+	or.eq	r12,r12,r1
+	and	r12,r12,r5
+	brne	r12,0,.Learly_end
+#endif /* ENDIAN */
+
+.Loop:
+	ld_s	r2,[r3,4]
+	ld.a	r6,[r3,8]
+	; stall for load result
+	sub	r1,r2,r4
+	bic_s	r1,r1,r2
+	sub	r12,r6,r4
+	bic	r12,r12,r6
+	or_s	r12,r12,r1
+	and	r12,r12,r5
+	breq_s	r12,0,.Loop
+.Lend:
+	and.f	r1,r1,r5
+	sub.ne	r3,r3,4
+#ifdef __LITTLE_ENDIAN__
+	mov.eq	r1,r12
+	btst_s	r1,7
+	sub	r0,r3,r0
+	add.eq	r0,r0,1
+	bmsk.f	0,r1,15
+	add.eq	r0,r0,1
+	bmsk.f	0,r1,23
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+#else /* BIG ENDIAN */
+#ifdef __OPTIMIZE_SIZE__
+1:	ldb_s	r1,[r3]
+	breq_s	r1,0,0f
+	ldb.a	r1,[r3,1]
+	breq_s	r1,0,0f
+	ldb.a	r1,[r3,1]
+	breq_s	r1,0,0f
+	add_s	r3,r3,1
+0:	j_s.d	[blink]
+	sub	r0,r3,r0
+
+#define SPECIAL_EARLY_END
+.Learly_end:
+	mov_s	r3,r0
+	b_s	1b
+#elif 0 /* Need more information about pipeline to assess if this is faster.  */
+	mov.eq  r2,r6
+	and	r2,r2,r5
+	sub1	r2,r4,r2
+	mov.eq  r1,r12
+	bic.f   r1,r1,r2
+	sub     r0,r3,r0
+	add.pl  r0,r0,1
+	btst.pl	r1,23
+	add.eq	r0,r0,1
+	btst.eq	r1,15
+	j_s.d	[blink]
+	add.eq	r0,r0,1
+#else /* !__OPTIMIZE_SIZE__ */
+	/* Need carry clear here.  */
+	mov.eq	r2,r6
+1:	bmsk	r1,r2,23
+	breq	r1,r2,0f
+	bmsk	r2,r1,15
+	breq.d	r1,r2,0f
+	add_s	r3,r3,1
+	cmp	r2,0x100
+	add_s	r3,r3,2
+0:	j_s.d	[blink]
+	sbc	r0,r3,r0
+
+#define SPECIAL_EARLY_END
+.Learly_end:
+	sub_s.ne r1,r1,r1
+	mov_s	r12,0
+	bset	r12,r12,r7
+	sub1	r2,r2,r12
+	b.d	.Lend
+	sub1.ne	r6,r6,r12
+#endif /* !__OPTIMIZE_SIZE__ */
+#endif /* ENDIAN */
+
+#ifndef SPECIAL_EARLY_END
+	.balign	4
+.Learly_end:
+	b.d	.Lend
+	sub_s.ne r1,r1,r1
+#endif /* !SPECIAL_EARLY_END */
+ENDFUNC (strlen)
+#endif /* __ARC601__ || !__Xbarrel_shifter*/
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strncpy-bs.S b/newlib/libc/machine/arc/strncpy-bs.S
new file mode 100644
index 0000000..c146ce0
--- /dev/null
+++ b/newlib/libc/machine/arc/strncpy-bs.S
@@ -0,0 +1,171 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strncpy.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+/* If dst and src are 4 byte aligned, copy 8 bytes at a time.
+   If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
+   it 8 byte aligned.  Thus, we can do a little read-ahead, without
+   dereferencing a cache line that we should not touch.
+   Note that short and long instructions have been scheduled to avoid
+   branch stalls.
+   The beq_s to r3z could be made unaligned & long to avoid a stall
+   there, but the it is not likely to be taken often, and it
+   would also be likey to cost an unaligned mispredict at the next call.  */
+
+#if !defined (__ARC601__) && defined (__Xbarrel_shifter)
+
+#if defined (__ARC700___) || defined (__EM__) || defined (__HS__)
+#define BRand(a,b,l)	tst	a,b ` bne_l l
+#else
+#define BRand(a,b,l)	and	a,a,b ` brne_s a,0,l
+#endif
+
+ENTRY (strncpy)
+	cmp_s	r2,8
+	or	r12,r0,r1
+	bmsk.cc.f r12,r12,1
+	brne.d	r12,0,.Lbytewise
+	mov_s	r10,r0
+	ld_s	r3,[r1,0]
+	mov	r8,0x01010101
+	sub	lp_count,r2,1
+	bbit0.d	r1,2,.Loop_start
+	ror	r11,r8
+	sub	r12,r3,r8
+	bic_l	r12,r12,r3
+	BRand	(r12,r11,.Lr3z)
+	mov_s	r4,r3
+	ld.a	r3,[r1,4]
+	sub	lp_count,lp_count,4
+	st.ab	r4,[r10,4]
+	.balign 4
+.Loop_start:
+	lsr.f	lp_count,lp_count,3
+	lpne	.Loop_end
+	ld.a	r4,[r1,4]
+	sub	r12,r3,r8
+	bic_s	r12,r12,r3
+	BRand	(r12,r11,.Lr3z)
+	st.ab	r3,[r10,4]
+	sub	r12,r4,r8
+	bic	r12,r12,r4
+	BRand	(r12,r11,.Lr4z)
+	ld.a	r3,[r1,4]
+	st.ab	r4,[r10,4]
+.Loop_end:
+	bcc_s	.Lastword
+	ld.a	r4,[r1,4]
+	sub	r12,r3,r8
+	bic_s	r12,r12,r3
+	BRand	(r12,r11,.Lr3z)
+	st.ab	r3,[r10,4]
+	mov_s	r3,r4
+.Lastword:
+	and.f	lp_count,r2,3
+	mov.eq	lp_count,4
+	lp	.Last_byte_end
+#ifdef __LITTLE_ENDIAN__
+	bmsk.f	r1,r3,7
+	lsr.ne	r3,r3,8
+#else
+	lsr.f	r1,r3,24
+	asl.ne	r3,r3,8
+#endif
+	stb.ab	r1,[r10,1]
+.Last_byte_end:
+	j_s	[blink]
+
+	.balign	4
+.Lr4z:
+	mov_l	r3,r4
+.Lr3z:
+#if defined (__ARC700__) || defined (__EM__) || defined (__HS__)
+#ifdef __LITTLE_ENDIAN__
+	bmsk.f	r1,r3,7
+	lsr_s	r3,r3,8
+#else
+	lsr.f	r1,r3,24
+	asl_s	r3,r3,8
+#endif
+	bne.d	.Lr3z
+	stb.ab	r1,[r10,1]
+#else /* ! __ARC700__ */
+#ifdef __LITTLE_ENDIAN__
+	bmsk.f	r1,r3,7
+.Lr3z_loop:
+	lsr_s	r3,r3,8
+	stb.ab	r1,[r10,1]
+	bne.d	.Lr3z_loop
+	bmsk.f	r1,r3,7
+#else
+	lsr.f	r1,r3,24
+.Lr3z_loop:
+	asl_s	r3,r3,8
+	stb.ab	r1,[r10,1]
+	bne.d	.Lr3z_loop
+	lsr.f	r1,r3,24
+#endif /* ENDIAN */
+#endif /* ! __ARC700__ */
+.Lzero_rest:
+	; __strncpy_bzero requires:
+	; return value in r0
+	; zeroing length in r2
+	; zeroing start address in r3
+	mov_s	r3,r10
+	add_s	r2,r2,r0
+	b.d	__strncpy_bzero
+	sub_s	r2,r2,r3
+
+	.balign	4
+.Lbytewise:
+	sub.f	r2,r2,1
+	mov_l	r3,r0
+	jcs	[blink]
+.Lcharloop:
+	ldb.ab	r12,[r1,1]
+	beq.d	.Last_byte
+	sub.f	r2,r2,1
+	brne.d	r12,0,.Lcharloop
+	stb.ab	r12,[r3,1]
+	b.d	__strncpy_bzero
+	stb.ab	r12,[r3,1]
+.Last_byte:
+	j_s.d	[blink]
+	stb_l	r12,[r3]
+ENDFUNC (strncpy)
+#endif /* !__ARC601__ && __Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
diff --git a/newlib/libc/machine/arc/strncpy-stub.c b/newlib/libc/machine/arc/strncpy-stub.c
new file mode 100644
index 0000000..3f8f9db
--- /dev/null
+++ b/newlib/libc/machine/arc/strncpy-stub.c
@@ -0,0 +1,36 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
+# include "../../string/strncpy.c"
+#else
+/* See strncpy-*.S.  */
+#endif
diff --git a/newlib/libc/machine/arc/strncpy.S b/newlib/libc/machine/arc/strncpy.S
new file mode 100644
index 0000000..9e2266b
--- /dev/null
+++ b/newlib/libc/machine/arc/strncpy.S
@@ -0,0 +1,134 @@
+/*
+   Copyright (c) 2015, Synopsys, Inc. All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+   1) Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2) Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+   3) Neither the name of the Synopsys, Inc., nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This implementation is optimized for performance.  For code size a generic
+   implementation of this function from newlib/libc/string/strncpy.c will be
+   used.  */
+#if !defined (__OPTIMIZE_SIZE__) && !defined (PREFER_SIZE_OVER_SPEED)
+
+#include "asm.h"
+
+/* If dst and src are 4 byte aligned, copy 8 bytes at a time.
+   If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
+   it 8 byte aligned.  Thus, we can do a little read-ahead, without
+   dereferencing a cache line that we should not touch.  */
+
+#if defined (__ARC601__) || !defined (__Xbarrel_shifter)
+
+#define BRand(a,b,l)	and	a,a,b ` brne_s a,0,l
+
+ENTRY (strncpy)
+	cmp_s	r2,8
+	or	r12,r0,r1
+	bmsk.cc.f r12,r12,1
+	brne.d	r12,0,.Lbytewise
+	mov_s	r10,r0
+	ld_s	r3,[r1,0]
+	mov	r8,0x01010101
+	add	r6,r0,r2
+	sub	r6,r6,8
+	bbit0.d	r1,2,.Loop_start
+	ror	r11,r8
+	sub	r12,r3,r8
+	bic_l	r12,r12,r3
+	BRand	(r12,r11,.Lr3z)
+	mov_s	r4,r3
+	ld.a	r3,[r1,4]
+	st.ab	r4,[r10,4]
+	.balign 4
+.Loop_start:
+	brhs	r10,r6,.Loop_end
+1:
+	ld.a	r4,[r1,4]
+	sub	r12,r3,r8
+	bic_s	r12,r12,r3
+	BRand	(r12,r11,.Lr3z2)
+	st.ab	r3,[r10,8]
+	sub	r12,r4,r8
+	bic	r12,r12,r4
+	BRand	(r12,r11,.Lr4z)
+	ld.a	r3,[r1,4]
+	brlo.d	r10,r6,1b
+	st	r4,[r10,-4]
+.Loop_end:
+	add	r6,r6,4
+	brhs	r10,r6,.Lastword
+	sub	r12,r3,r8
+	bic_s	r12,r12,r3
+	BRand	(r12,r11,.Lr3z)
+	add_s	r1,r1,4
+	st.ab	r3,[r10,4]
+.Lastword:
+	sub_s	r2,r2,1
+	b.d .Lstart_charloop
+	bmsk.f	r2,r2,1
+
+	.balign 4
+	nop_s
+.Lr3z2:	sub_s	r1,r1,4
+.Lr4z:
+.Lr3z:
+	.balign	4
+.Lr3z_loop:
+	ldb.ab	r3,[r1,1]
+        brne.d	r3,0,.Lr3z_loop
+        stb.ab  r3,[r10,1]
+
+.Lzero_rest:
+	; __strncpy_bzero requires:
+        ; return value in r0
+        ; zeroing length in r2
+        ; zeroing start address in r3
+	mov_s	r3,r10
+	add_s	r2,r2,r0
+        b.d	__strncpy_bzero
+	sub_s	r2,r2,r3
+
+	.balign	4
+.Lbytewise:
+	sub.f	r2,r2,1
+	jcs	[blink]
+.Lstart_charloop:
+	mov_s	r3,r10
+.Lcharloop:
+	ldb.ab	r12,[r1,1]
+	beq.d	.Last_byte
+	sub.f	r2,r2,1
+	brne.d	r12,0,.Lcharloop
+	stb.ab	r12,[r3,1]
+        b.d	__strncpy_bzero
+	stb.ab	r12,[r3,1]
+.Last_byte:
+	j_s.d	[blink]
+	stb_s	r12,[r3]
+ENDFUNC (strncpy)
+#endif /* __ARC601__ || !__Xbarrel_shifter */
+
+#endif /* !__OPTIMIZE_SIZE__ && !PREFER_SIZE_OVER_SPEED */
-- 
2.4.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]