Browse Source

Copy code from target sh to sh3eb

sh3port
Memallox 3 years ago
parent
commit
d5619f065a
  1. 28
      newlib/libc/machine/sh3eb/Makefile.am
  2. 498
      newlib/libc/machine/sh3eb/Makefile.in
  3. 1012
      newlib/libc/machine/sh3eb/aclocal.m4
  4. 42
      newlib/libc/machine/sh3eb/asm.h
  5. 6123
      newlib/libc/machine/sh3eb/configure
  6. 23
      newlib/libc/machine/sh3eb/configure.in
  7. 395
      newlib/libc/machine/sh3eb/memcpy.S
  8. 164
      newlib/libc/machine/sh3eb/memset.S
  9. 191
      newlib/libc/machine/sh3eb/setjmp.S
  10. 225
      newlib/libc/machine/sh3eb/strcmp.S
  11. 134
      newlib/libc/machine/sh3eb/strcpy.S
  12. 87
      newlib/libc/machine/sh3eb/strlen.S
  13. 209
      newlib/libc/machine/sh3eb/strncpy.S
  14. 18
      newlib/libc/sys/sh3eb/Makefile.am
  15. 474
      newlib/libc/sys/sh3eb/Makefile.in
  16. 1012
      newlib/libc/sys/sh3eb/aclocal.m4
  17. 4754
      newlib/libc/sys/sh3eb/configure
  18. 14
      newlib/libc/sys/sh3eb/configure.in
  19. 7
      newlib/libc/sys/sh3eb/creat.c
  20. 119
      newlib/libc/sys/sh3eb/crt0.S
  21. 9
      newlib/libc/sys/sh3eb/ftruncate.c
  22. 38
      newlib/libc/sys/sh3eb/sys/syscall.h
  23. 196
      newlib/libc/sys/sh3eb/syscalls.c
  24. 43
      newlib/libc/sys/sh3eb/trap.S
  25. 9
      newlib/libc/sys/sh3eb/truncate.c

28
newlib/libc/machine/sh3eb/Makefile.am

@ -0,0 +1,28 @@
## Process this file with automake to generate Makefile.in
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
AM_CCASFLAGS = $(INCLUDES)
noinst_LIBRARIES = lib.a
if SH64
lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S strncpy.S
else
lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S
endif
lib_a_CCASFLAGS=$(AM_CCASFLAGS)
lib_a_CFLAGS=$(AM_CFLAGS)
$(lpfx)memcpy.o: asm.h
$(lpfx)memset.o: asm.h
$(lpfx)setjmp.o: asm.h
$(lpfx)strcpy.o: asm.h
$(lpfx)strcmp.o: asm.h
$(lpfx)strncpy.o: asm.h
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

498
newlib/libc/machine/sh3eb/Makefile.in

@ -0,0 +1,498 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/../../../../mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
@SH64_FALSE@am_lib_a_OBJECTS = lib_a-memcpy.$(OBJEXT) \
@SH64_FALSE@ lib_a-memset.$(OBJEXT) lib_a-setjmp.$(OBJEXT) \
@SH64_FALSE@ lib_a-strcpy.$(OBJEXT) lib_a-strlen.$(OBJEXT) \
@SH64_FALSE@ lib_a-strcmp.$(OBJEXT)
@SH64_TRUE@am_lib_a_OBJECTS = lib_a-memcpy.$(OBJEXT) \
@SH64_TRUE@ lib_a-memset.$(OBJEXT) lib_a-setjmp.$(OBJEXT) \
@SH64_TRUE@ lib_a-strcpy.$(OBJEXT) lib_a-strlen.$(OBJEXT) \
@SH64_TRUE@ lib_a-strcmp.$(OBJEXT) lib_a-strncpy.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp =
am__depfiles_maybe =
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(lib_a_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
ETAGS = etags
CTAGS = ctags
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
READELF = @READELF@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
aext = @aext@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libm_machine_dir = @libm_machine_dir@
localedir = @localedir@
localstatedir = @localstatedir@
lpfx = @lpfx@
machine_dir = @machine_dir@
mandir = @mandir@
mkdir_p = @mkdir_p@
newlib_basedir = @newlib_basedir@
oext = @oext@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sys_dir = @sys_dir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
AM_CCASFLAGS = $(INCLUDES)
noinst_LIBRARIES = lib.a
@SH64_FALSE@lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S
@SH64_TRUE@lib_a_SOURCES = memcpy.S memset.S setjmp.S strcpy.S strlen.S strcmp.S strncpy.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
all: all-am
.SUFFIXES:
.SUFFIXES: .S .o .obj
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --cygnus \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --cygnus Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES)
-rm -f lib.a
$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
$(RANLIB) lib.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
.S.o:
$(CPPASCOMPILE) -c -o $@ $<
.S.obj:
$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
lib_a-memcpy.o: memcpy.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.o `test -f 'memcpy.S' || echo '$(srcdir)/'`memcpy.S
lib_a-memcpy.obj: memcpy.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.obj `if test -f 'memcpy.S'; then $(CYGPATH_W) 'memcpy.S'; else $(CYGPATH_W) '$(srcdir)/memcpy.S'; fi`
lib_a-memset.o: memset.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memset.o `test -f 'memset.S' || echo '$(srcdir)/'`memset.S
lib_a-memset.obj: memset.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memset.obj `if test -f 'memset.S'; then $(CYGPATH_W) 'memset.S'; else $(CYGPATH_W) '$(srcdir)/memset.S'; fi`
lib_a-setjmp.o: setjmp.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-setjmp.o `test -f 'setjmp.S' || echo '$(srcdir)/'`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-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-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-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-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`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-am:
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-generic clean-noinstLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-tags dvi dvi-am \
html html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
$(lpfx)memcpy.o: asm.h
$(lpfx)memset.o: asm.h
$(lpfx)setjmp.o: asm.h
$(lpfx)strcpy.o: asm.h
$(lpfx)strcmp.o: asm.h
$(lpfx)strncpy.o: asm.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

1012
newlib/libc/machine/sh3eb/aclocal.m4

File diff suppressed because it is too large

42
newlib/libc/machine/sh3eb/asm.h

@ -0,0 +1,42 @@
#ifdef __STDC__
# define _C_LABEL(x) _ ## x
#else
# define _C_LABEL(x) _/**/x
#endif
#define _ASM_LABEL(x) x
#if __SH5__
# if __SH5__ == 32 && __SHMEDIA__
# define TEXT .section .text..SHmedia32, "ax"
# else
# define TEXT .text
# endif
# define _ENTRY(name) \
TEXT; .balign 8; .globl name; name:
#else
#define _ENTRY(name) \
.text; .align 2; .globl name; name:
#endif /* __SH5__ */
#define ENTRY(name) \
_ENTRY(_C_LABEL(name))
#if (defined (__sh2__) || defined (__SH2E__) || defined (__sh3__) || defined (__SH3E__) \
|| defined (__SH4_SINGLE__) || defined (__SH4__)) \
|| defined (__SH4_SINGLE_ONLY__) || defined (__SH5__) || defined (__SH2A__)
#define DELAYED_BRANCHES
#define SL(branch, dest, in_slot, in_slot_arg2) \
branch##.s dest; in_slot, in_slot_arg2
#else
#define SL(branch, dest, in_slot, in_slot_arg2) \
in_slot, in_slot_arg2; branch dest
#endif
#ifdef __LITTLE_ENDIAN__
#define SHHI shlld
#define SHLO shlrd
#else
#define SHHI shlrd
#define SHLO shlld
#endif

6123
newlib/libc/machine/sh3eb/configure

File diff suppressed because it is too large

23
newlib/libc/machine/sh3eb/configure.in

@ -0,0 +1,23 @@
dnl This is the newlib/libc/machine/sh configure.in file.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([newlib],[NEWLIB_VERSION])
AC_CONFIG_SRCDIR([asm.h])
dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(../../../..)
AC_NO_EXECUTABLES
NEWLIB_CONFIGURE(../../..)
AC_EGREP_CPP([sh5], [
#if __SH5__
sh5
#endif
], [have_sh64=yes], [have_sh64=no])
AM_CONDITIONAL(SH64, [test $have_sh64 = yes])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

395
newlib/libc/machine/sh3eb/memcpy.S

@ -0,0 +1,395 @@
!
! Fast SH memcpy
!
! by Toshiyasu Morita (tm@netcom.com)
! hacked by J"orn Rernnecke (joern.rennecke@superh.com) ("o for o-umlaut)
! SH5 code Copyright 2002 SuperH Ltd.
!
! Entry: ARG0: destination pointer
! ARG1: source pointer
! ARG3: byte count
!
! Exit: RESULT: destination pointer
! any other registers in the range r0-r7: trashed
!
! Notes: Usually one wants to do small reads and write a longword, but
! unfortunately it is difficult in some cases to concatanate bytes
! into a longword on the SH, so this does a longword read and small
! writes.
!
! This implementation makes two assumptions about how it is called:
!
! 1.: If the byte count is nonzero, the address of the last byte to be
! copied is unsigned greater than the address of the first byte to
! be copied. This could be easily swapped for a signed comparison,
! but the algorithm used needs some comparison.
!
! 2.: When there are two or three bytes in the last word of an 11-or-more
! bytes memory chunk to b copied, the rest of the word can be read
! without side effects.
! This could be easily changed by increasing the minumum size of
! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2,
! however, this would cost a few extra cyles on average.
! For SHmedia, the assumption is that any quadword can be read in its
! enirety if at least one byte is included in the copy.
!
#include "asm.h"
ENTRY(memcpy)
#if __SHMEDIA__
#define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1
#define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1
#define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
#define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
ld.b r3,0,r63
pta/l Large,tr0
movi 25,r0
bgeu/u r4,r0,tr0
nsb r4,r0
shlli r0,5,r0
movi (L1-L0+63*32 + 1) & 0xffff,r1
sub r1, r0, r0
L0: ptrel r0,tr0
add r2,r4,r5
ptabs r18,tr1
add r3,r4,r6
blink tr0,r63
.balign 8
L1:
/* 0 byte memcpy */
blink tr1,r63
L4_7: /* 4..7 byte memcpy cntd. */
stlo.l r2, 0, r0
or r6, r7, r6
sthi.l r5, -1, r6
stlo.l r5, -4, r6
blink tr1,r63
L2_3: /* 2 or 3 byte memcpy cntd. */
st.b r5,-1,r6
blink tr1,r63
/* 1 byte memcpy */
ld.b r3,0,r0
st.b r2,0,r0
blink tr1,r63
L8_15: /* 8..15 byte memcpy cntd. */
stlo.q r2, 0, r0
or r6, r7, r6
sthi.q r5, -1, r6
stlo.q r5, -8, r6
blink tr1,r63
/* 2 or 3 byte memcpy */
ld.b r3,0,r0
ld.b r2,0,r63
ld.b r3,1,r1
st.b r2,0,r0
pta/l L2_3,tr0
ld.b r6,-1,r6
st.b r2,1,r1
blink tr0, r63
/* 4 .. 7 byte memcpy */
LDUAL (r3, 0, r0, r1)
pta L4_7, tr0
ldlo.l r6, -4, r7
or r0, r1, r0
sthi.l r2, 3, r0
ldhi.l r6, -1, r6
blink tr0, r63
/* 8 .. 15 byte memcpy */
LDUAQ (r3, 0, r0, r1)
pta L8_15, tr0
ldlo.q r6, -8, r7
or r0, r1, r0
sthi.q r2, 7, r0
ldhi.q r6, -1, r6
blink tr0, r63
/* 16 .. 24 byte memcpy */
LDUAQ (r3, 0, r0, r1)
LDUAQ (r3, 8, r8, r9)
or r0, r1, r0
sthi.q r2, 7, r0
or r8, r9, r8
sthi.q r2, 15, r8
ldlo.q r6, -8, r7
ldhi.q r6, -1, r6
stlo.q r2, 8, r8
stlo.q r2, 0, r0
or r6, r7, r6
sthi.q r5, -1, r6
stlo.q r5, -8, r6
blink tr1,r63
Large:
ld.b r2, 0, r63
pta/l Loop_ua, tr1
ori r3, -8, r7
sub r2, r7, r22
sub r3, r2, r6
add r2, r4, r5
ldlo.q r3, 0, r0
addi r5, -16, r5
movi 64+8, r27 // could subtract r7 from that.
stlo.q r2, 0, r0
sthi.q r2, 7, r0
ldx.q r22, r6, r0
bgtu/l r27, r4, tr1
addi r5, -48, r27
pta/l Loop_line, tr0
addi r6, 64, r36
addi r6, -24, r19
addi r6, -16, r20
addi r6, -8, r21
Loop_line:
ldx.q r22, r36, r63
alloco r22, 32
addi r22, 32, r22
ldx.q r22, r19, r23
sthi.q r22, -25, r0
ldx.q r22, r20, r24
ldx.q r22, r21, r25
stlo.q r22, -32, r0
ldx.q r22, r6, r0
sthi.q r22, -17, r23
sthi.q r22, -9, r24
sthi.q r22, -1, r25
stlo.q r22, -24, r23
stlo.q r22, -16, r24
stlo.q r22, -8, r25
bgeu r27, r22, tr0
Loop_ua:
addi r22, 8, r22
sthi.q r22, -1, r0
stlo.q r22, -8, r0
ldx.q r22, r6, r0
bgtu/l r5, r22, tr1
add r3, r4, r7
ldlo.q r7, -8, r1
sthi.q r22, 7, r0
ldhi.q r7, -1, r7
ptabs r18,tr1
stlo.q r22, 0, r0
or r1, r7, r1
sthi.q r5, 15, r1
stlo.q r5, 8, r1
blink tr1, r63
#else /* ! SHMEDIA, i.e. SH1 .. SH4 / SHcompact */
#ifdef __SH5__
#define DST r2
#define SRC r3
#define COUNT r4
#define TMP0 r5
#define TMP1 r6
#define RESULT r2
#else
#define DST r4
#define SRC r5
#define COUNT r6
#define TMP0 r2
#define TMP1 r3
#define RESULT r0
#endif
#ifdef __LITTLE_ENDIAN__
! Little endian version copies with increasing addresses.
mov DST,TMP1 ! Save return value
mov #11,r0 ! Check if small number of bytes
cmp/hs r0,COUNT
! COUNT becomes src end address
SL(bf, L_small, add SRC,COUNT)
mov #1,r1
tst r1,SRC ! check if source even
SL(bt, L_even, mov COUNT,r7)
mov.b @SRC+,r0 ! no, make it even.
mov.b r0,@DST
add #1,DST
L_even: tst r1,DST ! check if destination is even
add #-3,r7
SL(bf, L_odddst, mov #2,r1)
tst r1,DST ! check if destination is 4-byte aligned
mov DST,r0
SL(bt, L_al4dst, sub SRC,r0)
mov.w @SRC+,TMP0
mov.w TMP0,@DST
! add #2,DST DST is dead here.
L_al4dst:
tst r1,SRC
bt L_al4both
mov.w @SRC+,r1
swap.w r1,r1
add #-6,r0
add #-6,r7 ! r7 := src end address minus 9.
.align 2
L_2l_loop:
mov.l @SRC+,TMP0 ! Read & write two longwords per iteration
xtrct TMP0,r1
mov.l r1,@(r0,SRC)
cmp/hs r7,SRC
mov.l @SRC+,r1
xtrct r1,TMP0
mov.l TMP0,@(r0,SRC)
bf L_2l_loop
add #-2,SRC
bra L_cleanup
add #5,r0
L_al4both:
add #-4,r0
.align 2
L_al4both_loop:
mov.l @SRC+,DST ! Read longword, write longword per iteration
cmp/hs r7,SRC
SL(bf, L_al4both_loop, mov.l DST,@(r0,SRC))
bra L_cleanup
add #3,r0
L_odddst:
tst r1,SRC
SL(bt, L_al4src, add #-1,DST)
mov.w @SRC+,r0
mov.b r0,@(1,DST)
shlr8 r0
mov.b r0,@(2,DST)
add #2,DST
L_al4src:
.align 2
L_odd_loop:
mov.l @SRC+,r0 ! Read longword, write byte, word, byte per iteration
cmp/hs r7,SRC
mov.b r0,@(1,DST)
shlr8 r0
mov.w r0,@(2,DST)
shlr16 r0
mov.b r0,@(4,DST)
SL(bf, L_odd_loop, add #4,DST)
.align 2 ! avoid nop in more frequently executed code.
L_cleanup2:
mov DST,r0
sub SRC,r0
L_cleanup:
cmp/eq COUNT,SRC
bt L_ready
.align 2
L_cleanup_loop:
mov.b @SRC+,r1
cmp/eq COUNT,SRC
mov.b r1,@(r0,SRC)
bf L_cleanup_loop
L_ready:
rts
mov TMP1,RESULT
L_small:
bra L_cleanup2
add #-1,DST
#else /* ! __LITTLE_ENDIAN__ */
! Big endian version copies with decreasing addresses.
mov DST,r0
add COUNT,r0
sub DST,SRC
mov #11,r1
cmp/hs r1,COUNT
SL(bf, L_small, add #-1,SRC)
mov SRC,TMP1
add r0,TMP1
shlr TMP1
SL(bt, L_even,
mov DST,r7)
mov.b @(r0,SRC),TMP0
add #-1,TMP1
mov.b TMP0,@-r0
L_even:
tst #1,r0
add #-1,SRC
SL(bf, L_odddst, add #8,r7)
tst #2,r0
bt L_al4dst
add #-1,TMP1
mov.w @(r0,SRC),r1
mov.w r1,@-r0
L_al4dst:
shlr TMP1
bt L_al4both
mov.w @(r0,SRC),r1
swap.w r1,r1
add #4,r7
add #-4,SRC
.align 2
L_2l_loop:
mov.l @(r0,SRC),TMP0
xtrct TMP0,r1
mov.l r1,@-r0
cmp/hs r7,r0
mov.l @(r0,SRC),r1
xtrct r1,TMP0
mov.l TMP0,@-r0
bt L_2l_loop
bra L_cleanup
add #5,SRC
nop ! avoid nop in executed code.
L_al4both:
add #-2,SRC
.align 2
L_al4both_loop:
mov.l @(r0,SRC),r1
cmp/hs r7,r0
SL(bt, L_al4both_loop,
mov.l r1,@-r0)
bra L_cleanup
add #3,SRC
nop ! avoid nop in executed code.
L_odddst:
shlr TMP1
bt L_al4src
mov.w @(r0,SRC),r1
mov.b r1,@-r0
shlr8 r1
mov.b r1,@-r0
L_al4src:
add #-2,SRC
.align 2
L_odd_loop:
mov.l @(r0,SRC),TMP0
cmp/hs r7,r0
mov.b TMP0,@-r0
shlr8 TMP0
mov.w TMP0,@-r0
shlr16 TMP0
mov.b TMP0,@-r0
bt L_odd_loop
add #3,SRC
L_cleanup:
L_small:
cmp/eq DST,r0
bt L_ready
add #1,DST
.align 2
L_cleanup_loop:
mov.b @(r0,SRC),TMP0
cmp/eq DST,r0
mov.b TMP0,@-r0
bf L_cleanup_loop
L_ready:
rts
mov r0,RESULT
#endif /* ! __LITTLE_ENDIAN__ */
#endif /* ! SHMEDIA */

164
newlib/libc/machine/sh3eb/memset.S

@ -0,0 +1,164 @@
!
! Fast SH memset
!
! by Toshiyasu Morita (tm@netcom.com)
!
! SH5 code by J"orn Rennecke (joern.rennecke@superh.com)
! Copyright 2002 SuperH Ltd.
!
#include "asm.h"
ENTRY(memset)
#if __SHMEDIA__
pta/l multiquad, tr0
ptabs r18, tr2
andi r2, -8, r25
add r2, r4, r5
addi r5, -1, r20 // calculate end address.
andi r20, -8, r20
cmveq r4, r25, r20
bne/u r25, r20, tr0 // multiquad
! This sequence could clobber volatile objects that are in the same
! quadword as a very short char array.
! ldlo.q r2, 0, r7
! shlli r4, 2, r4
! movi -1, r8
! SHHI r8, r4, r8
! SHHI r8, r4, r8
! mcmv r7, r8, r3
! stlo.q r2, 0, r3
pta/l setlongs, tr0
movi 4, r8
bgeu/u r4, r8, tr0
pta/l endset, tr0
beqi/u r4, 0, tr0
st.b r2, 0, r3
beqi/u r4, 1, tr0
nop
st.b r2, 1, r3
beqi/l r4, 2, tr0
st.b r2,2,r3
endset: blink tr2, r63
setlongs:
mshflo.b r3, r3, r3
mperm.w r3, r63, r3 // Fill pattern now in every byte of r3
stlo.l r2, 0, r3
nop
nop
sthi.l r5, -1, r3
blink tr2, r63
multiquad:
mshflo.b r3, r3, r3
mperm.w r3, r63, r3 // Fill pattern now in every byte of r3
pta/l lastquad, tr0
stlo.q r2, 0, r3
sub r20, r25, r24
movi 64, r9
beqi/u r24, 8, tr0 // lastquad
pta/l loop, tr1
addi r20, -7*8, r8 // loop end address; This might overflow, so we need
// to use a different test before we start the loop
bgeu/u r24, r9, tr1// loop
st.q r25, 8, r3
shlri r24, 4, r24
st.q r20, -8, r3
beqi/u r24, 1, tr0 // lastquad
st.q r25, 16, r3
st.q r20, -16, r3
beqi/u r24, 2, tr0 // lastquad
st.q r25, 24, r3
st.q r20, -24, r3
lastquad:
sthi.q r5, -1, r3
blink tr2,r63
loop:
alloco r25, 32
st.q r25, 8, r3
st.q r25, 16, r3
st.q r25, 24, r3
st.q r25, 32, r3
addi r25, 32, r25
bgeu/l r8, r25, tr1 // loop
st.q r20, -40, r3
st.q r20, -32, r3
st.q r20, -24, r3
st.q r20, -16, r3
st.q r20, -8, r3
sthi.q r5, -1, r3
blink tr2,r63
#else /* ! SHMEDIA, i.e. SH1 .. SH4 / SHcompact */
! Entry: r4: destination pointer
! r5: fill value
! r6: byte count
!
! Exit: r0-r3: trashed
!
! This assumes that the first four bytes of the address space (0..3) are
! reserved - usually by the linker script. Otherwise, we would had to check
! for the case of objects of the size 12..15 at address 0..3 .
#ifdef __SH5__
#define DST r2
#define VAL r3
#define CNT r4
#define TMP r5
#else
#define DST r4
#define VAL r5
#define CNT r6
#define TMP r2
#endif
mov #12,r0 ! Check for small number of bytes
cmp/gt CNT,r0
mov DST,r0
SL(bt, L_store_byte_loop_check0, add DST,CNT)
tst #3,r0 ! Align destination
SL(bt, L_dup_bytes, extu.b r5,r5)
.balignw 4,0x0009
L_align_loop:
mov.b VAL,@r0
add #1,r0
tst #3,r0
bf L_align_loop
L_dup_bytes:
swap.b VAL,TMP ! Duplicate bytes across longword
or TMP,VAL
swap.w VAL,TMP
or TMP,VAL
add #-16,CNT
.balignw 4,0x0009
L_store_long_loop:
mov.l VAL,@r0 ! Store double longs to memory
cmp/hs CNT,r0
mov.l VAL,@(4,r0)
SL(bf, L_store_long_loop, add #8,r0)
add #16,CNT
L_store_byte_loop_check0:
cmp/eq CNT,r0
bt L_exit
.balignw 4,0x0009
L_store_byte_loop:
mov.b VAL,@r0 ! Store bytes to memory
add #1,r0
cmp/eq CNT,r0
bf L_store_byte_loop
L_exit:
rts
mov r4,r0
#endif /* ! SHMEDIA */

191
newlib/libc/machine/sh3eb/setjmp.S

@ -0,0 +1,191 @@
/* We want to pretend we're in SHmedia mode, even when assembling for
SHcompact. */
#if __SH5__ == 32 && ! __SHMEDIA__
# undef __SHMEDIA__
# define __SHMEDIA__ 1
#endif
#if __SHMEDIA__
.mode SHmedia
#endif
#include "asm.h"
ENTRY(setjmp)
#if __SH5__
ptabs r18, tr0
gettr tr5, r5
gettr tr6, r6
gettr tr7, r7
st.q r2, 0*8, r18
st.q r2, 1*8, r10
st.q r2, 2*8, r11
st.q r2, 3*8, r12
st.q r2, 4*8, r13
st.q r2, 5*8, r14
st.q r2, 6*8, r15
st.q r2, 7*8, r28
st.q r2, 8*8, r29
st.q r2, 9*8, r30
st.q r2, 10*8, r31
st.q r2, 11*8, r32
st.q r2, 12*8, r33
st.q r2, 13*8, r34
st.q r2, 14*8, r35
st.q r2, 15*8, r44
st.q r2, 16*8, r45
st.q r2, 17*8, r46
st.q r2, 18*8, r47
st.q r2, 19*8, r48
st.q r2, 20*8, r49
st.q r2, 21*8, r50
st.q r2, 22*8, r51
st.q r2, 23*8, r52
st.q r2, 24*8, r53
st.q r2, 25*8, r54
st.q r2, 26*8, r55
st.q r2, 27*8, r56
st.q r2, 28*8, r57
st.q r2, 29*8, r58
st.q r2, 30*8, r59
st.q r2, 31*8, r5
st.q r2, 32*8, r6
st.q r2, 33*8, r7
#if ! __SH4_NOFPU__
fst.d r2, 34*8, dr12
fst.d r2, 35*8, dr14
fst.d r2, 36*8, dr36
fst.d r2, 37*8, dr38
fst.d r2, 38*8, dr40
fst.d r2, 39*8, dr42
fst.d r2, 40*8, dr44
fst.d r2, 41*8, dr46
fst.d r2, 42*8, dr48
fst.d r2, 43*8, dr50
fst.d r2, 44*8, dr52
fst.d r2, 45*8, dr54
fst.d r2, 46*8, dr56
fst.d r2, 47*8, dr58
fst.d r2, 48*8, dr60
fst.d r2, 49*8, dr62
#endif
movi 0, r2
blink tr0, r63
#else
#if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
add #(13*4),r4
#else
add #(9*4),r4
#endif
sts.l pr,@-r4
#if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
fmov.s fr15,@-r4 ! call saved floating point registers
fmov.s fr14,@-r4
fmov.s fr13,@-r4
fmov.s fr12,@-r4
#endif
mov.l r15,@-r4 ! call saved integer registers
mov.l r14,@-r4
mov.l r13,@-r4
mov.l r12,@-r4
mov.l r11,@-r4
mov.l r10,@-r4
mov.l r9,@-r4
mov.l r8,@-r4
rts
mov #0,r0
#endif /* __SH5__ */
ENTRY(longjmp)
#if __SH5__
ld.q r2, 0*8, r18
ptabs r18, tr0
ld.q r2, 1*8, r10
ld.q r2, 2*8, r11
ld.q r2, 3*8, r12
ld.q r2, 4*8, r13
ld.q r2, 5*8, r14
ld.q r2, 6*8, r15
ld.q r2, 7*8, r28
ld.q r2, 8*8, r29
ld.q r2, 9*8, r30
ld.q r2, 10*8, r31
ld.q r2, 11*8, r32
ld.q r2, 12*8, r33
ld.q r2, 13*8, r34
ld.q r2, 14*8, r35
ld.q r2, 15*8, r44
ld.q r2, 16*8, r45
ld.q r2, 17*8, r46
ld.q r2, 18*8, r47
ld.q r2, 19*8, r48
ld.q r2, 20*8, r49
ld.q r2, 21*8, r50
ld.q r2, 22*8, r51
ld.q r2, 23*8, r52
ld.q r2, 24*8, r53
ld.q r2, 25*8, r54
ld.q r2, 26*8, r55
ld.q r2, 27*8, r56
ld.q r2, 28*8, r57
ld.q r2, 29*8, r58
ld.q r2, 30*8, r59
ld.q r2, 31*8, r5
ld.q r2, 32*8, r6
ld.q r2, 33*8, r7
ptabs r5, tr5
ptabs r6, tr6
ptabs r7, tr7
#if ! __SH4_NOFPU__
fld.d r2, 34*8, dr12
fld.d r2, 35*8, dr14
fld.d r2, 36*8, dr36
fld.d r2, 37*8, dr38
fld.d r2, 38*8, dr40
fld.d r2, 39*8, dr42
fld.d r2, 40*8, dr44
fld.d r2, 41*8, dr46
fld.d r2, 42*8, dr48
fld.d r2, 43*8, dr50
fld.d r2, 44*8, dr52
fld.d r2, 45*8, dr54
fld.d r2, 46*8, dr56
fld.d r2, 47*8, dr58
fld.d r2, 48*8, dr60
fld.d r2, 49*8, dr62
#endif
movi 1, r2
cmvne r3, r3, r2
blink tr0, r63
#else
mov.l @r4+,r8
mov.l @r4+,r9
mov.l @r4+,r10
mov.l @r4+,r11
mov.l @r4+,r12
mov.l @r4+,r13
mov.l @r4+,r14
mov.l @r4+,r15
#if defined (__SH2E__) || defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__)
fmov.s @r4+,fr12 ! call saved floating point registers
fmov.s @r4+,fr13
fmov.s @r4+,fr14
fmov.s @r4+,fr15
#endif
lds.l @r4+,pr
mov r5,r0
tst r0,r0
bf retr4
movt r0
retr4: rts
nop
#endif /* __SH5__ */

225
newlib/libc/machine/sh3eb/strcmp.S

@ -0,0 +1,225 @@
! SH5 code Copyright 2002 SuperH Ltd.
#include "asm.h"
ENTRY(strcmp)
#if __SHMEDIA__
ld.ub r2,0,r4
pt/l quickret0,tr0
ld.ub r3,0,r5
ptabs r18,tr2
beqi/u r4,0,tr0
ld.ub r2,1,r6
bne/u r4,r5,tr0
pt/l quickret1,tr1
ld.ub r3,1,r7
beqi/u r6,0,tr1
ld.ub r2,2,r4
bne/u r6,r7,tr1
ld.ub r3,2,r5
beqi/u r4,0,tr0
ld.ub r2,3,r6
bne/u r4,r5,tr0
ld.ub r3,3,r7
beqi/u r6,0,tr1
ld.ub r2,4,r4
bne/u r6,r7,tr1
ld.ub r3,4,r5
beqi/u r4,0,tr0
ld.ub r2,5,r6
bne/u r4,r5,tr0
ld.ub r3,5,r7
beqi/u r6,0,tr1
ld.ub r2,6,r4
bne/u r6,r7,tr1
ld.ub r3,6,r5
beqi/u r4,0,tr0
ld.ub r2,7,r6
bne/u r4,r5,tr0
ld.ub r3,7,r7
beqi/u r6,0,tr1
sub r3,r2,r3
bne/u r6,r7,tr1
andi r2,-8,r2
add r3,r2,r3
ldlo.q r3,8,r23
pt r23_zero,tr0
shlli r3,3,r22
sub r63,r22,r20
movi 0x101,r6
mperm.w r6,r63,r6
SHLO r6,r22,r7
msubs.ub r7,r23,r8
pt loop,tr1
bnei/u r8,0,tr0 // r23_zero
pt found_zero,tr0
addi r3,15,r3
andi r3,-8,r3
sub r3,r2,r3
bne/l r7,r6,tr1 // loop
/* The strings are aligned to each other. */
/* It is possible to have a loop with six cycles / iteration
by re-ordering the exit conditions, but then it needs extra
time and/or code to sort out the r4 != r5 case. */
pt al_loop,tr1
pt al_found_zero,tr0
al_loop:
ld.q r2,8,r4
ldx.q r2,r3,r5
addi r2,8,r2
mcmpeq.b r63,r4,r8
pt cmp_quad,tr3
bnei/u r8,0,tr0 // al_found_zero
beq/l r4,r5,tr1 // al_loop
blink tr3,r63 // cmp_quad
.balign 8
quickret0:
sub r4,r5,r2
blink tr2,r63
quickret1:
sub r6,r7,r2
blink tr2,r63
loop:
ld.q r2,8,r4
ldx.q r2,r3,r19
addi r2,8,r2
msubs.ub r6,r4,r8
mcmpeq.b r63,r19,r9
SHHI r19,r20,r21
or r21,r23,r5
SHLO r19,r22,r23
bne/u r8,r9,tr0 // found_zero
beq/l r4,r5,tr1 // loop
cmp_quad:
#ifdef __LITTLE_ENDIAN__
byterev r4,r4
byterev r5,r5
#endif
cmpgtu r4,r5,r6
cmpgtu r5,r4,r7
sub r6,r7,r2
blink tr2,r63
found_zero:
pt zero_now,tr0
pt cmp_quad,tr1
SHHI r9,r20,r7
bne/u r8,r7,tr0 // zero_now
bne/u r4,r5,tr1 // cmp_quad
SHLO r9,r22,r8
r23_zero:
ld.q r2,8,r4
add r23,r63,r5
zero_now:
al_found_zero:
/* We konw that one of the values has at lest one zero, and r8 holds
an 0x01 or 0xff mask for every zero found in one of the operands.
If both operands have the first zero in the same place, this mask
allows us to truncate the comparison to the valid bytes in the
strings. If the first zero is in different places, it doesn't
matter if some invalid bytes are included, since the comparison
of the zero with the non-zero will determine the outcome. */
#ifdef __LITTLE_ENDIAN__
shlli r8,8,r8
addi r8,-1,r9
andc r9,r8,r8
and r8,r4,r4
and r8,r5,r5
#else
shlri r8,1,r8
nsb r8,r8
addi r8,8,r8
andi r8,56,r8
sub r63,r8,r8
shlrd r4,r8,r4
shlrd r5,r8,r5
#endif
#ifdef __LITTLE_ENDIAN__
byterev r4,r4
byterev r5,r5
#endif
cmpgtu r4,r5,r6
cmpgtu r5,r4,r7
sub r6,r7,r2
blink tr2,r63
#else /* ! __SHMEDIA__, i.e. SH 1..4 / SHcompact */
#ifdef __SH5__
#define STR1 r2
#define STR2 r3
#define RESULT r2
#define TMP r4
#else
! Entry: r4: string1
! r5: string2
! Exit: r0: result
! r1-r2,r4-r5: clobbered
#define STR1 r4
#define STR2 r5
#define RESULT r0
#define TMP r2
#endif /* __SH5__ */
mov STR1,r0
or STR2,r0
tst #3,r0
bf L_setup_char_loop
mov #0,r0
#ifdef DELAYED_BRANCHES
mov.l @STR1+,r1
.align 2
Longword_loop:
mov.l @STR2+,TMP
cmp/str r0,r1
bt Longword_loop_end
cmp/eq r1,TMP
bt.s Longword_loop
mov.l @STR1+,r1
add #-4, STR1
Longword_loop_end:
add #-4, STR1
add #-4, STR2
L_setup_char_loop:
mov.b @STR1+,r0
.align 2
L_char_loop:
mov.b @STR2+,r1
tst r0,r0
bt L_return
cmp/eq r0,r1
bt.s L_char_loop
mov.b @STR1+,r0
add #-2,STR1
mov.b @STR1,r0
#else /* ! DELAYED_BRANCHES */
.align 2
Longword_loop:
mov.l @r4+,r1
mov.l @r5+,r2
cmp/str r0,r1
bt Longword_loop_end
cmp/eq r1,r2
bt Longword_loop
Longword_loop_end:
add #-4, r4
add #-4, r5
.align 2
L_setup_char_loop:
L_char_loop:
mov.b @r4+,r0
mov.b @r5+,r1
tst r0,r0
bt L_return
cmp/eq r0,r1
bt L_char_loop
#endif
L_return:
extu.b r0,RESULT
extu.b r1,r1
rts
sub r1,RESULT
#endif /* ! __SHMEDIA__ */

134
newlib/libc/machine/sh3eb/strcpy.S

@ -0,0 +1,134 @@
! Entry: arg0: destination
! arg1: source
! Exit: result: destination
!
! SH5 code Copyright 2002 SuperH Ltd.
#include "asm.h"
ENTRY(strcpy)
#if __SHMEDIA__
pta/l shortstring,tr1
ldlo.q r3,0,r4
ptabs r18,tr4
shlli r3,3,r7
addi r2, 8, r0
mcmpeq.b r4,r63,r6
SHHI r6,r7,r6
bnei/u r6,0,tr1 // shortstring
pta/l no_lddst, tr2
ori r3,-8,r23
sub r2, r23, r0
sub r3, r2, r21