From 8a0efa53e44919bcf5ccb1d3353618a82afdf8bc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 17 Feb 2000 19:39:52 +0000 Subject: import newlib-2000-02-17 snapshot --- newlib/libc/machine/hppa/DEFS.h | 160 ++++ newlib/libc/machine/hppa/Makefile.am | 14 + newlib/libc/machine/hppa/Makefile.in | 300 ++++++ newlib/libc/machine/hppa/aclocal.m4 | 282 ++++++ newlib/libc/machine/hppa/configure | 1687 +++++++++++++++++++++++++++++++++ newlib/libc/machine/hppa/configure.in | 12 + newlib/libc/machine/hppa/memchr.S | 48 + newlib/libc/machine/hppa/memcmp.S | 183 ++++ newlib/libc/machine/hppa/memcpy.S | 146 +++ newlib/libc/machine/hppa/memset.S | 85 ++ newlib/libc/machine/hppa/pcc_prefix.s | 389 ++++++++ newlib/libc/machine/hppa/setjmp.S | 139 +++ newlib/libc/machine/hppa/strcat.S | 178 ++++ newlib/libc/machine/hppa/strcmp.S | 282 ++++++ newlib/libc/machine/hppa/strcpy.S | 285 ++++++ newlib/libc/machine/hppa/strlen.S | 79 ++ newlib/libc/machine/hppa/strncat.S | 238 +++++ newlib/libc/machine/hppa/strncmp.S | 189 ++++ newlib/libc/machine/hppa/strncpy.S | 256 +++++ 19 files changed, 4952 insertions(+) create mode 100644 newlib/libc/machine/hppa/DEFS.h create mode 100644 newlib/libc/machine/hppa/Makefile.am create mode 100644 newlib/libc/machine/hppa/Makefile.in create mode 100644 newlib/libc/machine/hppa/aclocal.m4 create mode 100755 newlib/libc/machine/hppa/configure create mode 100644 newlib/libc/machine/hppa/configure.in create mode 100644 newlib/libc/machine/hppa/memchr.S create mode 100644 newlib/libc/machine/hppa/memcmp.S create mode 100644 newlib/libc/machine/hppa/memcpy.S create mode 100644 newlib/libc/machine/hppa/memset.S create mode 100644 newlib/libc/machine/hppa/pcc_prefix.s create mode 100644 newlib/libc/machine/hppa/setjmp.S create mode 100644 newlib/libc/machine/hppa/strcat.S create mode 100644 newlib/libc/machine/hppa/strcmp.S create mode 100644 newlib/libc/machine/hppa/strcpy.S create mode 100644 newlib/libc/machine/hppa/strlen.S create mode 100644 newlib/libc/machine/hppa/strncat.S create mode 100644 newlib/libc/machine/hppa/strncmp.S create mode 100644 newlib/libc/machine/hppa/strncpy.S (limited to 'newlib/libc/machine/hppa') diff --git a/newlib/libc/machine/hppa/DEFS.h b/newlib/libc/machine/hppa/DEFS.h new file mode 100644 index 000000000..9c0aa1e06 --- /dev/null +++ b/newlib/libc/machine/hppa/DEFS.h @@ -0,0 +1,160 @@ +/* + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "pcc_prefix.s" + +#define BLANK +#define BANNER(str) BLANK .VERSION str +#define ENTRY(Name) BLANK M_ENTRY (Name,PROF_/**/Name) +#define ENTRYC(Name) BLANK M_ENTRYC(Name,PROF_/**/Name) +#define EXIT(Name) BLANK M_EXIT (Name,PROF_/**/Name) +#define EXITC(Name) BLANK M_EXITC (Name,PROF_/**/Name) + +#ifdef PROF + +; +; All four argument registers are saved into caller save registers +; and restored after the call to _mcount. This is possible because +; the mcount routine does not modify them, so we can. Mcount takes +; 3 arguments; the first argument is the incoming 'rp', the second +; is the starting address of the profiled routine, and the third is +; the address of the PROF label (which is where mcount stores the +; profile data). +; +#define M_ENTRY(name,prof) \ + .SPACE $TEXT$ !\ + .SUBSPA $CODE$ !\ + .label name !\ + .PROC !\ + .CALLINFO CALLER,SAVE_RP !\ + .ENTRY !\ + stw rp,-20(sp) !\ + ldo 48(sp),sp !\ + or arg0,r0,r19 !\ + or arg1,r0,r20 !\ + or arg2,r0,r21 !\ + or arg3,r0,r22 !\ + or rp,r0,arg0 !\ + ldil L%name,r1 !\ + ldo R%name(r1),arg1 !\ + addil L%prof-$global$,dp !\ + bl _mcount,rp !\ + ldo R%prof-$global$(r1),arg2 !\ + ldw -68(sp),rp !\ + ldo -48(sp),sp !\ + or r19,r0,arg0 !\ + or r20,r0,arg1 !\ + or r21,r0,arg2 !\ + or r22,r0,arg3 !\ + + +#define M_ENTRYC(name,prof) \ + .SPACE $TEXT$ !\ + .SUBSPA $CODE$ !\ + .label name !\ + .PROC !\ + .CALLINFO CALLER,SAVE_RP !\ + .ENTRY !\ + stw rp,-20(sp) !\ + ldo 128(sp),sp !\ + or arg0,r0,r19 !\ + or arg1,r0,r20 !\ + or arg2,r0,r21 !\ + or arg3,r0,r22 !\ + or rp,r0,arg0 !\ + ldil L%name,r1 !\ + ldo R%name(r1),arg1 !\ + addil L%prof-$global$,dp !\ + bl _mcount,rp !\ + ldo R%prof-$global$(r1),arg2 !\ + ldw -148(sp),rp !\ + or r19,r0,arg0 !\ + or r20,r0,arg1 !\ + or r21,r0,arg2 !\ + or r22,r0,arg3 !\ + +; +; The HPUX profiler uses a word for each entrypoint to store the profiling +; information. The setup code passes the address to the _mcount routine. +; The EXIT macro defines a label (PROF_foo), and a word of storage. +; +#define M_EXIT(name,prof) \ + bv,n r0(rp) !\ + .EXIT !\ + .PROCEND !\ + .EXPORT name,ENTRY !\ + .SPACE $PRIVATE$ !\ + .SUBSPA $DATA$ !\ + .label prof !\ + .WORD 0 !\ + .IMPORT $global$,DATA !\ + .IMPORT _mcount,CODE + +#define M_EXITC(name,prof) \ + bv r0(rp) !\ + ldo -128(sp),sp !\ + .EXIT !\ + .PROCEND !\ + .EXPORT name,ENTRY !\ + .SPACE $PRIVATE$ !\ + .SUBSPA $DATA$ !\ + .label prof !\ + .WORD 0 !\ + .IMPORT $global$,DATA !\ + .IMPORT _mcount,CODE + +#else /* NOT profiling */ + +#define M_ENTRY(name,prof) \ + .SPACE $TEXT$ !\ + .SUBSPA $CODE$ !\ + .label name !\ + .PROC !\ + .CALLINFO !\ + .ENTRY + +#define M_ENTRYC(name,prof) \ + .SPACE $TEXT$ !\ + .SUBSPA $CODE$ !\ + .label name !\ + .PROC !\ + .CALLINFO CALLER,SAVE_RP !\ + .ENTRY !\ + stw rp,-20(sp) !\ + ldo 128(sp),sp + +#define M_EXIT(name,prof) \ + bv,n r0(rp) !\ + .EXIT !\ + .PROCEND !\ + .EXPORT name,ENTRY + +#define M_EXITC(name,prof) \ + ldw -148(sp),rp !\ + bv r0(rp) !\ + ldo -128(sp),sp !\ + .EXIT !\ + .PROCEND !\ + .EXPORT name,ENTRY + +#define ENTRY(Name) BLANK M_ENTRY (Name,PROF_/**/Name) +#define ENTRYC(Name) BLANK M_ENTRYC(Name,PROF_/**/Name) +#define EXIT(Name) BLANK M_EXIT (Name,PROF_/**/Name) +#define EXITC(Name) BLANK M_EXITC (Name,PROF_/**/Name) + + +#endif diff --git a/newlib/libc/machine/hppa/Makefile.am b/newlib/libc/machine/hppa/Makefile.am new file mode 100644 index 000000000..413cd722a --- /dev/null +++ b/newlib/libc/machine/hppa/Makefile.am @@ -0,0 +1,14 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +noinst_LIBRARIES = lib.a + +lib_a_SOURCES = \ + memchr.S memcmp.S memcpy.S memset.S setjmp.S strcat.S strcmp.S \ + strcpy.S strlen.S strncat.S strncmp.S strncpy.S + +ACLOCAL_AMFLAGS = -I ../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/machine/hppa/Makefile.in b/newlib/libc/machine/hppa/Makefile.in new file mode 100644 index 000000000..7fa027195 --- /dev/null +++ b/newlib/libc/machine/hppa/Makefile.in @@ -0,0 +1,300 @@ +# Makefile.in generated automatically by automake 1.3 from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997, 1998 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. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DISTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AR = @AR@ +AS = @AS@ +CC = @CC@ +CPP = @CPP@ +EXEEXT = @EXEEXT@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +machine_dir = @machine_dir@ +newlib_basedir = @newlib_basedir@ +sys_dir = @sys_dir@ + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +noinst_LIBRARIES = lib.a + +lib_a_SOURCES = \ + memchr.S memcmp.S memcpy.S memset.S setjmp.S strcat.S strcmp.S \ + strcpy.S strlen.S strncat.S strncmp.S strncpy.S + +ACLOCAL_AMFLAGS = -I ../../.. +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +lib_a_LIBADD = +lib_a_OBJECTS = memchr.o memcmp.o memcpy.o memset.o setjmp.o strcat.o \ +strcmp.o strcpy.o strlen.o strncat.o strncmp.o strncpy.o +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +SOURCES = $(lib_a_SOURCES) +OBJECTS = $(lib_a_OBJECTS) + +all: Makefile $(LIBRARIES) + +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINT@ configure.in ../../../acinclude.m4 \ + ../../../aclocal.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-noinstLIBRARIES: + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +distclean-noinstLIBRARIES: + +maintainer-clean-noinstLIBRARIES: + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @echo "========================"; \ + echo "$(distdir).tar.gz is ready for distribution"; \ + echo "========================" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +info: +dvi: +check: + $(MAKE) $(AM_MAKEFLAGS) +installcheck: +install-info: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + + +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic + +clean: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ + mostlyclean + +distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ + distclean-generic clean + -rm -f config.status + +maintainer-clean: maintainer-clean-noinstLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + -rm -f config.status + +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi installcheck \ +install-info install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# 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: diff --git a/newlib/libc/machine/hppa/aclocal.m4 b/newlib/libc/machine/hppa/aclocal.m4 new file mode 100644 index 000000000..70d481020 --- /dev/null +++ b/newlib/libc/machine/hppa/aclocal.m4 @@ -0,0 +1,282 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl This provides configure definitions used by all the newlib +dnl configure.in files. + +dnl Basic newlib configury. This calls basic introductory stuff, +dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs +dnl configure.host. The only argument is the relative path to the top +dnl newlib directory. + +AC_DEFUN(NEWLIB_CONFIGURE, +[ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes])dnl + +dnl Support --enable-target-optspace +AC_ARG_ENABLE(target-optspace, +[ --enable-target-optspace optimize for space], +[case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;; + esac], [target_optspace=])dnl + +dnl Support --enable-newlib-mb +AC_ARG_ENABLE(newlib-mb, +[ --enable-newlib-mb enable multibyte support], +[case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;; + esac], [newlib_mb=no])dnl + +dnl We may get other options which we don't document: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +test -z "[$]{with_target_subdir}" && with_target_subdir=. + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" + else + newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" + fi +else + newlib_basedir="[$]{srcdir}/$1" +fi +AC_SUBST(newlib_basedir) + +AC_CANONICAL_HOST + +AM_INIT_AUTOMAKE(newlib, 1.8.1) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't +# run it explicitly here, it will be run implicitly before +# NEWLIB_CONFIGURE, which doesn't work because that means that it will +# be run before AC_CANONICAL_HOST. +AC_CANONICAL_BUILD + +AC_CHECK_TOOL(AS, as) +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +AC_PROG_INSTALL + +AM_MAINTAINER_MODE + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + AC_EXEEXT +fi + +. [$]{newlib_basedir}/configure.host + +case [$]{newlib_basedir} in +/* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;; +*) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;; +esac + +newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include" +case "${host}" in + *-*-cygwin*) + newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/cygwin/include -I[$]{newlib_flagbasedir}/../winsup/w32api/include" + ;; +esac + +newlib_cflags="[$]{newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} +AC_SUBST(NEWLIB_CFLAGS) + +AC_SUBST(machine_dir) +AC_SUBST(sys_dir) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/newlib/libc/machine/hppa/configure b/newlib/libc/machine/hppa/configure new file mode 100755 index 000000000..5377ef3aa --- /dev/null +++ b/newlib/libc/machine/hppa/configure @@ -0,0 +1,1687 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-multilib build many library versions (default)" +ac_help="$ac_help + --enable-target-optspace optimize for space" +ac_help="$ac_help + --enable-newlib-mb enable multibyte support" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=memchr.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../../../.. $srcdir/../../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:578: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:631: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:688: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:721: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:754: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# Check whether --enable-multilib or --disable-multilib was given. +if test "${enable_multilib+set}" = set; then + enableval="$enable_multilib" + case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;; + esac +else + multilib=yes +fi + +# Check whether --enable-target-optspace or --disable-target-optspace was given. +if test "${enable_target_optspace+set}" = set; then + enableval="$enable_target_optspace" + case "${enableval}" in + yes) target_optspace=yes ;; + no) target_optspace=no ;; + *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;; + esac +else + target_optspace= +fi + +# Check whether --enable-newlib-mb or --disable-newlib-mb was given. +if test "${enable_newlib_mb+set}" = set; then + enableval="$enable_newlib_mb" + case "${enableval}" in + yes) newlib_mb=yes ;; + no) newlib_mb=no ;; + *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;; + esac +else + newlib_mb=no +fi + + +test -z "${with_target_subdir}" && with_target_subdir=. + +if test "${srcdir}" = "."; then + if test "${with_target_subdir}" != "."; then + newlib_basedir="${srcdir}/${with_multisrctop}../../../.." + else + newlib_basedir="${srcdir}/${with_multisrctop}../../.." + fi +else + newlib_basedir="${srcdir}/../../.." +fi + + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:840: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + + +PACKAGE=newlib + +VERSION=1.8.1 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:881: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:894: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:907: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:920: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:933: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:958: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:988: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1037: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1061: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't +# run it explicitly here, it will be run implicitly before +# NEWLIB_CONFIGURE, which doesn't work because that means that it will +# be run before AC_CANONICAL_HOST. +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:1094: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + + +# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1115: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="${ac_tool_prefix}as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1147: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1179: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1211: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1256: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1310: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +# We need AC_EXEEXT to keep automake happy in cygnus mode. However, +# at least currently, we never actually build a program, so we never +# need to use $(EXEEXT). Moreover, the test for EXEEXT normally +# fails, because we are probably configuring with a cross compiler +# which can't create executables. So we include AC_EXEEXT to keep +# automake happy, but we don't execute it, since we don't care about +# the result. +if false; then + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1344: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +fi + +. ${newlib_basedir}/configure.host + +case ${newlib_basedir} in +/* | A-Za-z:/\\*) newlib_flagbasedir=${newlib_basedir} ;; +*) newlib_flagbasedir='$(top_builddir)/'${newlib_basedir} ;; +esac + +newlib_cflags="${newlib_cflags} -I"'$(top_builddir)'"/../../../targ-include -I${newlib_flagbasedir}/libc/include" +case "${host}" in + *-*-cygwin*) + newlib_cflags="${newlib_cflags} -I${newlib_flagbasedir}/../winsup/cygwin/include -I${newlib_flagbasedir}/../winsup/w32api/include" + ;; +esac + +newlib_cflags="${newlib_cflags} -fno-builtin" + +NEWLIB_CFLAGS=${newlib_cflags} + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@newlib_basedir@%$newlib_basedir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@EXEEXT@%$EXEEXT%g +s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g +s%@machine_dir@%$machine_dir%g +s%@sys_dir@%$sys_dir%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/newlib/libc/machine/hppa/configure.in b/newlib/libc/machine/hppa/configure.in new file mode 100644 index 000000000..59ec18d3a --- /dev/null +++ b/newlib/libc/machine/hppa/configure.in @@ -0,0 +1,12 @@ +dnl This is the newlib/libc/machine/hppa configure.in file. +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(memchr.S) + +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. +AC_CONFIG_AUX_DIR(../../../..) + +NEWLIB_CONFIGURE(../../..) + +AC_OUTPUT(Makefile) diff --git a/newlib/libc/machine/hppa/memchr.S b/newlib/libc/machine/hppa/memchr.S new file mode 100644 index 000000000..1cca3e5e8 --- /dev/null +++ b/newlib/libc/machine/hppa/memchr.S @@ -0,0 +1,48 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* SPECTRUM_ID: @(#)memchr.s 37.4 86/04/23 */ +/* + * memchr(s, c, n) + * + * returns pointer to first occurrence of char c + * in first n characters of memory area s, + * or null if c does not occur. + */ + +#include "DEFS.h" + +#define FROM arg0 +#define CHAR arg1 +#define COUNT arg2 +#define TEMP1 r19 + +ENTRY(memchr) + comb,<= COUNT,r0,memchrexit /* return if count is zero */ + copy r0,ret0 /* null if c not found in n chars */ + depi 0,23,24,CHAR /* make char unsigned */ + + ldbs,ma 1(FROM),TEMP1 +memchrloop: + comb,=,n TEMP1,CHAR,memchrequal + addib,<> -1,COUNT,memchrloop + ldbs,ma 1(FROM),TEMP1 + b,n memchrexit + +memchrequal: + ldo -1(FROM),ret0 + +memchrexit: +EXIT(memchr) diff --git a/newlib/libc/machine/hppa/memcmp.S b/newlib/libc/machine/hppa/memcmp.S new file mode 100644 index 000000000..babb20761 --- /dev/null +++ b/newlib/libc/machine/hppa/memcmp.S @@ -0,0 +1,183 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* memcmp(s1, s2, n) */ +/* returns integer: < 0 iff s1 lexicographically less than s2 */ +/* > 0 iff s1 lexicographically greater than s2 */ +/* = 0 iff s1 lexicographically equal to s2 */ +/* = 0 iff s1 lexicographically equal to s2 */ +/* quit after n charachters */ +#ifndef _NAMESPACE_CLEAN +#define NOSECDEF /* prevents _memcmp from becoming primary entry */ +#endif + +#include "DEFS.h" + +#define s1 26 +#define s2 25 +#define tmp1 19 +#define s2word 20 +#define tmp3 21 +#define tmp7 22 +#define s1word 29 +#define save 1 +#define tmp6 23 +#define tmp5 28 +#define count 24 + +ENTRY(memcmp) + combt,<,n r0,count,search /*N <= 0 yields equality */ + b done /**/ + copy 0,ret0 /*return 0 (DELAY SLOT) */ +search: combf,=,n s1,s2,findout /*s1 != s2? */ + b done + copy 0,ret0 /*return 0 (delay slot) */ +findout: + comibf,=,n 0,s1,checks1 /*s1 == NULL? */ + ldbs 0(0,s2),ret0 /**/ + b done /*quit */ + sub 0,ret0,ret0 /*ret0 <- -*s2 */ +checks1: + comibf,=,n 0,s2,checkitout /*s2 == NULL? */ + b done /* quit */ + ldbs 0(0,s1),28 /* return *s1 */ + +checkitout: + extru s2,31,2,tmp1 /* Extract the low two bits of the s2. */ + extru s1,31,2,tmp5 /* Extract the low two bits of the s1 */ + sub,= tmp5,tmp1,tmp3 /* Are s1 & s2 aligned with each other? */ + b not_aligned /* It's more complicated (not_aligned) */ + dep 0,31,2,s1 /* Compute word address of s1 (DELAY SLOT) */ + dep 0,31,2,s2 /* Compute word address of s2 */ + ldwm 4(0,s1),s1word /* get next s1 word s1+=4 */ + combt,= tmp5,r0,skipmask /* skip masking, if we can */ + ldwm 4(0,s2),s2word /* get next s2 word s2+=4 (DELAY SLOT) */ + add tmp5,count,count /* bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word /* mask s1word (s1) */ + or save,s2word,s2word /* mask s2word (s2) */ + + +skipmask: + combt,=,n s1word,s2word,checkN /* We may be done */ + +checkbyte: + extru s1word,7,8,tmp3 /* get first byte (character) */ +ckbyte2: extru s2word,7,8,tmp7 /* get first byte (character) */ + combf,= tmp3,tmp7,done /* quit if first byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + addibt,<=,n -1,count,done /* have we checked N chars? ret0 == 0 */ + extru s1word,15,8,tmp3 /* get second byte (character) */ + extru s2word,15,8,tmp7 /* get second byte (character) */ + combf,= tmp3,tmp7,done /* quit if second byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + addibt,<=,n -1,count,done /* have we checked N chars? */ + extru s1word,23,8,tmp3 /* get third byte (character) */ + extru s2word,23,8,tmp7 /* get third byte (character) */ + combf,= tmp3,tmp7,done /* done if third byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + addibt,<=,n -1,count,done /* have we checked N chars? */ + extru s1word,31,8,tmp3 /* get last byte (character) */ + extru s2word,31,8,tmp7 /* get last byte (character) */ + b done /* if we reach this point we know that */ + sub tmp3,tmp7,ret0 /* the last character in the word is */ + /* where the difference is, so return */ + /* the difference and we're outta here */ + + +checkN: + addibt,<=,n -4,count,zero /* have we checked N chars? */ + ldwm 4(0,s2),s2word /* get next s2 word s2+=4 */ + b skipmask /* keep checking */ + ldwm 4(0,s1),s1word /* get next s1 word s1+=4 */ + + +not_aligned: + dep r0,31,2,s2 /* Compute word address of s2 */ + combt,<,n r0,tmp3,shifts1 /* Do we shift s1 or s2 */ + sh3add tmp3,r0,tmp3 /* eight bits per byte so mul by 8 */ + ldwm 4(0,s1),s1word /* get first word of s1 */ + ldwm 4(0,s2),s2word /* get first word or s2 */ + combt,=,n r0,tmp5,masks2 /* Do we need to mask beginning of s1 */ + add tmp5,count,count /* bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word /**/ +masks2: sh3add tmp1,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s2word,s2word /**/ + subi 4,tmp1,tmp1 /* tmp1 now has the number of byte that */ + /* are valid in s2word before the vshd */ + mtctl tmp3,11 /* Move shift amount to CR11 */ +more: combt,<=,n count,tmp1,chunk1 /* Can we do the vshd? */ + ldwm 4(0,s2),tmp7 /* load second word to enable us to shift */ + vshd s2word,tmp7,s2word /**/ + combf,=,n s1word,s2word,ckbyte2 /**/ + extru s1word,7,8,tmp3 /* get first byte (DELAY SLOT) */ + addibt,<=,n -4,count,zero /* have we checked N chars? */ + copy tmp7,s2word /**/ + b more /* keep checking */ + ldwm 4(0,s1),s1word /* get next s1 (DELAY SLOT) */ + +chunk1: + vshd s2word,r0,s2word /* do an arithmetic shift left to position data */ + b ckbyte2 /**/ + extru s1word,7,8,tmp3 /**/ + + +shifts1: + sh3add tmp3,r0,tmp3 /* eight bits per byte so mul by 8 */ + sub r0,tmp3,tmp3 /* Get negative value for left shift */ + dep r0,31,2,s2 /* Compute word address of s2 */ + ldwm 4(0,s2),s2word /* get first word of s2 */ + ldwm 4(0,s1),s1word /* get first word or s1 */ + combt,=,n r0,tmp1,masks1 /*Do we need to mask beginning of s2 */ + add tmp1,count,count /*bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp1,r0,save /*save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /*load save with proper mask */ + or save,s2word,s2word /**/ +masks1: sh3add tmp5,r0,save /*save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /*load save with proper mask */ + or save,s1word,s1word /**/ + subi 4,tmp5,tmp5 /*tmp5 now has the number of byte that */ + /*are valid in s1word before the vshd */ + mtctl tmp3,11 /*Move shift amount to CR11 */ +more1: combt,<=,n count,tmp5,chunk2 /*Can we do the vshd? */ + ldwm 4(0,s1),tmp7 /*load second word to enable us to shift */ + vshd s1word,tmp7,s1word /**/ + combf,=,n s2word,s1word,ckbyte2 /**/ + extru s1word,7,8,tmp3 /*get first byte (DELAY SLOT) */ + addibt,<=,n -4,count,zero /*have we checked N chars? */ + copy tmp7,s1word /**/ + b more1 /*keep checking */ + ldwm 4(0,s2),s2word /*get next s2 (DELAY SLOT) */ + +chunk2: + vshd s1word,r0,s1word /**/ + b ckbyte2 /**/ + extru s1word,7,8,tmp3 /**/ + +zero: copy r0,ret0 +done: +EXIT(memcmp) diff --git a/newlib/libc/machine/hppa/memcpy.S b/newlib/libc/machine/hppa/memcpy.S new file mode 100644 index 000000000..713c1c11b --- /dev/null +++ b/newlib/libc/machine/hppa/memcpy.S @@ -0,0 +1,146 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* HPUX_ID: @(#) $Revision$ */ +/* + * memcpy(s1, s2, n) + * + * Copy n characters from s2 to s1; returns s1. + */ + +#define d_addr arg0 +#define s_addr arg1 +#define count arg2 +#define tmp5 arg3 +#define tmp1 r19 +#define tmp2 r20 +#define tmp3 r21 +#define tmp4 r22 +#define tmp6 r31 + +#include "DEFS.h" + +ENTRY(memcpy) + comib,>= 5,count,byteloop /* If count is <= 6 don't get fancy.*/ + movb,=,n d_addr,ret0,done /* The return value is defined to be the value of d_addr. DELAY SLOT */ + /* if d_addr is null then exit */ + extru s_addr,31,2,tmp1 /* Extract the low two bits of the source address. */ + extru d_addr,31,2,tmp2 /* Extract the low two bits of the destination address. */ + add count,tmp2,count /* pre increment the count to adjust for alignment of s1 */ + comb,<> tmp2,tmp1,not_aligned /* see if s1 is aligned w.r.t. s2. */ + dep 0,31,2,s_addr /* Compute the word address of the source. DELAY SLOT. */ + +/* aligned */ + +/* We will now begin the 16 byte at a time word move if count >= 16 ! */ +/* Else we will branch to the 4 byte-at-a time word move ! */ + + addibt,<,n -16,count,chekchunk /* If count < 16 then we can't move 16 byte chunks ! */ + /* actually we can legally move 13 or more bytes on the first loop. */ + /* These loads and stores are done so as to prevent processor interlock. */ +chunks: + ldwm 16(0,s_addr),tmp1 /* tmp1 = *s_addr s_addr += 16 */ + ldw -12(0,s_addr),tmp2 /* tmp2 = 2nd word */ + ldw -8(0,s_addr),tmp3 /* tmp3 = 3rd word */ + ldw -4(0,s_addr),tmp4 /* tmp4 = 4th word */ + /* Now store the results ! */ + stbys,b,m tmp1,4(0,d_addr) /* tmp1 = 1st word stored d_addr += 16 also take care of front porch. */ + stwm tmp2,4(0,d_addr) /* tmp2 = 2nd word stored. */ + stwm tmp3,4(0,d_addr) /* tmp3 = 3rd word stored. */ + addibf,< -16,count,chunks /* If count is still >= 16 do another loop. */ + stwm tmp4,4(0,d_addr) /* tmp4 = 4th word stored. DELAY SLOT */ + +chekchunk: + addibt,<,n 12,count,back_porch /* since the count is already decremented by -16 we're testing */ + /* to see if there are at least 4 bytes left ? */ +subchunk: + ldws,ma 4(s_addr),tmp1 /* tmp1 = *s_addr++ */ + addibf,< -4,count,subchunk /* count -= 4 */ + stbys,b,m tmp1,4(d_addr) /* *d_addr++ = tmp1 */ + + +back_porch: + addibt,=,n 4,count,done /* if count = 0 we're, of course, done ! */ + ldws 0(s_addr),tmp1 /* load up the back_porch */ + add d_addr,count,d_addr/* final store address is +1 too high ! */ + bv 0(r2) /* return--were done. */ + stbys,e tmp1,0(d_addr) /* kerplunk! whew ! */ + +/* Begin non_aligned code. (no refrence to politics) */ +not_aligned: + sub,>= tmp2,tmp1,tmp3 /* compute the shift quantity again and skip the load if tmp2 > tmp1. */ + ldwm 4(0,s_addr),tmp1 /* load up the first word from the source. tmp1 = *s_addr++ */ + zdep tmp3,28,29,tmp4 /* compute the number of bits to shift based on the number of bytes above. */ + mtctl tmp4,11 /* load the shift count into cr11 = shift count register. */ + + addibt,<,n -16,count,chkchnk2 /* first step in pre adjustment of count for looping. */ + +chunk2: + ldwm 16(0,s_addr),tmp2 /* get either first or second word . tmp2 = *s_addr++ */ + ldw -12(s_addr),tmp3 + ldw -8(s_addr),tmp4 + ldw -4(s_addr),tmp5 + vshd tmp1,tmp2,tmp6 /* position data ! */ + stbys,b,m tmp6,4(0,d_addr) /* store ! */ + + vshd tmp2,tmp3,tmp6 /* position data ! */ + stwm tmp6,4(0,d_addr) /* store ! */ + + vshd tmp3,tmp4,tmp6 /* position data ! */ + stwm tmp6,4(0,d_addr) /* store ! */ + + vshd tmp4,tmp5,tmp6 /* position data ! */ + stwm tmp6,4(0,d_addr) /* store the data ! */ + addibf,< -16,count,chunk2 /* If count is still >= 16 do another loop. */ + copy tmp5,tmp1 + + +chkchnk2: + addibt,<,n 12,count,bp_0 /* if we don't have 4 bytes left then do the back porch (bp_0) */ + +subchnk2: + ldwm 4(0,s_addr),tmp2 /* get next word ! */ + vshd tmp1,tmp2,tmp3 /* position data ! */ + addibt,< -4,count,bp_1 /* decrement count and when count < 4 goto back_porch (bp_1) */ + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + + ldwm 4(0,s_addr),tmp1 /* get 4th word ! */ + vshd tmp2,tmp1,tmp3 /* position data ! */ + addib,>= -4,count,subchnk2 /* decrement count and when count <= 4 go to back porch (bp_2) */ + stbys,b,m tmp3,4(0,d_addr) /* store the data ! */ + +bp_0: copy tmp1,tmp2 /* switch registers used in the shift process. */ +bp_1: addibt,<=,n 4,count,done /* if count = -4 this implies that count = 0 -> done */ + add d_addr,count,d_addr /* bump destination address to be +1 too high ! */ + mfctl sar,tmp3 /* suppress final ldwm unless result used */ + extru tmp3,28,2,tmp3 /* convert bitshift to byteshift */ + sub,<= count,tmp3,r0 /* bytes unused if (count-byteshift <= 0*/ + + ldwm 4(0,s_addr),tmp1 /* get final word ! */ + vshd tmp2,tmp1,tmp3 /* position data ! */ + bv 0(r2) /* return */ + stbys,e tmp3,0(0,d_addr) /* store the data ! */ + +/* here we do ye old byte-at-a-time moves. */ +byteloop: + comb,>=,n 0,count,done + +encore: + ldbs,ma 1(s_addr),tmp1 + addibf,= -1,count,encore + stbs,ma tmp1,1(d_addr) + +done: +EXIT(memcpy) diff --git a/newlib/libc/machine/hppa/memset.S b/newlib/libc/machine/hppa/memset.S new file mode 100644 index 000000000..cea738251 --- /dev/null +++ b/newlib/libc/machine/hppa/memset.S @@ -0,0 +1,85 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* SPECTRUM_ID: @(#)memset.s 37.4 86/08/25 */ +/* + * memset(s, c, n) + * + * Sets first n chars in memory area s to value of character c. + * Returns s. + */ +#ifndef _NAMESPACE_CLEAN +#define NOSECDEF /* prevent _memset from being defined as entry */ +#endif + +#include "DEFS.h" + +#define TO arg0 +#define FILLCHAR arg1 +#define COUNT arg2 +#define TMP r31 + +ENTRY(memset) + comb,<= COUNT,r0,msexit /* return if count not positive */ + copy TO,ret0 /* return value is start of copy */ + comibf,<,n 5,COUNT,msbyteloop /* be straightforward */ + + dep FILLCHAR,23,8,FILLCHAR /* dup low byte */ + dep FILLCHAR,15,16,FILLCHAR /* into high bytes */ + + add TO,COUNT,TMP /* TMP points just past fill area */ + stbys,m FILLCHAR,0(TO) /* fill out first word */ + /* + * If we're pointing to high-order byte, no fill will happen, + * but permissions will be checked. We don't want this (we + * might be pointing at the beginning of a protected region), + * so we branch around stbys if neither low bits are set. + */ + bb,<,n TMP,31,filend /* if low bit is set, stbys */ + bb,>=,n TMP,30,endfil /* if next lowest bit isn't set */ + /* (and lowest isn't, either) */ + /* do not stbys */ +filend: + stbys,m,e FILLCHAR,0(TMP) /* fill out the last */ +endfil: + addi 4, TO, TO + sub TMP,TO,COUNT /* will now divide by 4 */ + comb,=,n COUNT,r0,msexit /* If count is zero ret. */ + + extru,<> COUNT,31,4,r1 + b msquadloop + depi 0,31,4,COUNT /* will now divide by 16 */ + + +mswordloop: + addib,<> -4,r1,mswordloop + stws,ma FILLCHAR,4(TO) + + comb,=,n COUNT,r0,msexit /* If count is zero ret. */ + +msquadloop: + stws,ma FILLCHAR,4(TO) + stws,ma FILLCHAR,4(TO) + stws,ma FILLCHAR,4(TO) + addib,<> -16,COUNT,msquadloop + stws,ma FILLCHAR,4(TO) + b,n msexit + +msbyteloop: + addib,<> -1,COUNT,msbyteloop + stbs,ma FILLCHAR,1(TO) + +msexit: +EXIT(memset) diff --git a/newlib/libc/machine/hppa/pcc_prefix.s b/newlib/libc/machine/hppa/pcc_prefix.s new file mode 100644 index 000000000..24d5254d9 --- /dev/null +++ b/newlib/libc/machine/hppa/pcc_prefix.s @@ -0,0 +1,389 @@ +; +; (c) Copyright 1986 HEWLETT-PACKARD COMPANY +; +; To anyone who acknowledges that this file is provided "AS IS" +; without any express or implied warranty: +; permission to use, copy, modify, and distribute this file +; for any purpose is hereby granted without fee, provided that +; the above copyright notice and this notice appears in all +; copies, and that the name of Hewlett-Packard Company not be +; used in advertising or publicity pertaining to distribution +; of the software without specific, written prior permission. +; Hewlett-Packard Company makes no representations about the +; suitability of this software for any purpose. +; + +; Standard Hardware Register Definitions for Use with Assembler +; version A.08.06 +; - fr16-31 added at Utah +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Hardware General Registers +r0: .equ 0 + +r1: .equ 1 + +r2: .equ 2 + +r3: .equ 3 + +r4: .equ 4 + +r5: .equ 5 + +r6: .equ 6 + +r7: .equ 7 + +r8: .equ 8 + +r9: .equ 9 + +r10: .equ 10 + +r11: .equ 11 + +r12: .equ 12 + +r13: .equ 13 + +r14: .equ 14 + +r15: .equ 15 + +r16: .equ 16 + +r17: .equ 17 + +r18: .equ 18 + +r19: .equ 19 + +r20: .equ 20 + +r21: .equ 21 + +r22: .equ 22 + +r23: .equ 23 + +r24: .equ 24 + +r25: .equ 25 + +r26: .equ 26 + +r27: .equ 27 + +r28: .equ 28 + +r29: .equ 29 + +r30: .equ 30 + +r31: .equ 31 + +; Hardware Space Registers +sr0: .equ 0 + +sr1: .equ 1 + +sr2: .equ 2 + +sr3: .equ 3 + +sr4: .equ 4 + +sr5: .equ 5 + +sr6: .equ 6 + +sr7: .equ 7 + +; Hardware Floating Point Registers +fr0: .equ 0 + +fr1: .equ 1 + +fr2: .equ 2 + +fr3: .equ 3 + +fr4: .equ 4 + +fr5: .equ 5 + +fr6: .equ 6 + +fr7: .equ 7 + +fr8: .equ 8 + +fr9: .equ 9 + +fr10: .equ 10 + +fr11: .equ 11 + +fr12: .equ 12 + +fr13: .equ 13 + +fr14: .equ 14 + +fr15: .equ 15 + +fr16: .equ 16 + +fr17: .equ 17 + +fr18: .equ 18 + +fr19: .equ 19 + +fr20: .equ 20 + +fr21: .equ 21 + +fr22: .equ 22 + +fr23: .equ 23 + +fr24: .equ 24 + +fr25: .equ 25 + +fr26: .equ 26 + +fr27: .equ 27 + +fr28: .equ 28 + +fr29: .equ 29 + +fr30: .equ 30 + +fr31: .equ 31 + +; Hardware Control Registers +cr0: .equ 0 + +rctr: .equ 0 ; Recovery Counter Register + + +cr8: .equ 8 ; Protection ID 1 + +pidr1: .equ 8 + + +cr9: .equ 9 ; Protection ID 2 + +pidr2: .equ 9 + + +cr10: .equ 10 + +ccr: .equ 10 ; Coprocessor Confiquration Register + + +cr11: .equ 11 + +sar: .equ 11 ; Shift Amount Register + + +cr12: .equ 12 + +pidr3: .equ 12 ; Protection ID 3 + + +cr13: .equ 13 + +pidr4: .equ 13 ; Protection ID 4 + + +cr14: .equ 14 + +iva: .equ 14 ; Interrupt Vector Address + + +cr15: .equ 15 + +eiem: .equ 15 ; External Interrupt Enable Mask + + +cr16: .equ 16 + +itmr: .equ 16 ; Interval Timer + + +cr17: .equ 17 + +pcsq: .equ 17 ; Program Counter Space queue + + +cr18: .equ 18 + +pcoq: .equ 18 ; Program Counter Offset queue + + +cr19: .equ 19 + +iir: .equ 19 ; Interruption Instruction Register + + +cr20: .equ 20 + +isr: .equ 20 ; Interruption Space Register + + +cr21: .equ 21 + +ior: .equ 21 ; Interruption Offset Register + + +cr22: .equ 22 + +ipsw: .equ 22 ; Interrpution Processor Status Word + + +cr23: .equ 23 + +eirr: .equ 23 ; External Interrupt Request + + +cr24: .equ 24 + +ppda: .equ 24 ; Physcial Page Directory Address + +tr0: .equ 24 ; Temporary register 0 + + +cr25: .equ 25 + +hta: .equ 25 ; Hash Table Address + +tr1: .equ 25 ; Temporary register 1 + + +cr26: .equ 26 + +tr2: .equ 26 ; Temporary register 2 + + +cr27: .equ 27 + +tr3: .equ 27 ; Temporary register 3 + + +cr28: .equ 28 + +tr4: .equ 28 ; Temporary register 4 + + +cr29: .equ 29 + +tr5: .equ 29 ; Temporary register 5 + + +cr30: .equ 30 + +tr6: .equ 30 ; Temporary register 6 + + +cr31: .equ 31 + +tr7: .equ 31 ; Temporary register 7 + +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Procedure Call Convention ~ +; Register Definitions for Use with Assembler ~ +; version A.08.06 +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Software Architecture General Registers +rp: .equ r2 ; return pointer + +mrp: .equ r31 ; millicode return pointer + +ret0: .equ r28 ; return value + +ret1: .equ r29 ; return value (high part of double) + +sl: .equ r29 ; static link + +sp: .equ r30 ; stack pointer + +dp: .equ r27 ; data pointer + +arg0: .equ r26 ; argument + +arg1: .equ r25 ; argument or high part of double argument + +arg2: .equ r24 ; argument + +arg3: .equ r23 ; argument or high part of double argument + +;_____________________________________________________________________________ +; Software Architecture Space Registers +; sr0 ; return link form BLE +sret: .equ sr1 ; return value + +sarg: .equ sr1 ; argument + +; sr4 ; PC SPACE tracker +; sr5 ; process private data +;_____________________________________________________________________________ +; Software Architecture Pseudo Registers +previous_sp: .equ 64 ; old stack pointer (locates previous frame) + +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Standard space and subspace definitions. version A.08.06 +; These are generally suitable for programs on HP_UX and HPE. +; Statements commented out are used when building such things as operating +; system kernels. +;;;;;;;;;;;;;;;; + .SPACE $TEXT$, SPNUM=0,SORT=8 +; .subspa $FIRST$, QUAD=0,ALIGN=2048,ACCESS=0x2c,SORT=4,FIRST +; .subspa $REAL$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=4,FIRST,LOCK + .subspa $MILLICODE$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=8 + .subspa $LIT$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16 + .subspa $CODE$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=24 +; .subspa $UNWIND$, QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=64 +; .subspa $RECOVER$, QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=80 +; .subspa $RESERVED$, QUAD=0,ALIGN=8,ACCESS=0x73,SORT=82 +; .subspa $GATE$, QUAD=0,ALIGN=8,ACCESS=0x4c,SORT=84,CODE_ONLY +; Additional code subspaces should have ALIGN=8 for an interspace BV +; and should have SORT=24. +; +; For an incomplete executable (program bound to shared libraries), +; sort keys $GLOBAL$ -1 and $GLOBAL$ -2 are reserved for the $DLT$ +; and $PLT$ subspaces respectively. +;;;;;;;;;;;;;;; + .SPACE $PRIVATE$, SPNUM=1,PRIVATE,SORT=16 + .subspa $GLOBAL$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40 + .import $global$ + .subspa $SHORTDATA$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=24 + .subspa $DATA$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16 + .subspa $PFA_COUNTER$, QUAD=1,ALIGN=4,ACCESS=0x1f,SORT=8 + .subspa $SHORTBSS$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=80,ZERO + .subspa $BSS$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO +; .subspa $PCB$, QUAD=1,ALIGN=8,ACCESS=0x10,SORT=82 +; .subspa $STACK$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82 +; .subspa $HEAP$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82 +;;;;;;;;;;;;;;;; +; .SPACE $PFA$, SPNUM=0,PRIVATE,UNLOADABLE,SORT=64 +; .subspa $PFA_ADDRESS$, ALIGN=4,ACCESS=0x2c,UNLOADABLE +;;;;;;;;;;;;;;;; +; .SPACE $DEBUG$, SPNUM=2,PRIVATE,UNLOADABLE,SORT=80 +; .subspa $HEADER$, ALIGN=4,ACCESS=0,UNLOADABLE,FIRST +; .subspa $GNTT$, ALIGN=4,ACCESS=0,UNLOADABLE +; .subspa $LNTT$, ALIGN=4,ACCESS=0,UNLOADABLE +; .subspa $SLT$, ALIGN=4,ACCESS=0,UNLOADABLE +; .subspa $VT$, ALIGN=4,ACCESS=0,UNLOADABLE + +; To satisfy the copyright terms each .o will have a reference +; the the actual copyright. This will force the actual copyright +; message to be brought in from libgloss/hp-milli.s + .space $PRIVATE$ + .subspa $DATA$ + .import ___hp_free_copyright,data +L$copyright .word ___hp_free_copyright diff --git a/newlib/libc/machine/hppa/setjmp.S b/newlib/libc/machine/hppa/setjmp.S new file mode 100644 index 000000000..6f3668e92 --- /dev/null +++ b/newlib/libc/machine/hppa/setjmp.S @@ -0,0 +1,139 @@ +/* Copyright (c) 1995 Cygnus Support. + All rights reserved. + + Redistribution and use in source and binary forms are permitted + provided that the above copyright notice and this paragraph are + duplicated in all such forms and that any documentation, + advertising materials, and other materials related to such + distribution and use acknowledge that the software was developed + at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to + endorse or promote products derived from this software without + specific prior written permission. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ + +/* Note I don't know an easy way to get the FP version into the + traditional C library and the non-FP version into the soft-float + library. Maybe we'll have to have -msoft-float trigger something + like -DSOFT_FLOAT if this issue ever arises. */ + + .SPACE $PRIVATE$ + .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31 + .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 + .SPACE $TEXT$ + .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44 + .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE +; gcc_compiled.: + .SPACE $TEXT$ + .SUBSPA $CODE$ + + .align 4 + .EXPORT setjmp,ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR +setjmp + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + stwm %r30,4(%r26) + stwm %r2,4(%r26) + stwm %r3,4(%r26) + stwm %r4,4(%r26) + stwm %r5,4(%r26) + stwm %r6,4(%r26) + stwm %r7,4(%r26) + stwm %r8,4(%r26) + stwm %r9,4(%r26) + stwm %r10,4(%r26) + stwm %r11,4(%r26) + stwm %r12,4(%r26) + stwm %r13,4(%r26) + stwm %r14,4(%r26) + stwm %r15,4(%r26) + stwm %r16,4(%r26) + stwm %r17,4(%r26) + stwm %r18,4(%r26) + stwm %r27,4(%r26) +#ifdef FP + ; jmp_buf may only have a 4 byte alignment, so handle FP stores + ; very carefully. + fstds %fr12,-16(%r30) + ldw -16(%r30),%r28 + stwm %r28,4(%r26) + ldw -12(%r30),%r28 + stwm %r28,4(%r26) + fstds %fr13,-16(%r30) + ldw -16(%r30),%r28 + stwm %r28,4(%r26) + ldw -12(%r30),%r28 + stwm %r28,4(%r26) + fstds %fr14,-16(%r30) + ldw -16(%r30),%r28 + stwm %r28,4(%r26) + ldw -12(%r30),%r28 + stwm %r28,4(%r26) + fstds %fr15,-16(%r30) + ldw -16(%r30),%r28 + stwm %r28,4(%r26) + ldw -12(%r30),%r28 + stwm %r28,4(%r26) +#endif + + bv 0(%r2) + copy %r0,%r28 + .EXIT + .PROCEND + .align 4 + .EXPORT longjmp,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,RTNVAL=GR +longjmp + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + ldwm 4(%r26),%r30 + ldwm 4(%r26),%r2 + ldwm 4(%r26),%r3 + ldwm 4(%r26),%r4 + ldwm 4(%r26),%r5 + ldwm 4(%r26),%r6 + ldwm 4(%r26),%r7 + ldwm 4(%r26),%r8 + ldwm 4(%r26),%r9 + ldwm 4(%r26),%r10 + ldwm 4(%r26),%r11 + ldwm 4(%r26),%r12 + ldwm 4(%r26),%r13 + ldwm 4(%r26),%r14 + ldwm 4(%r26),%r15 + ldwm 4(%r26),%r16 + ldwm 4(%r26),%r17 + ldwm 4(%r26),%r18 + ldwm 4(%r26),%r27 +#ifdef FP + ldwm 4(%r26),%r28 + stw %r28,-16(%r30) + ldwm 4(%r26),%r28 + stw %r28,-12(%r30) + fldds -16(%r30),%fr12 + ldwm 4(%r26),%r28 + stw %r28,-16(%r30) + ldwm 4(%r26),%r28 + stw %r28,-12(%r30) + fldds -16(%r30),%fr13 + ldwm 4(%r26),%r28 + stw %r28,-16(%r30) + ldwm 4(%r26),%r28 + stw %r28,-12(%r30) + fldds -16(%r30),%fr14 + ldwm 4(%r26),%r28 + stw %r28,-16(%r30) + ldwm 4(%r26),%r28 + stw %r28,-12(%r30) + fldds -16(%r30),%fr15 +#endif + comclr,<> %r0,%r25,%r0 + ldi 1,%r25 + bv 0(%r2) + copy %r25,%r28 + .EXIT + .PROCEND diff --git a/newlib/libc/machine/hppa/strcat.S b/newlib/libc/machine/hppa/strcat.S new file mode 100644 index 000000000..9fcdd790f --- /dev/null +++ b/newlib/libc/machine/hppa/strcat.S @@ -0,0 +1,178 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* HPUX_ID: @(#) $Revision$ */ +/* + * strcat(s1, s2) + * + * Concatenate s2 on the end of s1. S1's space must be large enough. + * Return s1. + */ +#include "DEFS.h" + +#define d_addr r26 +#define s_addr r25 +#define tmp6 r24 +#define tmp1 r19 +#define tmp2 r20 +#define tmp3 r21 +#define tmp4 r22 +#define tmp5 arg3 +#define save r1 + + +ENTRY(strcat) + + comb,= r0,s_addr,done /* quit if s2=NULL */ + copy d_addr,ret0 /* The return value is the value of d_addr. DELAY SLOT*/ + +/* First look for end of s1 (d_addr) */ + + extru d_addr,31,2,tmp1 /* Extract the low two bits of the dest address. */ + combt,= tmp1,r0,dont_mask + dep 0,31,2,d_addr /*set word alignment */ + ldwm 4(d_addr),tmp2 + sh3add tmp1,r0,save /* build mask based on tmp1 */ + mtctl save,11 + zvdepi -2,32,save + or save,tmp2,tmp2 + uxor,nbz tmp2,r0,save +search: + b,n found_end /* nullified under uxor conditions above and below */ +dont_mask: + ldwm 4(d_addr),tmp2 + comib,tr r0,r0,search + uxor,nbz tmp2,r0,save + +found_end: /* at this point d_addr points to word */ + extru,<> save,7,8,r0 /* following word with null */ + addib,tr,n -4,d_addr,begin_copy /*set d_addr to end of s1 */ + extru,<> save,15,8,r0 + addib,tr,n -3,d_addr,begin_copy + extru,<> save,23,8,r0 + addi -1,d_addr,d_addr + addi -1,d_addr,d_addr + + +begin_copy: + + extru s_addr,31,2,tmp1 /* Extract the low two bits of the source address. */ + extru d_addr,31,2,tmp6 /* Extract the low two bits of the destination address. */ + sub,= tmp6,tmp1,tmp3 /* Compute the shift quantity and don't branch if tmp6=tmp1. */ + b not_aligned /* Not_aligned says that shifts Will be needed. */ + dep 0,31,2,s_addr /* Compute the word address of the source. DELAY SLOT. */ +/* aligned */ + + combt,= tmp6,r0,skip_mask + ldwm 4(0,s_addr),tmp1 /* tmp1 = *s_addr s_addr += 4 (DELAY SLOT) */ + sh3add tmp6,r0,save + mtctl save,r11 + zvdepi -2,32,save + or save,tmp1,tmp1 + uxor,nbz tmp1,r0,save + b,n first_null /* special case: null in first word */ + b,n skip_mask2 + +chunks: + b,n null_found /* delay slot for uxor below */ + +skip_mask2: + stbys,b,m tmp1,4(d_addr) + ldwm 4(s_addr),tmp1 +skip_mask: + comib,tr 0,0,chunks + uxor,nbz tmp1,r0,save + +/* Begin non_aligned code. */ + +not_aligned: + sh3add,>= tmp3,r0,tmp4 /* compute the shift amt.and skip load if tmp6 > tmp1. */ + ldwm 4(0,s_addr),tmp1 /* load up the first word from the source. tmp1 = *s_addr++ */ + ldwm 4(0,s_addr),tmp2 /* get either first or second word from source. */ + combt,= tmp6,r0,chunk2 /* don't mask if whole word is valid */ + mtctl tmp4,11 /* load the shift count into cr11 = shift count register. */ + vshd tmp1,tmp2,tmp3 /* position data ! (delay slot) */ + sh3add tmp6,r0,save /* setup r1 */ + mtctl save,r11 /* set-up cr11 for mask */ + zvdepi -2,32,save + or save, tmp3, tmp3 + uxor,nbz tmp3,r0,save + b,n first_null2 + b did_mask + mtctl tmp4,11 /* re-load the shift count into cr11 */ + +chunk2: + vshd tmp1,tmp2,tmp3 + uxor,nbz tmp3, r0, save + b,n null_found +did_mask: + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + + ldwm 4(0,s_addr),tmp1 /* get next word ! */ + vshd tmp2,tmp1,tmp3 /* position data ! */ + uxor,nbz tmp3, r0, save + b,n null_found + stwm tmp3,4(d_addr) + comib,tr 0,0,chunk2 + ldwm 4(s_addr),tmp2 + + +null_found: /* adjust d_addr and store final word */ + + extru,<> save,7,8,r0 + addib,tr,n 1,d_addr,store_final + extru,<> save,15,8,r0 + addib,tr,n 2,d_addr,store_final + extru,<> save,23,8,r0 + addib,tr 3,d_addr,store_final2 + bv 0(r2) + stw save,0(d_addr) + +store_final: + bv 0(r2) +store_final2: + stbys,e save,0(d_addr) /* delay slot */ + +first_null: /* null found in first word of aligned (wrt d_addr) */ + addi -4,s_addr,s_addr + ldbx tmp6(s_addr),tmp4 + add tmp6,s_addr,s_addr + comib,= 0,tmp4,done + stbs,ma tmp4,1(d_addr) + ldbs 1(s_addr),tmp4 + comib,= 0,tmp4,done + stbs,ma tmp4,1(d_addr) + bv 0(r2) /* done */ + stbs 0,0(d_addr) + +first_null2: /* null found in first word of non-aligned (wrt d_addr) */ + addibt,= -1,tmp6,check3 /* check last 3 bytes of word */ + extru save,15,8,tmp4 + addibt,=,n -1,tmp6,check2 /* check last 2 bytes */ + bv 0(r2) + stbys,b save, 0(d_addr) + +check3: + combt,= tmp4,r0,done + stbs,ma tmp4,1(d_addr) +check2: + extru,<> save,23,8,tmp4 + bv 0(r2) + stbs,ma tmp4,1(d_addr) + bv 0(r2) + stbs r0,0(d_addr) + +done: +EXIT(strcat) diff --git a/newlib/libc/machine/hppa/strcmp.S b/newlib/libc/machine/hppa/strcmp.S new file mode 100644 index 000000000..007a64849 --- /dev/null +++ b/newlib/libc/machine/hppa/strcmp.S @@ -0,0 +1,282 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* + + strcmp + + Jerry Huck + Edgar Circenis + +*/ +/* + * strcmp(s1, s2) + * + * returns integer: < 0 iff s1 lexicographically less than s2 + * > 0 iff s1 lexicographically greater than s2 + * = 0 iff s1 lexicographically equal to s2 + */ + +#include "DEFS.h" + +#define s1 26 +#define s2 25 +#define tmp1 19 +#define s2word 20 +#define tmp3 21 +#define tmp7 22 +#define s1word 23 +#define save 1 +#define tmp6 24 +#define tmp5 28 + +ENTRY(strcmp) + comb,=,n s1,s2,samestring + comib,=,n 0,s1,s1isnull + comib,=,n 0,s2,s2isnull +/* Hope for word alignment. Pick up low two bits of each adress */ + extru,<> s1,31,2,tmp1 + ldwm 4(s1),s1word + dep,= s2,29,2,tmp1 + b,n case_analysis + +/* Start looping until null is found in s1 or they mis-compare */ +loop: + ldwm 4(s2),s2word +loop_plus: + uxor,nbz s1word,r0,r0 /* Null in this? */ + b,n nullins1 + comb,=,n s1word,s2word,loop + ldwm 4(s1),s1word + +/* The words do not compare equal and s1 does not have a null. + Need to treat words as unsigned and generate either a positive + or negative return value */ +wordcomparereturn: + comclr,>> s1word,s2word,ret0 /*Set ret0 to 0 and skip if greater*/ + ldi -2,ret0 /*Set ret0 to -2 when less */ + bv r0(rp) + addi 1,ret0,ret0 /*Fix return value to be -1 or +1 */ + +/* s1 has a null. s2 has not been checked. */ +nullins1: + /*If s2 has no nulls this is simple, but assume that it might + and fix up s1 to allow the word comparision to work by + scanning s1 and duplicating all the bytes in s2 below that byte into + the remainder of s1. A remainder only exists if the zero byte + is found in the upper three bytes */ + extru,<> s1word,7,8,r0 /*in the first byte? */ + dep,tr s2word,31,24,s1word /*copy low 3 bytes of *s2 into *s1 */ + extru,<> s1word,15,8,r0 /*in the second byte? */ + dep,tr s2word,31,16,s1word /*copy low 2 bytes of *s2 into *s1 */ + extru,<> s1word,23,8,r0 /*in the third byte? */ + dep s2word,31,8,s1word /*copy low 1 byte of *s2 into *s1 */ + /* Do the normal unsigned compare and return */ + comclr,<> s1word,s2word,ret0 /*Set ret0 to 0 and skip if not equal */ + bv,n r0(rp) + comclr,>> s1word,s2word,ret0 /*Set ret0 to 0 and skip if greater*/ + ldi -2,ret0 /*Set ret0 to -2 when less */ + bv r0(rp) + addi 1,ret0,ret0 /*Fix return value to be -1 or +1 */ + +/* s1 and s2 are the same string and therefore equal */ +samestring: + bv r0(rp) + copy r0,ret0 +/* s1 is null. Treat as string of nulls. Therefore return + the negative of s2's first byte. s2 cannot be zero. */ +s1isnull: + ldbs 0(0,s2),ret0 + bv r0(rp) + sub 0,ret0,ret0 +/* s2 is null. Treat as string of nulls. Therefore return + s1's first byte. s1 cannot be zero. */ +s2isnull: + bv r0(rp) + ldbs 0(0,s1),ret0 + +case_analysis: + blr tmp1,r0 + nop + + /* + Case statement for non-aligned cases (we've already + checked the aligned case. + NOTE: for non-aligned cases, the absolute shift value + gets loaded into tmp3. + */ + + /* S2 S1 */ + nop /* 00 00 can't happen */ + nop + b shifts2 /* 00 01 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + b shifts2 /* 00 10 */ + ldi 16,tmp3 /* load shift count (delay slot) */ + b shifts2 /* 00 11 */ + ldi 24,tmp3 /* load shift count (delay slot) */ + b shifts1_0 /* 01 00 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + b eq_align1 /* 01 01 */ + ldbs,ma 1(s1),s1word + b shifts2 /* 01 10 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + b shifts2 /* 01 11 */ + ldi 16,tmp3 /* load shift count (delay slot) */ + b shifts1_0 /* 10 00 */ + ldi 16,tmp3 /* load shift count (delay slot) */ + b shifts1 /* 10 01 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + b eq_align2 /* 10 10 */ + ldhs,ma 2(s1),s1word + b shifts2 /* 10 11 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + b shifts1_0 /* 11 00 */ + ldi 24,tmp3 /* load shift count (delay slot) */ + b shifts1 /* 11 01 */ + ldi 16,tmp3 /* load shift count (delay slot) */ + b shifts1 /* 11 10 */ + ldi 8,tmp3 /* load shift count (delay slot) */ + ldbs,ma 1(s1),s1word /* 11 11 */ + ldbs,ma 1(s2),s2word + sub,= s1word,s2word,ret0 /* if not equal, we can return now */ + bv,n r0(rp) + comclr,<> s1word,r0,ret0 + bv,n r0(rp) + b loop /* fall into main loop */ + ldwm 4(s1),s1word + +eq_align1: + ldbs,ma 1(s2),s2word + sub,= s1word,s2word,ret0 /* if not equal, we can return now */ + bv,n r0(rp) + comclr,<> s1word,r0,ret0 + bv,n r0(rp) + /* fall through to half-word aligned case */ + ldhs,ma 2(s1),s1word /* load next halfword */ +eq_align2: + ldhs,ma 2(s2),s2word /* load next halfword */ + /* form the mask: 0xffff0000 and mask leading nulls in s1word and s2word + so that we can fall into the main loop with word aligned data */ + ldi 16,save + mtctl save,r11 + zvdepi -2,32,save + or save,s1word,s1word + b loop_plus /* fall into main loop */ + or save,s2word,s2word + +/* s2's alignment is greater than s1's alignment, so we will shift s1 */ +shifts1_0: + addi -4,s1,s1 /* fix up s1 due to earlier read */ +shifts1: + extru s1,31,2,tmp1 + extru s2,31,2,tmp5 + dep r0,31,2,s1 /* Compute word address of s1 */ + dep r0,31,2,s2 /* Compute word address of s2 */ + ldwm 4(s1),s1word /* get first word of s1 */ + ldwm 4(s2),s2word /* get first word of s2 */ + combt,=,n r0,tmp1,masks2 /* Do we need to mask beginning of s1 */ + sh3add tmp1,r0,save /* save now has number of bits to mask */ + mtctl save,r11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word +masks2: + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,r11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s2word,s2word + ldi -1,tmp7 /* load tmp7 with 0xffffffff */ + mtctl tmp3,r11 /* Move shift amount to CR11 */ +more: uxor,nbz s1word,r0,r0 /* Is there a null in s1? */ + b ends1 + vshd tmp7,s1word,save + combf,=,n save,s2word,cmps1 + ldwm 4(s1),tmp7 + ldwm 4(s2),s2word + uxor,nbz tmp7,r0,r0 /* is there a null in s1? */ + b ends1_0 + vshd s1word,tmp7,save + combf,=,n save,s2word,cmps1 + ldwm 4(s1),s1word + b more + ldwm 4(s2),s2word + +cmps1: movb,tr save,s1word,wordcomparereturn + nop + +ends1_0: + copy tmp7,s1word /* move tmp7 to s1word */ +ends1: + combf,=,n save,s2word,nullins1 /* branch if no match */ + copy save,s1word /* delay slot */ +/* At this point, we know that we've read a null */ +/* from s1, so we can't read more from s1 */ + uxor,nbz save,r0,r0 /* are the strings equal? */ + b,n samestring + vshd s1word,r0,s1word + b nullins1 + ldwm 4(s2),s2word + +/* s1's alignment is greater than s2's alignment, so we will shift s2 */ +shifts2: + extru s1,31,2,tmp1 + extru s2,31,2,tmp5 + dep r0,31,2,s1 /* Compute word address of s1 */ + dep r0,31,2,s2 /* Compute word address of s2 */ + ldwm 4(s2),s2word /* get first word of s2 */ + ldwm 4(s1),s1word /* get first word of s1 */ + combt,=,n r0,tmp5,masks1 /* Do we need to mask beginning of s2 */ + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,r11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s2word,s2word +masks1: + sh3add tmp1,r0,save /* save now has number of bits to mask */ + mtctl save,r11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word + ldi -1,tmp7 /* load tmp7 with 0xffffffff */ + mtctl tmp3,r11 /* Move shift amount to CR11 */ +more1: uxor,nbz s2word,r0,r0 /* is there a null in s2? */ + b ends2 + vshd tmp7,s2word,save + combf,=,n s1word,save,cmps2 + ldwm 4(s2),tmp7 + ldwm 4(s1),s1word + uxor,nbz tmp7,r0,r0 /* is there a null in s2? */ + b ends2_0 + vshd s2word,tmp7,save + combf,=,n s1word,save,cmps2 + ldwm 4(s2),s2word + b more1 + ldwm 4(s1),s1word + +cmps2: movb,tr save,s2word,wordcomparereturn + nop + +ends2_0: + copy tmp7,s2word /* move tmp7 to s2word */ +ends2: + combf,=,n s1word,save,nullins1 /* branch if no match */ + copy save,s2word /* delay slot */ +/* At this point, we know that we've read a null */ +/* from s2, so we can't read more from s2 */ + uxor,nbz save,r0,r0 /* are the strings equal? */ + b,n samestring + vshd s2word,r0,s2word + b nullins1 + ldwm 4(s1),s1word + +EXIT(strcmp) diff --git a/newlib/libc/machine/hppa/strcpy.S b/newlib/libc/machine/hppa/strcpy.S new file mode 100644 index 000000000..3068cd5e1 --- /dev/null +++ b/newlib/libc/machine/hppa/strcpy.S @@ -0,0 +1,285 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* + A faster strcpy. + + by + + Jerry Huck (aligned case) + Daryl Odnert (equal-alignment case) + Edgar Circenis (non-aligned case) +*/ +/* + * strcpy(s1, s2) + * + * Copy string s2 to s1. s1 must be large enough. + * return s1 + */ + +#include "DEFS.h" + +#define d_addr r26 +#define s_addr r25 +#define tmp6 r24 +#define tmp1 r19 +#define evenside r19 +#define tmp2 r20 +#define oddside r20 +#define tmp3 r21 +#define tmp4 r22 +#define tmp5 arg3 +#define save r1 + + +ENTRY(strcpy) +/* Do some quick alignment checking on and fast path both word aligned */ + extru,<> s_addr,31,2,tmp6 /*Is source word aligned? */ + ldwm 4(0,s_addr),oddside /*Assume yes and guess that it + is double-word aligned. */ + dep,= d_addr,29,2,tmp6 /*Is target word aligned? */ + b case_analysis + copy d_addr,ret0 +/* Both are aligned. First source word already loaded assuming that + source was oddword aligned. Fall through (therefore fastest) code + shuffles the registers to join the main loop */ +bothaligned: + bb,>= s_addr,29,twoatatime /*Branch if source was odd aligned*/ + uxor,nbz oddside,r0,save + +/* Even aligned source. save holds that operand. + Do one iteration of the main copy loop juggling the registers to avoid + one copy. */ + b,n nullfound + ldwm 4(s_addr),oddside + stwm save,4(d_addr) + uxor,nbz oddside,r0,save + b,n nullfound + ldwm 4(s_addr),evenside + stwm oddside,4(d_addr) + uxor,nbz evenside,r0,save + b,n nullfound + ldwm 4(s_addr),oddside + +/* Main loop body. Entry expects evenside still to be stored, oddside + just loaded. */ +loop: + stwm evenside,4(d_addr) + uxor,nbz oddside,r0,save + +/* mid loop entry */ +twoatatime: + b,n nullfound + ldwm 4(s_addr),evenside + stwm oddside,4(d_addr) + uxor,sbz evenside,r0,save + b loop + ldwm 4(s_addr),oddside + +/* fall through when null found in evenside. oddside actually loaded */ +nullfound: /* adjust d_addr and store final word */ + + extru,<> save,7,8,r0 /* pick up leftmost byte */ + addib,tr,n 1,d_addr,store_final + extru,<> save,15,8,r0 + addib,tr,n 2,d_addr,store_final + extru,<> save,23,8,r0 + addib,tr 3,d_addr,store_final2 + bv 0(rp) + stw save,0(d_addr) + +store_final: + bv 0(rp) +store_final2: + stbys,e save,0(d_addr) /* delay slot */ + +case_analysis: + + blr tmp6,r0 + nop + + /* NOTE: the delay slots for the non-aligned cases load a */ + /* shift quantity which is TGT-SRC into tmp3. */ + /* Note also, the case for both strings being word aligned */ + /* is already checked before the BLR is executed, so that */ + /* case can never occur. */ + + /* TGT SRC */ + nop /* 00 00 can't happen */ + nop + b neg_aligned_copy /* 00 01 */ + ldi -1,tmp3 /* load shift quantity. delay slot */ + b neg_aligned_copy /* 00 10 */ + ldi -2,tmp3 /* load shift quantity. delay slot */ + b neg_aligned_copy /* 00 11 */ + ldi -3,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy0 /* 01 00 */ + ldi 1,tmp3 /* load shift quantity. delay slot */ + b equal_alignment_1 /* 01 01 */ + ldbs,ma 1(s_addr),tmp1 + b neg_aligned_copy /* 01 10 */ + ldi -1,tmp3 /* load shift quantity. delay slot */ + b neg_aligned_copy /* 01 11 */ + ldi -2,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy0 /* 10 00 */ + ldi 2,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy /* 10 01 */ + ldi 1,tmp3 /* load shift quantity. delay slot */ + b equal_alignment_2 /* 10 10 */ + ldhs,ma 2(s_addr),tmp1 + b neg_aligned_copy /* 10 11 */ + ldi -1,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy0 /* 11 00 */ + ldi 3,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy /* 11 01 */ + ldi 2,tmp3 /* load shift quantity. delay slot */ + b pos_aligned_copy /* 11 10 */ + ldi 1,tmp3 /* load shift quantity. delay slot */ + ldbs,ma 1(s_addr),tmp1 /* 11 11 */ + comiclr,<> r0,tmp1,r0 + bv 0(rp) /* return if 1st byte was null */ + stbs,ma tmp1,1(d_addr) /* store a byte to dst string */ + b bothaligned /* can now goto word_aligned */ + ldwm 4(s_addr),oddside /* load next word of source */ + +equal_alignment_1: + comiclr,<> r0,tmp1,r0 /* nullify next if tmp1 <> 0 */ + bv 0(rp) /* return if null byte found */ + stbs,ma tmp1,1(d_addr) /* store a byte to dst string */ + ldhs,ma 2(s_addr),tmp1 /* load next halfword */ +equal_alignment_2: + extru,<> tmp1,23,8,tmp6 /* look at left byte of halfword */ + bv 0(rp) /* return if 1st byte was null */ + stbs,ma tmp6,1(d_addr) + extru,<> tmp1,31,8,r0 + bv 0(rp) /* return if 2nd byte was null */ + stbs,ma tmp1,1(d_addr) + b bothaligned + ldwm 4(s_addr),oddside /* load next word */ + +/* source and destination are not aligned, so we do it the hard way. */ + +/* target alignment is greater than source alignment */ +pos_aligned_copy0: + addi -4,s_addr,s_addr +pos_aligned_copy: + extru d_addr,31,2,tmp6 /* Extract low 2 bits of the dest addr */ + extru s_addr,31,2,tmp1 /* Extract low 2 bits of the src addr */ + dep r0,31,2,s_addr /* Compute word address of the source. */ + sh3add tmp3,r0,tmp4 /* compute shift amt */ + ldwm 4(0,s_addr),tmp2 /* get 1st source word */ + sh3add tmp1,r0,save /* setup mask shift amount */ + mtctl save,r11 /* set-up cr11 for mask */ + zvdepi -2,32,save /* create mask */ + or save,tmp2,tmp2 /* mask unused bytes in src */ + ldi -1,tmp1 /* load tmp1 with 0xffffffff */ + mtctl tmp4,r11 /* shift count -> shift count reg */ + vshd tmp1,tmp2,tmp3 /* position data ! */ + uxor,nbz tmp3,r0,save + b,n first_null + uxor,nbz tmp2,r0,save + b nullfound1 + mtctl tmp4,r11 /* re-load shift cnt (delay slot) */ + b loop_entry + ldwm 4(0,s_addr),tmp1 /* get next word. delay slot */ + +neg_aligned_copy: + extru d_addr,31,2,tmp6 /* Extract low 2 bits of the dest addr */ + extru s_addr,31,2,tmp2 /* Extract low 2 bits of the src addr */ + dep r0,31,2,s_addr /* Compute word address of the source. */ + sh3add tmp3,r0,tmp4 /* compute shift amt */ + ldwm 4(0,s_addr),tmp1 /* load first word from source. */ +/* check to see if next word can be read safely */ + sh3add tmp2,r0,save + mtctl save,r11 /* shift count -> shift count reg */ + zvdepi -2,32,save + or save, tmp1, tmp1 + uxor,nbz tmp1,r0,save /* any nulls in first word? */ + b first_null0 + mtctl tmp4,r11 + ldwm 4(0,s_addr),tmp2 /* load second word from source */ + combt,= tmp6,r0,chunk1 /* don't mask if whole word valid */ + vshd tmp1,tmp2,tmp3 /* position data ! */ + sh3add tmp6,r0,save /* setup r1 */ + mtctl save,r11 /* set-up cr11 for mask */ + zvdepi -2,32,save + or save, tmp3, tmp3 + uxor,nbz tmp3,r0,save + b,n first_null + uxor,nbz tmp2,r0,save + b nullfound1 + mtctl tmp4,r11 /* re-load shift cnt (delay slot) */ + b loop_entry + ldwm 4(0,s_addr),tmp1 /* get next word. delay slot */ + +chunk1: + uxor,nbz tmp2,r0,save + b nullfound0 + vshd tmp1,tmp2,tmp3 +did_mask: + ldwm 4(0,s_addr),tmp1 /* get next word ! */ +loop_entry: + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + + uxor,nbz tmp1, r0, save + b nullfound2 + vshd tmp2,tmp1,tmp3 /* position data ! */ + ldwm 4(s_addr),tmp2 + stwm tmp3,4(d_addr) + uxor,sbz tmp2,r0,save + b did_mask +nullfound0: + vshd tmp1,tmp2,tmp3 /* delay slot */ + uxor,nbz tmp3,r0,save + b,n nullfound +nullfound1: + stbys,b,m tmp3,4(0,d_addr) + b nullfound + vshd tmp2,r0,save /* delay slot */ + +nullfound2: + uxor,nbz tmp3,r0,save + b,n nullfound + stwm tmp3,4(d_addr) + b nullfound + /* notice that delay slot is in next routine */ + +first_null0: /* null found in first word of non-aligned (wrt d_addr) */ + vshd tmp1,r0,save /* delay slot */ + combt,= tmp6,r0,check4 + extru save,7,8,tmp4 +first_null: + addibt,= -1,tmp6,check3 /* check last 3 bytes of word */ + extru save,15,8,tmp4 + addibt,=,n -1,tmp6,check2 /* check last 2 bytes */ + bv 0(rp) /* null in last byte--store and exit */ + stbys,b save, 0(d_addr) + +check4: + combt,= tmp4,r0,done + stbs,ma tmp4,1(d_addr) + extru,<> save,15,8,tmp4 +check3: + combt,= tmp4,r0,done + stbs,ma tmp4,1(d_addr) +check2: + extru,<> save,23,8,tmp4 + bv 0(rp) + stbs,ma tmp4,1(d_addr) + bv 0(rp) + stbs r0,0(d_addr) + +done: +EXIT(strcpy) diff --git a/newlib/libc/machine/hppa/strlen.S b/newlib/libc/machine/hppa/strlen.S new file mode 100644 index 000000000..12e9ef2a9 --- /dev/null +++ b/newlib/libc/machine/hppa/strlen.S @@ -0,0 +1,79 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* HPUX_ID = "@(#) $Revision$" */ +/* strlen(s): Return length of string s */ + +#define start arg0 +#define end ret0 +#define tmp1 arg1 +#define tmp2 arg2 + +#include "DEFS.h" + +ENTRY(strlen) + movb,=,n start,end,$null_ptr + depi 0,31,2,end + comb,<> start,end,$not_aligned + ldws,ma 4(end),tmp1 + comib,tr 0,0,$loop /* avoid INDIGO two register interlock */ + uxor,nbz 0,tmp1,0 +$not_aligned: + /* + ; Tricky code. The problem is that the value of of the word + ; including the start of the string has some garbage bytes that + ; may be 0. We don't want them to stop the string scan. So + ; we make those bytes non-zero (and any old non-zero value + ; will do). Notice that the end pointer has been rounded + ; down to a word boundary, and then incremented to the next + ; word by the time we get here. Therefore, (start-end) has + ; one of the values (-3, -2, or -1). Use uaddcm to do the + ; subtraction (instead of sub), and the result will be + ; (-4, -3, or -2). Multiply this by 8, and put into the + ; shift register (which truncates to the last 5 bits) and + ; the value will be (0, 8, or 16). Use this as a bit position, + ; and drop a mask down into tmp1. All the garbage bytes will + ; have at least 1 bit affected by the vdepi, so all the garbage + ; in this first word will be non-zero garbage. + */ + uaddcm start,end,tmp2 /* tmp2 <- { -4, -3, -2 } */ + sh3add tmp2,0,tmp2 /* tmp2 <- { -32, -24, -16 } */ + mtsar tmp2 /* sar <- { 0, 8, 16 } */ + vdepi -1,32,tmp1 + uxor,nbz 0,tmp1,0 +$loop: + b,n $end_loop + ldws,ma 4(end),tmp1 + comib,tr 0,0,$loop /* avoid INDIGO two register interlock */ + uxor,nbz 0,tmp1,0 +$end_loop: + /* adjust the end pointer to one past the end of the string */ + extru,<> tmp1,7,8,0 + addib,tr,n -3,end,$out + extru,<> tmp1,15,8,0 + addib,tr,n -2,end,$out + extru,<> tmp1,23,8,0 + addi -1,end,end +$out: + bv 0(rp) + /* + ; tricky code. the end pointer is just beyond the terminating + ; null byte, so the length is (end-start-1). use uaddcm + ; to do this in 1 instruction + */ + uaddcm end,start,ret0 + +$null_ptr: +EXIT(strlen) diff --git a/newlib/libc/machine/hppa/strncat.S b/newlib/libc/machine/hppa/strncat.S new file mode 100644 index 000000000..04bd156c9 --- /dev/null +++ b/newlib/libc/machine/hppa/strncat.S @@ -0,0 +1,238 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/*HPUX_ID: @(#) $Revision$ */ +/* strncat(s1,s2,n) : concatonate at most n characters from s2 onto s1 */ + +#include "DEFS.h" + +#define d_addr r26 +#define s_addr r25 +#define count r24 +#define tmp1 r19 +#define tmp2 r20 +#define tmp3 r21 +#define tmp4 r22 +#define tmp5 arg3 +#define tmp6 r31 +#define save r1 +#define tmp7 ret1 /* source offset-- reset to orig source addr if not aligned */ + + +ENTRY(strncat) + + comb,= r0,s_addr,quit /* quit if s2=NULL */ + copy d_addr,ret0 /* The return value is the value of d_addr. DELAY SLOT*/ + +/* First look for end of s1 (d_addr) */ + + extru d_addr,31,2,tmp1 /* Extract the low two bits of the dest address. */ + combt,= tmp1,r0,dont_mask + dep 0,31,2,d_addr /*set word alignment */ + ldwm 4(d_addr),tmp2 + sh3add tmp1,r0,save /* build mask based on tmp1 */ + mtctl save,11 + zvdepi -2,32,save + or save,tmp2,tmp2 + uxor,nbz tmp2,r0,save +search: + b,n found_end /* nullified under uxor conditions above and below */ +dont_mask: + ldwm 4(d_addr),tmp2 + comib,tr r0,r0,search + uxor,nbz tmp2,r0,save + +found_end: /* at this point d_addr points to word */ + extru,<> save,7,8,r0 /* following word with null */ + addib,tr,n -4,d_addr,begin_copy /*set d_addr to end of s1 */ + extru,<> save,15,8,r0 + addib,tr,n -3,d_addr,begin_copy + extru,<> save,23,8,r0 + addi -1,d_addr,d_addr + addi -1,d_addr,d_addr + + +begin_copy: + addibt,<,n -4,count,byteloop /* If count is <= 4 don't get fancy.*/ + + extru s_addr,31,2,tmp4 /* Extract the low two bits of the source address.*/ + extru d_addr,31,2,tmp5 /* Extract the low two bits of the destination address.*/ + add count,tmp5,count /* pre increment the count by the byte address so that the count is*/ + copy s_addr,tmp6 /* save original s_addr in case we find null in first word */ + copy s_addr, tmp7 /* save s_addr in case we find null before first store */ + comb,<> tmp5,tmp4,not_aligned /* branch if tmp5<>tmp4. */ + dep 0,31,2,s_addr /* Compute the word address of the source. DELAY SLOT.*/ +/* aligned*/ + combt,= tmp5,r0,skip_mask + ldwm 4(0,s_addr),tmp1 /* tmp1 = *s_addr s_addr += 4 (DELAY SLOT)*/ + sh3add tmp5,r0,save /* compute mask in save*/ + mtctl save,11 + zvdepi -2,32,save + or save,tmp1,tmp1 /* or mask with data*/ + uxor,nbz tmp1,r0,save /* check for null*/ + b,n null1 + addibt,< -4,count,back_porch + stbys,b,m tmp1,4(0,d_addr) /* store word (delay slot)*/ + +chunks: + ldwm 4(0,s_addr),tmp1 /* get a word*/ + +skip_mask: + uxor,nbz tmp1,r0,save /* check for null*/ + b,n align_null1 + addibf,< -4,count,chunks + stbys,b,m tmp1,4(0,d_addr) /* store word (delay slot)*/ + +back_porch: /* last word to store*/ + addibt,=,n 4,count,done /* if count = 0 we're, of course, done !*/ + ldws 0(s_addr),tmp1 /* load up the back_porch*/ + sh3add count,r0, save /* setup right mask based on count*/ + mtctl save,r11 + zvdepi -2,32,save /*save now has left-hand mask*/ + uaddcm r0,save,save /*form right hand mask */ + or tmp1,save,tmp1 /*and insert data*/ + uxor,nbz tmp1,r0,save /* check for null*/ + b,n null2 + add d_addr,count,d_addr/* final store address is +1 too high !*/ + b done + stbys,e tmp1,0(d_addr) /* done */ + +/* Begin non_aligned code. */ +not_aligned: + sub,>= tmp5,tmp4,tmp6 /* compute the shift amt.and skip load if tmp5 > tmp4.*/ + ldwm 4(0,s_addr),tmp1 /* load up the first word from the source. tmp1 = *s_addr++*/ + zdep tmp6,28,29,tmp4 /* compute the number of bits to shift */ + mtctl tmp4,11 /* load the shift count into cr11 = shift count register.*/ + addibt,<,n -4,count,chkchnk2 /* first step in pre adjustment of count for looping.*/ + + ldwm 4(0,s_addr),tmp2 /* get either first or second word from source. */ + combt,= tmp5,r0,skip_mask4 /* don't mask if whole word is valid*/ + vshd tmp1,tmp2,tmp3 /* position data ! (delay slot)*/ + sh3add tmp5,r0,save /* setup r1*/ + mtctl save,r11 /* setup mask in save*/ + zvdepi -2,32,save + or save, tmp3, tmp3 + mtctl tmp4,11 /* re-load the shift count into cr11 */ + +skip_mask4: + uxor,nbz tmp3, r0, save + b,n null4 /* special case for first word */ + copy r0, tmp5 /* zero out tmp5 so we don't try to mask again*/ + copy r0, tmp7 /* zero out tmp7 so we don't try to use original s_addr anymore */ + b continue + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + +chunk2: + ldwm 4(0,s_addr),tmp2 + vshd tmp1,tmp2,tmp3 + +skip_mask2: + uxor,nbz tmp3, r0, save + b,n null3 + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + +continue: + ldwm 4(0,s_addr),tmp1 /* get 2nd word ! */ + vshd tmp2,tmp1,tmp3 /* position data ! */ + uxor,nbz tmp3, r0, save + b,n null3 + + addibf,< -8,count,chunk2 /* If count is still >= 8 do another loop.*/ + stbys,b,m tmp3,4(0,d_addr) /* store !*/ + +chkchnk2: + addibt,<,n 4,count,bp_0 /* if we don't have 4 bytes left then do the back porch (bp_0)*/ + +subchnk2: /* we have less than 8 chars to copy*/ + + ldwm 4(0,s_addr),tmp2 /* get next word !*/ + combt,= tmp5,r0,skip_mask3 + vshd tmp1,tmp2,tmp3 /* position data !*/ + sh3add tmp5,r0,save /* setup r1*/ + mtctl save,r11 /* setup mask in save*/ + zvdepi -2,32,save + or save, tmp3, tmp3 + mtctl tmp4,11 /* restore shift value again */ +skip_mask3: + uxor,nbz tmp3,r0,save + b,n null3 + copy r0,tmp5 /* zero out tmp5 so null3 does correct alignment */ + copy r0,tmp7 /* zero out tmp7 so we don't use orignal s_addr since no longer valid */ + b bp_1 /* we now have less than 4 bytes to move*/ + stbys,b,m tmp3,4(0,d_addr) /* store !*/ + +bp_0: + copy tmp1,tmp2 /* switch registers for shift process */ + addibt,<=,n 4,count,done /* if count = -4 this implies that count = 0 -> done */ + +bp_1: + ldwm 4(0,s_addr),tmp1 /* get final word ! */ + vshd tmp2,tmp1,tmp3 /* position data !*/ + uxor,nbz tmp3,r0,save /* if no-byte-zero */ + b,n bp_null /* don't goto no_null-find which null instead */ +no_null: + add d_addr,count,d_addr /* set up d_addr for stbys,e */ + b done /* were done*/ + stbys,e tmp3,0(0,d_addr) /* store the data !*/ + +/* here we do ye old byte-at-a-time moves.*/ +align_null1: + b byteloop + addi -4,s_addr,s_addr +null1: + copy tmp6,s_addr /* restore orig s_addr (aligned only) */ +byteloop: + addibt,= 4,count,done +null2: + ldbs,ma 1(s_addr),tmp1 +encore: + combt,=,n tmp1,r0, done + stbs,ma tmp1,1(d_addr) + addibf,=,n -1,count,encore + ldbs,ma 1(s_addr),tmp1 + b,n done + +bp_null: + addi -4,count,count /* fudge count 'cause byteloop will re-increment */ + +null3: /* not_aligned case reset s_addr and finish byte-wise */ + combt,=,n r0,tmp7,null3a /* if tmp7 is not valid address then branch below */ + b byteloop /* otherwise reset s_addr to tmp7 and finish */ + copy tmp7, s_addr + +null3a: /* right shift target */ + addibt,<,n 0,tmp6,null3b /* if left shifting */ + sub r0,tmp6,tmp6 /* do null3b code */ + addi -4,tmp6,tmp6 + b byteloop + add tmp6,s_addr,s_addr /* reset s_addr by 4 + shift_amt */ + +null3b: + subi -8,tmp6,tmp6 + add tmp5,tmp6,tmp6 /* adjust by the dest offset if this is our first store */ + b byteloop + add tmp6,s_addr,s_addr /* adjust s_addr by (8-shift_amt-dest_off) */ + +null4: + add,> tmp6,r0,tmp6 /* if left shift */ + b,n null3 /* then do null3 */ + b byteloop + addi -4,s_addr,s_addr /* adj source only by 4 */ + +done: + bv 0(r2) + stbs r0,0(d_addr) +quit: +EXIT(strncat) diff --git a/newlib/libc/machine/hppa/strncmp.S b/newlib/libc/machine/hppa/strncmp.S new file mode 100644 index 000000000..222384ee7 --- /dev/null +++ b/newlib/libc/machine/hppa/strncmp.S @@ -0,0 +1,189 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* strcmp(s1, s2) */ +/* returns integer: < 0 iff s1 lexicographically less than s2 */ +/* > 0 iff s1 lexicographically greater than s2 */ +/* = 0 iff s1 lexicographically equal to s2 */ +/* = 0 iff s1 lexicographically equal to s2 */ +/* quit after n charachters */ +#include "DEFS.h" + +#define s1 26 +#define s2 25 +#define tmp1 19 +#define s2word 20 +#define tmp3 21 +#define tmp7 22 +#define s1word 29 +#define save 1 +#define tmp6 23 +#define tmp5 28 +#define count 24 + +ENTRY(strncmp) + combt,<,n r0,count,search /* N <= 0 yields equality */ + bv r0(rp) /* */ + copy 0,ret0 /* return 0 (DELAY SLOT) */ +search: combf,=,n s1,s2,findout /* s1 != s2? */ + bv r0(rp) /* */ + copy 0,ret0 /* return 0 (delay slot) */ +findout: + comibf,=,n 0,s1,checks1 /* s1 == NULL? */ + ldbs 0(0,s2),ret0 /* */ + bv r0(rp) /* */ + subi 0,ret0,ret0 /* ret0 <- -*s2 */ +checks1: + comibf,=,n 0,s2,checkitout /* s2 == NULL? */ + bv r0(rp) /* */ + ldbs 0(0,s1),28 /* return *s1 */ + +checkitout: + extru s2,31,2,tmp1 /* Extract the low two bits of the s2. */ + extru s1,31,2,tmp5 /* Extract the low two bits of the s1 */ + sub,= tmp5,tmp1,tmp3 /* Are s1 & s2 aligned with each other? */ + b not_aligned /* It's more complicated (not_aligned) */ + dep 0,31,2,s1 /* Compute word address of s1 (DELAY SLOT) */ + dep 0,31,2,s2 /* Compute word address of s2 */ + ldwm 4(0,s1),s1word /* get next s1 word s1+=4 */ + combt,= tmp5,r0,skipmask /* skip masking, if we can */ + ldwm 4(0,s2),s2word /* get next s2 word s2+=4 (DELAY SLOT) */ + add tmp5,count,count /* bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word /* mask s1word (s1) */ + or save,s2word,s2word /* mask s2word (s2) */ + + +skipmask: + combt,=,n s1word,s2word,chknulls /* are these words equal? */ + +checkbyte: + extru s1word,7,8,tmp3 /* get first byte (character) */ +ckbyte2: extru s2word,7,8,tmp7 /* get first byte (character) */ + combf,= tmp3,tmp7,done /* quit if first byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + comibt,=,n 0,tmp3,done /* have we reached the end of string */ + /* if so done ret0 already has zero */ + addibt,<=,n -1,count,done /* have we checked N chars? ret0 == 0 */ + extru s1word,15,8,tmp3 /* get second byte (character) */ + extru s2word,15,8,tmp7 /* get second byte (character) */ + combf,= tmp3,tmp7,done /* quit if second byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + comibt,=,n 0,tmp3,done /* have we reached the end of string */ + /* if so done ret0 already has zero */ + addibt,<=,n -1,count,done /* have we checked N chars? */ + extru s1word,23,8,tmp3 /* get third byte (character) */ + extru s2word,23,8,tmp7 /* get third byte (character) */ + combf,= tmp3,tmp7,done /* done if third byte is not equal */ + sub tmp3,tmp7,ret0 /* return difference (delay slot) */ + comibt,=,n 0,tmp3,done /* have we reached the end of string */ + /* if so done ret0 already has zero */ + addibt,<=,n -1,count,done /* have we checked N chars? */ + extru s1word,31,8,tmp3 /* get last byte (character) */ + extru s2word,31,8,tmp7 /* get last byte (character) */ + bv r0(rp) /* */ + sub tmp3,tmp7,ret0 /* the last characters in the word is */ + /* where the difference is, so return */ + /* the difference and we're outta here */ + + +chknulls: + addibt,<=,n -4,count,zero /* have we checked N chars? */ + uxor,nbz s1word,0,0 /* don't have to check s2 Just quit */ + bv r0(rp) /* */ + copy 0,28 /* return 0 */ + ldwm 4(0,s2),s2word /* get next s2 word s2+=4 */ + b skipmask /* keep checking */ + ldwm 4(0,s1),s1word /* get next s1 word s1+=4 */ + + +not_aligned: + dep r0,31,2,s2 /* Compute word address of s2 */ + combt,<,n r0,tmp3,shifts1 /* Do we shift s1 or s2 */ + sh3add tmp3,r0,tmp3 /* eight bits per byte so mul by 8 */ + ldwm 4(0,s1),s1word /* get first word of s1 */ + ldwm 4(0,s2),s2word /* get first word or s2 */ + combt,=,n r0,tmp5,masks2 /* Do we need to mask beginning of s1 */ + add tmp5,count,count /* bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word /* */ +masks2: sh3add tmp1,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s2word,s2word /* */ + mtctl tmp3,11 /* Move shift amount to CR11 */ +more: uxor,nbz s2word,r0,r0 /* Is there a null in first word */ + b,n chunk1 /* */ + ldwm 4(0,s2),tmp7 /* load second word to enable us to shift */ + vshd s2word,tmp7,s2word /* */ + combf,=,n s1word,s2word,ckbyte2 /* */ + extru s1word,7,8,tmp3 /* get first byte (DELAY SLOT) */ + addibt,<=,n -4,count,zero /* have we checked N chars? */ + uxor,nbz s1word,0,0 /* even though they're equal we could be done */ + b,n zero + copy tmp7,s2word /* */ + b more /* keep checking */ + ldwm 4(0,s1),s1word /* get next s1 (DELAY SLOT) */ + +chunk1: + vshd s2word,r0,s2word /* */ + b ckbyte2 /* */ + extru s1word,7,8,tmp3 /* */ + + +shifts1: + sh3add tmp3,r0,tmp3 /* eight bits per byte so mul by 4 */ + sub r0,tmp3,tmp3 /* Get negative value for left shift */ + ldwm 4(0,s2),s2word /* get first word of s2 */ + ldwm 4(0,s1),s1word /* get first word or s1 */ + combt,=,n r0,tmp1,masks1 /* Do we need to mask beginning of s2 */ + add tmp1,count,count /* bump count by the number of bytes */ + /* we are going to mask */ + sh3add tmp1,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s2word,s2word /* */ +masks1: sh3add tmp5,r0,save /* save now has number of bits to mask */ + mtctl save,11 + zvdepi -2,32,save /* load save with proper mask */ + or save,s1word,s1word /* */ + mtctl tmp3,11 /* Move shift amount to CR11 */ +more1: uxor,nbz s1word,r0,r0 /* Is there a null in first byte */ + b,n chunk2 /* */ + ldwm 4(0,s1),tmp7 /* load second word to enable us to shift */ + vshd s1word,tmp7,s1word /* */ + combf,=,n s2word,s1word,ckbyte2 /* */ + extru s1word,7,8,tmp3 /* get first byte (DELAY SLOT) */ + addibt,<=,n -4,count,zero /* have we checked N chars? */ + uxor,nbz s2word,0,0 /* even though they're equal we could be done */ + b,n zero /* zero ret0 and quit */ + copy tmp7,s1word /* */ + b more1 /* keep checking */ + ldwm 4(0,s2),s2word /* get next s2 (DELAY SLOT) */ + +chunk2: + vshd s1word,r0,s1word /* */ + b ckbyte2 /* */ + extru s1word,7,8,tmp3 /* */ + +zero: copy r0,ret0 +done: +EXIT(strncmp) diff --git a/newlib/libc/machine/hppa/strncpy.S b/newlib/libc/machine/hppa/strncpy.S new file mode 100644 index 000000000..37ed83237 --- /dev/null +++ b/newlib/libc/machine/hppa/strncpy.S @@ -0,0 +1,256 @@ +/* + * (c) Copyright 1986 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ + +/* HPUX_ID: @(#) $Revision$ */ +/* + * strncpy(s1, s2, n) + * + * Copy s2 to s1, truncating or null-padding to always copy n bytes + * return s1 + */ + +#include "DEFS.h" + +#define d_addr r26 +#define s_addr r25 +#define count r24 +#define tmp1 r19 +#define tmp2 r20 +#define tmp3 r21 +#define tmp4 r22 +#define tmp5 arg3 +#define save r1 + + +ENTRY(strncpy) + + combt,= s_addr,r0,pad_null_bytes1 /* if s2==NULL then pad nulls and exit */ + copy d_addr,ret0 /* The return value is defined to be the value of d_addr. DELAY SLOT*/ + addibt,<,n -4,count,byteloop /* If count is <= 4 don't get fancy.*/ + + extru s_addr,31,2,tmp1 /* Extract the low two bits of the source address.*/ + extru d_addr,31,2,tmp5 /* Extract the low two bits of the destination address.*/ + add count,tmp5,count /* pre increment the count by the byte address so that the count is*/ + comb,<> tmp5,tmp1,not_aligned /* branch if tmp5<>tmp1. */ + dep 0,31,2,s_addr /* Compute the word address of the source. DELAY SLOT.*/ +/* aligned*/ + combt,= tmp5,r0,skip_mask + ldwm 4(0,s_addr),tmp1 /* tmp1 = *s_addr s_addr += 4 (DELAY SLOT)*/ + sh3add tmp5,r0,save /* compute mask in save*/ + mtctl save,11 + zvdepi -2,32,save + b skip_mask /* don't reload tmp1*/ + or save,tmp1,tmp1 /* or mask with data*/ + +chunks: + ldwm 4(0,s_addr),tmp1 /* get a word*/ + +skip_mask: + uxor,nbz tmp1,r0,save /* check for null*/ + b,n null1 + addibf,< -4,count,chunks + stbys,b,m tmp1,4(0,d_addr) /* store word (delay slot)*/ + +/* back_porch last word to store*/ + addibt,=,n 4,count,done /* if count = 0 we're, of course, done !*/ + ldws 0(s_addr),tmp1 /* load up the back_porch*/ + add d_addr,count,d_addr/* final store address is +1 too high !*/ + sh3add count,r0, save /* setup right mask based on count*/ + mtctl save,r11 + zvdepi -2,32,save /*save now has left-hand mask*/ + uaddcm r0,save,save /*form right hand mask */ + or tmp1,save,tmp1 /*and insert data*/ + uxor,nbz tmp1,r0,save /* check for null*/ + b,n null2 + bv 0(r2) + stbys,e tmp1,0(d_addr) /* done */ + +/* Begin non_aligned code. */ +not_aligned: + sub,>= tmp5,tmp1,tmp3 /* compute the shift amt.and skip load if tmp5 > tmp1.*/ + ldwm 4(0,s_addr),tmp1 /* load up the first word from the source. tmp1 = *s_addr++*/ + zdep tmp3,28,29,tmp4 /* compute the number of bits to shift */ + mtctl tmp4,11 /* load the shift count into cr11 = shift count register.*/ + addibt,<,n -4,count,chkchnk2 /* first step in pre adjustment of count for looping.*/ + + ldwm 4(0,s_addr),tmp2 /* get either first or second word from source. */ + combt,= tmp5,r0,skip_mask2 /* don't mask if whole word is valid*/ + vshd tmp1,tmp2,tmp3 /* position data ! (delay slot)*/ + sh3add tmp5,r0,save /* setup r1*/ + mtctl save,r11 /* setup mask in save*/ + zvdepi -2,32,save + or save, tmp3, tmp3 + mtctl tmp4,11 /* re-load the shift count into cr11 */ + b skip_mask2 + copy r0, tmp5 /* zero out tmp5 so we don't try to mask again*/ + +chunk2: + ldwm 4(0,s_addr),tmp2 + vshd tmp1,tmp2,tmp3 + +skip_mask2: + uxor,nbz tmp3, r0, save + b,n null3 + stbys,b,m tmp3,4(0,d_addr) /* store ! */ + + ldwm 4(0,s_addr),tmp1 /* get 2nd word ! */ + vshd tmp2,tmp1,tmp3 /* position data ! */ + uxor,nbz tmp3, r0, save + b,n null4 + + addibf,< -8,count,chunk2 /* If count is still >= 8 do another loop.*/ + stbys,b,m tmp3,4(0,d_addr) /* store !*/ + +chkchnk2: + addibt,<,n 4,count,bp_0 /* if we don't have 4 bytes left then do the back porch (bp_0)*/ + +subchnk2: /* we have less than 8 chars to copy*/ + + ldwm 4(0,s_addr),tmp2 /* get next word !*/ + combt,= tmp5,r0,skip_mask3 + vshd tmp1,tmp2,tmp3 /* position data !*/ + sh3add tmp5,r0,save /* setup r1*/ + mtctl save,r11 /* setup mask in save*/ + zvdepi -2,32,save + or save, tmp3, tmp3 + mtctl tmp4,11 /* restore shift value again */ + copy r0, tmp5 /* zero out tmp5 so we don't try to mask again*/ +skip_mask3: + uxor,nbz tmp3,r0,save + b,n null4 + b bp_1 /* we now have less than 4 bytes to move*/ + stbys,b,m tmp3,4(0,d_addr) /* store !*/ + +bp_0: + copy tmp1,tmp2 /* switch registers used in the shift process.*/ + addibt,<=,n 4,count,done /* if count = -4 this implies that count = 0 -> done */ + +bp_1: + ldwm 4(0,s_addr),tmp1 /* get final word ! */ + vshd tmp2,tmp1,tmp3 /* position data !*/ + uxor,sbz tmp3,r0,save /* if some-byte-zero */ + b no_null /* don't goto no_null-find which null instead */ + add d_addr,count,d_addr /* get d_addr ready for stbys,e */ + extru,<> save,7,8,r0 + b found_null5 + copy r0, tmp5 + extru,<> save,15,8,r0 + b found_null5 + ldil 0x1FE000,tmp5 /* setup mask (FF000000)*/ + extru,<> save,23,8,r0 + b found_null5 + ldil 0x1FFFE0,tmp5 /* setup mask (FFFF0000)*/ + ldo -1(r0),tmp5 /* setup mask (FFFFFFFF)*/ +found_null5: + and tmp3,tmp5,tmp3 /* zero out tmp5 based on mask in tmp5*/ +no_null: + bv 0(r2) /* were done*/ + stbys,e tmp3,0(0,d_addr) /* store the data !*/ + +/* here we do ye old byte-at-a-time moves.*/ +byteloop: + addibt,=,n 4,count,done + comb,= 0,s_addr,done + stbs r0,0(d_addr) /* store null in case s_addr == NULL */ + ldbs,ma 1(s_addr),tmp1 +encore: + combt,=,n tmp1,r0, pad_null_bytes1 + stbs,ma tmp1,1(d_addr) + addibf,=,n -1,count,encore + ldbs,ma 1(s_addr),tmp1 + b,n done + +pnb_1: + addibt,=,n 4,count,done /* if count was already 0 then we're done*/ + +pad_null_bytes1: + combt,=,n count,r0,done /* if count==0 then exit */ +pad_null_bytes2: + addibf,= -1,count,pad_null_bytes2 + stbs,ma r0,1(d_addr) + b,n done + +pad_nulls: + addibf,<=,n -4,count,pad_nulls + stwm r0,4(d_addr) + b,n pnb_1 + + +null1: + extru,<> save,7,8,r0 + b found_null1 + copy r0, tmp5 + extru,<> save,15,8,r0 + b found_null1 + ldil 0x1FE000,tmp5 /* setup mask (FF000000)*/ + extru,<> save,23,8,r0 + b found_null1 + ldil 0x1FFFE0,tmp5 /* setup mask (FFFF0000)*/ + ldo -1(r0),tmp5 /* setup mask (FFFFFFFF)*/ +found_null1: + and tmp1,tmp5,tmp1 /*zero out tmp1 according to mask*/ + b pad_nulls /* nullify remaining count bytes*/ + stbys,b,m tmp1,4(0,d_addr) /* first word (account for alignment)*/ + + +null2: /* back porch case. We have less than 4 bytes to go.*/ + extru,<> save,7,8,r0 /* is null in 1st byte? */ + b found_null2 + copy r0, tmp5 + extru,<> save,15,8,r0 /* is null in 2nd byte? */ + b found_null2 + ldil 0x1FE000,tmp5 /* setup mask (FF000000)*/ + b found_null2 /* null must be in 3rd byte */ + ldil 0x1FFFE0,tmp5 /* setup mask (FFFF0000)*/ +found_null2: + and tmp1,tmp5,tmp1 /*zero out tmp1 according to mask*/ + bv 0(r2) /* we're done*/ + stbys,e tmp1,0(0,d_addr) /* last word (back porch)*/ + +null3: /* not_aligned case where null is found in first of two words--adjust count*/ + extru,<> save,7,8,r0 + b found_null3 + copy r0, tmp5 + extru,<> save,15,8,r0 + b found_null3 + ldil 0x1FE000,tmp5 /* setup mask (FF000000)*/ + extru,<> save,23,8,r0 + b found_null3 + ldil 0x1FFFE0,tmp5 /* setup mask (FFFF0000)*/ + ldo -1(r0),tmp5 /* setup mask (FFFFFFFF)*/ +found_null3: + addi 4,count,count /* fix count since null is in first of two words*/ + and tmp3,tmp5,tmp3 /*zero out tmp3 according to mask*/ + b pad_nulls /* nullify remaining count bytes*/ + stbys,b,m tmp3,4(d_addr) + +null4: /* not_aligned case where null is found in second of two words*/ + extru,<> save,7,8,r0 + b found_null4 + copy r0, tmp5 + extru,<> save,15,8,r0 + b found_null4 + ldil 0x1FE000,tmp5 /* setup mask (FF000000)*/ + extru,<> save,23,8,r0 + b found_null4 + ldil 0x1FFFE0,tmp5 /* setup mask (FFFF0000)*/ + ldo -1(r0),tmp5 /* setup mask (FFFFFFFF)*/ +found_null4: + and tmp3,tmp5,tmp3 /*zero out tmp4 according to mask*/ + b pad_nulls /* nullify remaining count bytes*/ + stbys,b,m tmp3,4(d_addr) + +done: +EXIT(strncpy) -- cgit v1.2.3