Import the Linaro Cortex Strings library from

https://git.linaro.org/toolchain/cortex-strings.git

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Andrew Turner 2016-09-16 15:19:31 +00:00
commit 162378196a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/cortex-strings/dist/; revision=305888
244 changed files with 116928 additions and 0 deletions

11
.gitignore vendored Normal file
View file

@ -0,0 +1,11 @@
*.a
*.o
*.la
*.lo
*.png
*.pyc
.deps
.dirstamp
.libs
try-*
cache.txt

2797
Makefile Normal file

File diff suppressed because it is too large Load diff

327
Makefile.am Normal file
View file

@ -0,0 +1,327 @@
# Copyright (c) 2011, Linaro Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Linaro nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Top level Makefile for cortex-strings
# Used to record the compiler version in the executables
COMPILER = $(shell $(CC) --version 2>&1 | head -n1)
# The main library
lib_LTLIBRARIES = \
libcortex-strings.la
## Test suite
check_PROGRAMS = \
tests/test-memchr \
tests/test-memcmp \
tests/test-memcpy \
tests/test-memmove \
tests/test-memset \
tests/test-strchr \
tests/test-strcmp \
tests/test-strcpy \
tests/test-strlen \
tests/test-strncmp \
tests/test-strnlen
# Options for the tests
tests_cflags = -I$(srcdir)/tests $(AM_CFLAGS)
tests_ldadd = libcortex-strings.la
tests_test_memchr_LDADD = $(tests_ldadd)
tests_test_memchr_CFLAGS = $(tests_cflags)
tests_test_memcmp_LDADD = $(tests_ldadd)
tests_test_memcmp_CFLAGS = $(tests_cflags)
tests_test_memcpy_LDADD = $(tests_ldadd)
tests_test_memcpy_CFLAGS = $(tests_cflags)
tests_test_memmove_LDADD = $(tests_ldadd)
tests_test_memmove_CFLAGS = $(tests_cflags)
tests_test_memset_LDADD = $(tests_ldadd)
tests_test_memset_CFLAGS = $(tests_cflags)
tests_test_strchr_LDADD = $(tests_ldadd)
tests_test_strchr_CFLAGS = $(tests_cflags)
tests_test_strcmp_LDADD = $(tests_ldadd)
tests_test_strcmp_CFLAGS = $(tests_cflags)
tests_test_strcpy_LDADD = $(tests_ldadd)
tests_test_strcpy_CFLAGS = $(tests_cflags)
tests_test_strlen_LDADD = $(tests_ldadd)
tests_test_strlen_CFLAGS = $(tests_cflags)
tests_test_strncmp_LDADD = $(tests_ldadd)
tests_test_strncmp_CFLAGS = $(tests_cflags)
TESTS = $(check_PROGRAMS)
## Benchmarks
noinst_PROGRAMS = \
dhry \
dhry-native \
try-none \
try-this \
try-plain \
try-newlib-c \
try-bionic-c \
try-glibc-c
# Good 'ol Dhrystone
dhry_SOURCES = \
benchmarks/dhry/dhry_1.c \
benchmarks/dhry/dhry_2.c \
benchmarks/dhry/dhry.h
dhry_CFLAGS = -Dcompiler="\"$(COMPILER)\"" -Doptions="\"$(CFLAGS)\""
dhry_LDADD = libcortex-strings.la
dhry_native_SOURCES = $(dhry_SOURCES)
dhry_native_CFLAGS = $(dhry_CFLAGS)
# Benchmark harness
noinst_LIBRARIES = \
libmulti.a \
libbionic-c.a \
libglibc-c.a \
libnewlib-c.a \
libplain.a
libmulti_a_SOURCES = \
benchmarks/multi/harness.c
libmulti_a_CFLAGS = -DVERSION=\"$(VERSION)\" $(AM_CFLAGS)
## Other architecture independant implementaions
libbionic_c_a_SOURCES = \
reference/bionic-c/bcopy.c \
reference/bionic-c/memchr.c \
reference/bionic-c/memcmp.c \
reference/bionic-c/memcpy.c \
reference/bionic-c/memset.c \
reference/bionic-c/strchr.c \
reference/bionic-c/strcmp.c \
reference/bionic-c/strcpy.c \
reference/bionic-c/strlen.c
libglibc_c_a_SOURCES = \
reference/glibc-c/memchr.c \
reference/glibc-c/memcmp.c \
reference/glibc-c/memcpy.c \
reference/glibc-c/memset.c \
reference/glibc-c/strchr.c \
reference/glibc-c/strcmp.c \
reference/glibc-c/strcpy.c \
reference/glibc-c/strlen.c \
reference/glibc-c/wordcopy.c \
reference/glibc-c/memcopy.h \
reference/glibc-c/pagecopy.h
libnewlib_c_a_SOURCES = \
reference/newlib-c/memchr.c \
reference/newlib-c/memcmp.c \
reference/newlib-c/memcpy.c \
reference/newlib-c/memset.c \
reference/newlib-c/strchr.c \
reference/newlib-c/strcmp.c \
reference/newlib-c/strcpy.c \
reference/newlib-c/strlen.c \
reference/newlib-c/shim.h
libplain_a_SOURCES = \
reference/plain/memset.c \
reference/plain/memcpy.c \
reference/plain/strcmp.c \
reference/plain/strcpy.c
try_none_SOURCES =
try_none_LDADD = libmulti.a -lrt
try_this_SOURCES =
try_this_LDADD = libmulti.a libcortex-strings.la -lrt
try_bionic_c_SOURCES =
try_bionic_c_LDADD = libmulti.a libbionic-c.a -lrt
try_glibc_c_SOURCES =
try_glibc_c_LDADD = libmulti.a libglibc-c.a -lrt
try_newlib_c_SOURCES =
try_newlib_c_LDADD = libmulti.a libnewlib-c.a -lrt
try_plain_SOURCES =
try_plain_LDADD = libmulti.a libplain.a -lrt
# Architecture specific
if HOST_AARCH32
if WITH_NEON
# Pull in the NEON specific files
neon_bionic_a9_sources = \
reference/bionic-a9/memcpy.S \
reference/bionic-a9/memset.S
neon_bionic_a15_sources = \
reference/bionic-a15/memcpy.S \
reference/bionic-a15/memset.S
fpu_flags = -mfpu=neon
else
if WITH_VFP
fpu_flags = -mfpu=vfp
else
fpu_flags = -msoft-float
endif
endif
# Benchmarks and example programs
noinst_PROGRAMS += \
try-bionic-a9 \
try-bionic-a15 \
try-csl \
try-glibc \
try-newlib \
try-newlib-xscale
# Libraries used in the benchmarks and examples
noinst_LIBRARIES += \
libbionic-a9.a \
libbionic-a15.a \
libcsl.a \
libglibc.a \
libnewlib.a \
libnewlib-xscale.a
# Main library
libcortex_strings_la_SOURCES = \
src/thumb-2/strcpy.c \
src/arm/memchr.S \
src/arm/strchr.S \
src/thumb-2/strlen.S \
src/arm/memset.S \
src/arm/memcpy.S \
src/arm/strcmp.S
# Libraries containing the difference reference versions
libbionic_a9_a_SOURCES = \
$(neon_bionic_a9_sources) \
reference/bionic-a9/memcmp.S \
reference/bionic-a9/strcmp.S \
reference/bionic-a9/strcpy.S \
reference/bionic-a9/strlen.c
libbionic_a9_a_CFLAGS = -Wa,-mimplicit-it=thumb
libbionic_a15_a_SOURCES = \
$(neon_bionic_a15_sources) \
reference/bionic-a15/memcmp.S \
reference/bionic-a15/strcmp.S \
reference/bionic-a15/strcpy.S \
reference/bionic-a15/strlen.c
libbionic_a15_a_CFLAGS = -Wa,-mimplicit-it=thumb
libcsl_a_SOURCES = \
reference/csl/memcpy.c \
reference/csl/memset.c \
reference/csl/arm_asm.h
libglibc_a_SOURCES = \
reference/glibc/memcpy.S \
reference/glibc/memset.S \
reference/glibc/strchr.S \
reference/glibc/strlen.S
libnewlib_a_SOURCES = \
reference/newlib/memcpy.S \
reference/newlib/strcmp.S \
reference/newlib/strcpy.c \
reference/newlib/strlen.c \
reference/newlib/arm_asm.h \
reference/newlib/shim.h
libnewlib_xscale_a_SOURCES = \
reference/newlib-xscale/memchr.c \
reference/newlib-xscale/memcpy.c \
reference/newlib-xscale/memset.c \
reference/newlib-xscale/strchr.c \
reference/newlib-xscale/strcmp.c \
reference/newlib-xscale/strcpy.c \
reference/newlib-xscale/strlen.c \
reference/newlib-xscale/xscale.h
# Flags for the benchmark helpers
try_bionic_a9_SOURCES =
try_bionic_a9_LDADD = libmulti.a libbionic-a9.a -lrt
try_bionic_a15_SOURCES =
try_bionic_a15_LDADD = libmulti.a libbionic-a15.a -lrt
try_csl_SOURCES =
try_csl_LDADD = libmulti.a libcsl.a -lrt
try_glibc_SOURCES =
try_glibc_LDADD = libmulti.a libglibc.a -lrt
try_newlib_SOURCES =
try_newlib_LDADD = libmulti.a libnewlib.a -lrt
try_newlib_xscale_SOURCES =
try_newlib_xscale_LDADD = libmulti.a libnewlib-xscale.a -lrt
AM_CPPFLAGS = $(fpu_flags)
AM_LDFLAGS = $(fpu_flags)
endif
# aarch64 specific
if HOST_AARCH64
libcortex_strings_la_SOURCES = \
src/aarch64/memchr.S \
src/aarch64/memcmp.S \
src/aarch64/memcpy.S \
src/aarch64/memmove.S \
src/aarch64/memset.S \
src/aarch64/strchr.S \
src/aarch64/strchrnul.S \
src/aarch64/strcmp.S \
src/aarch64/strcpy.S \
src/aarch64/strlen.S \
src/aarch64/strncmp.S \
src/aarch64/strnlen.S
endif
libcortex_strings_la_LDFLAGS = -version-info 1:0:0
AM_CFLAGS = \
-std=gnu99 -Wall \
-fno-builtin -fno-stack-protector -U_FORTIFY_SOURCE \
$(AM_CPPFLAGS)
if WITH_SUBMACHINE
AM_CFLAGS += \
-mtune=$(submachine)
endif
EXTRA_DIST = \
tests/hp-timing.h \
tests/test-string.h \
tests/test-skeleton.c \
scripts/add-license.sh \
scripts/bench.py \
scripts/fixup.py \
scripts/libplot.py \
scripts/plot-align.py \
scripts/plot.py \
scripts/plot-sizes.py \
scripts/plot-top.py \
scripts/trim.sh \
autogen.sh

2797
Makefile.in Normal file

File diff suppressed because it is too large Load diff

111
README Normal file
View file

@ -0,0 +1,111 @@
= Cortex-A String Routines =
This package contains optimised string routines including memcpy(), memset(),
strcpy(), strlen() for the ARM Cortex-A series of cores.
Various implementations of these routines are provided, including generic
implementations for ARMv7-A cores with/without Neon, Thumb2 implementations
and generic implementations for cores supporting AArch64.
== Getting started ==
First configure and then install libcortex-strings.so. To make other
applications use this library, either add -lcortex-strings to the link
command or use LD_PRELOAD to load the library into existing applications.
Our intent is to get these routines into the common C libraries such
as GLIBC, Bionic, and Newlib. Your system may already include them!
== Contents ==
* src/ contains the routines themselves
* tests/ contains the unit tests
* reference/ contains reference copies of other ARM-focused
implementations gathered from around the Internet
* benchmarks/ contains various benchmarks, tools, and scripts used to
check and report on the different implementations.
The src directory contains different variants organised by the
implementation they run on and optional features used. For example:
* src/thumb-2 contains generic non-NEON routines for AArch32 (with Thumb-2).
* src/arm contains tuned routines for Cortex-A class processors.
* src/aarch64 contains generic routines for AArch64.
* src/thumb contains generic routines for armv6-M (with Thumb).
== Reference versions ==
reference/ contains versions collected from various popular Open
Source libraries. These have been modified for use in benchmarking.
Please refer to the individual files for any licensing terms.
The routines were collected from the following releases:
* EGLIBC 2.13
* Newlib 1.19.0
* Bionic android-2.3.5_r1
== Licensing ==
All Linaro-authored routines are under the modified BSD license:
Copyright (c) 2011, Linaro Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Linaro nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
All ARM-authored routines are under the modified BSD license:
Copyright (c) 2014 ARM Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Linaro nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
All third party routines are under a GPL compatible license.
== Notes and Limitations ==
Some of the implementations have been collected from other
projects and have a variety of licenses and copyright holders.
== Style ==
Assembly code attempts to follow the GLIBC coding convetions. They
are:
* Copyright headers in C style comment blocks
* Instructions indented with one tab
* Operands indented with one tab
* Text is wrapped at 70 characters
* End of line comments are fine

10201
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load diff

69
autogen.sh Executable file
View file

@ -0,0 +1,69 @@
#!/bin/sh
#
# autogen.sh glue for hplip
#
# HPLIP used to have five or so different autotools trees. Upstream
# has reduced it to two. Still, this script is capable of cleaning
# just about any possible mess of autoconf files.
#
# BE CAREFUL with trees that are not completely automake-generated,
# this script deletes all Makefile.in files it can find.
#
# Requires: automake 1.9, autoconf 2.57+
# Conflicts: autoconf 2.13
set -e
# Refresh GNU autotools toolchain.
echo Cleaning autotools files...
find -type d -name autom4te.cache -print0 | xargs -0 rm -rf \;
find -type f \( -name missing -o -name install-sh -o -name mkinstalldirs \
-o -name depcomp -o -name ltmain.sh -o -name configure \
-o -name config.sub -o -name config.guess \
-o -name Makefile.in \) -print0 | xargs -0 rm -f
echo Running autoreconf...
autoreconf --force --install
# For the Debian package build
test -d debian && {
# link these in Debian builds
rm -f config.sub config.guess
ln -s /usr/share/misc/config.sub .
ln -s /usr/share/misc/config.guess .
# refresh list of executable scripts, to avoid possible breakage if
# upstream tarball does not include the file or if it is mispackaged
# for whatever reason.
[ "$1" = "updateexec" ] && {
echo Generating list of executable files...
rm -f debian/executable.files
find -type f -perm +111 ! -name '.*' -fprint debian/executable.files
}
# Remove any files in upstream tarball that we don't have in the Debian
# package (because diff cannot remove files)
version=`dpkg-parsechangelog | awk '/Version:/ { print $2 }' | sed -e 's/-[^-]\+$//'`
source=`dpkg-parsechangelog | awk '/Source:/ { print $2 }' | tr -d ' '`
if test -r ../${source}_${version}.orig.tar.gz ; then
echo Generating list of files that should be removed...
rm -f debian/deletable.files
touch debian/deletable.files
[ -e debian/tmp ] && rm -rf debian/tmp
mkdir debian/tmp
( cd debian/tmp ; tar -zxf ../../../${source}_${version}.orig.tar.gz )
find debian/tmp/ -type f ! -name '.*' -print0 | xargs -0 -ri echo '{}' | \
while read -r i ; do
if test -e "${i}" ; then
filename=$(echo "${i}" | sed -e 's#.*debian/tmp/[^/]\+/##')
test -e "${filename}" || echo "${filename}" >>debian/deletable.files
fi
done
rm -fr debian/tmp
else
echo Emptying list of files that should be deleted...
rm -f debian/deletable.files
touch debian/deletable.files
fi
}
exit 0

15143
autom4te.cache/output.0 Normal file

File diff suppressed because it is too large Load diff

15139
autom4te.cache/output.1 Normal file

File diff suppressed because it is too large Load diff

301
autom4te.cache/requests Normal file
View file

@ -0,0 +1,301 @@
# This file was generated.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@request = (
bless( [
'0',
1,
[
'/usr/local/share/autoconf-2.69'
],
[
'/usr/local/share/autoconf-2.69/autoconf/autoconf.m4f',
'-',
'/usr/local/share/aclocal-1.15/internal/ac-config-macro-dirs.m4',
'/usr/local/share/aclocal/libtool.m4',
'/usr/local/share/aclocal/ltargz.m4',
'/usr/local/share/aclocal/ltdl.m4',
'/usr/local/share/aclocal/ltoptions.m4',
'/usr/local/share/aclocal/ltsugar.m4',
'/usr/local/share/aclocal/ltversion.m4',
'/usr/local/share/aclocal/lt~obsolete.m4',
'/usr/local/share/aclocal-1.15/amversion.m4',
'/usr/local/share/aclocal-1.15/as.m4',
'/usr/local/share/aclocal-1.15/auxdir.m4',
'/usr/local/share/aclocal-1.15/cond.m4',
'/usr/local/share/aclocal-1.15/depend.m4',
'/usr/local/share/aclocal-1.15/depout.m4',
'/usr/local/share/aclocal-1.15/init.m4',
'/usr/local/share/aclocal-1.15/install-sh.m4',
'/usr/local/share/aclocal-1.15/lead-dot.m4',
'/usr/local/share/aclocal-1.15/make.m4',
'/usr/local/share/aclocal-1.15/missing.m4',
'/usr/local/share/aclocal-1.15/options.m4',
'/usr/local/share/aclocal-1.15/prog-cc-c-o.m4',
'/usr/local/share/aclocal-1.15/runlog.m4',
'/usr/local/share/aclocal-1.15/sanity.m4',
'/usr/local/share/aclocal-1.15/silent.m4',
'/usr/local/share/aclocal-1.15/strip.m4',
'/usr/local/share/aclocal-1.15/substnot.m4',
'/usr/local/share/aclocal-1.15/tar.m4',
'configure.ac'
],
{
'AC_LIBTOOL_LINKER_OPTION' => 1,
'_LT_AC_TAGVAR' => 1,
'AC_LIBTOOL_PROG_COMPILER_PIC' => 1,
'include' => 1,
'AM_PROG_LD' => 1,
'AC_PATH_MAGIC' => 1,
'AC_LIBTOOL_LANG_RC_CONFIG' => 1,
'AM_MISSING_PROG' => 1,
'LT_SUPPORTED_TAG' => 1,
'm4_include' => 1,
'LTDL_INSTALLABLE' => 1,
'_AC_PROG_LIBTOOL' => 1,
'AC_PROG_LD_GNU' => 1,
'AC_LIBTOOL_PICMODE' => 1,
'_AM_SET_OPTION' => 1,
'AC_PROG_LD_RELOAD_FLAG' => 1,
'LTDL_CONVENIENCE' => 1,
'AC_ENABLE_FAST_INSTALL' => 1,
'AC_PROG_NM' => 1,
'_LT_AC_LANG_RC_CONFIG' => 1,
'AM_PROG_CC_C_O' => 1,
'_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
'_LT_PROG_FC' => 1,
'AC_DEFUN_ONCE' => 1,
'AM_SET_DEPDIR' => 1,
'_AM_SET_OPTIONS' => 1,
'AM_DEP_TRACK' => 1,
'LT_PATH_NM' => 1,
'AC_DISABLE_FAST_INSTALL' => 1,
'_LT_AC_LANG_GCJ_CONFIG' => 1,
'_AM_IF_OPTION' => 1,
'AU_DEFUN' => 1,
'LT_INIT' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
'AC_LIBTOOL_LANG_CXX_CONFIG' => 1,
'_LT_AC_PROG_ECHO_BACKSLASH' => 1,
'LTOPTIONS_VERSION' => 1,
'LT_AC_PROG_RC' => 1,
'LT_SYS_SYMBOL_USCORE' => 1,
'AC_LTDL_SYS_DLOPEN_DEPLIBS' => 1,
'AM_CONDITIONAL' => 1,
'AC_LIBTOOL_DLOPEN' => 1,
'_LT_COMPILER_BOILERPLATE' => 1,
'_LT_AC_LANG_CXX' => 1,
'AM_AUX_DIR_EXPAND' => 1,
'AC_DEFUN' => 1,
'AM_PROG_AS' => 1,
'_LT_LINKER_OPTION' => 1,
'_AM_DEPENDENCIES' => 1,
'_LT_AC_SYS_COMPILER' => 1,
'_LT_PREPARE_SED_QUOTE_VARS' => 1,
'AC_LIBTOOL_LANG_F77_CONFIG' => 1,
'LT_SYS_MODULE_EXT' => 1,
'AC_PROG_LIBTOOL' => 1,
'_LT_AC_TAGCONFIG' => 1,
'LT_CMD_MAX_LEN' => 1,
'AC_LTDL_PREOPEN' => 1,
'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1,
'AC_DISABLE_STATIC' => 1,
'AM_RUN_LOG' => 1,
'_LT_PROG_F77' => 1,
'_m4_warn' => 1,
'AC_LIBTOOL_F77' => 1,
'AC_LTDL_ENABLE_INSTALL' => 1,
'LT_AC_PROG_GCJ' => 1,
'LT_LANG' => 1,
'_LT_AC_LANG_C_CONFIG' => 1,
'AM_SUBST_NOTMAKE' => 1,
'LTOBSOLETE_VERSION' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'LT_WITH_LTDL' => 1,
'AC_LIBTOOL_SETUP' => 1,
'LT_PROG_GCJ' => 1,
'LT_OUTPUT' => 1,
'AC_LIB_LTDL' => 1,
'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1,
'AM_PROG_INSTALL_STRIP' => 1,
'AC_LIBTOOL_SYS_OLD_ARCHIVE' => 1,
'AC_LIBTOOL_RC' => 1,
'm4_pattern_allow' => 1,
'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1,
'AC_LTDL_SYSSEARCHPATH' => 1,
'LT_SYS_MODULE_PATH' => 1,
'AM_DISABLE_SHARED' => 1,
'AC_LIBLTDL_CONVENIENCE' => 1,
'LT_PATH_LD' => 1,
'AC_LTDL_DLLIB' => 1,
'_LT_AC_CHECK_DLFCN' => 1,
'AC_LIBTOOL_PROG_CC_C_O' => 1,
'AM_SET_LEADING_DOT' => 1,
'AM_PROG_NM' => 1,
'AC_LIBTOOL_POSTDEP_PREDEP' => 1,
'AC_WITH_LTDL' => 1,
'_LT_AC_LANG_F77' => 1,
'LT_SYS_DLOPEN_SELF' => 1,
'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1,
'LT_FUNC_ARGZ' => 1,
'AC_LIBTOOL_DLOPEN_SELF' => 1,
'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1,
'_LT_PATH_TOOL_PREFIX' => 1,
'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1,
'_LT_AC_LANG_F77_CONFIG' => 1,
'_AM_AUTOCONF_VERSION' => 1,
'_LT_REQUIRED_DARWIN_CHECKS' => 1,
'_LT_DLL_DEF_P' => 1,
'_LT_LIBOBJ' => 1,
'AC_LTDL_OBJDIR' => 1,
'AM_MAKE_INCLUDE' => 1,
'AM_DISABLE_STATIC' => 1,
'LTDL_INIT' => 1,
'AM_PROG_INSTALL_SH' => 1,
'LT_AC_PROG_SED' => 1,
'_LTDL_SETUP' => 1,
'AC_LIBTOOL_COMPILER_OPTION' => 1,
'_AM_CONFIG_MACRO_DIRS' => 1,
'AC_LIBTOOL_WIN32_DLL' => 1,
'AC_LTDL_SHLIBPATH' => 1,
'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1,
'AC_LIBTOOL_PROG_LD_SHLIBS' => 1,
'AM_INIT_AUTOMAKE' => 1,
'_LT_PROG_CXX' => 1,
'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1,
'AC_LIBTOOL_CXX' => 1,
'LT_LIB_DLLOAD' => 1,
'LT_PROG_RC' => 1,
'AC_CONFIG_MACRO_DIR' => 1,
'_LT_CC_BASENAME' => 1,
'_LT_AC_LOCK' => 1,
'AC_LIBTOOL_SYS_LIB_STRIP' => 1,
'AC_LIBTOOL_CONFIG' => 1,
'_LT_AC_LANG_GCJ' => 1,
'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1,
'_LT_COMPILER_OPTION' => 1,
'AC_DEPLIBS_CHECK_METHOD' => 1,
'_AM_MANGLE_OPTION' => 1,
'AC_LTDL_SHLIBEXT' => 1,
'LTSUGAR_VERSION' => 1,
'_LT_LINKER_BOILERPLATE' => 1,
'AC_PATH_TOOL_PREFIX' => 1,
'_LT_AC_PROG_CXXCPP' => 1,
'_AM_PROG_CC_C_O' => 1,
'AM_SANITY_CHECK' => 1,
'LT_SYS_DLSEARCH_PATH' => 1,
'_AC_AM_CONFIG_HEADER_HOOK' => 1,
'AC_CHECK_LIBM' => 1,
'AM_SILENT_RULES' => 1,
'LT_LIB_M' => 1,
'AC_LIBTOOL_OBJDIR' => 1,
'AC_PROG_LD' => 1,
'_LT_WITH_SYSROOT' => 1,
'AC_DISABLE_SHARED' => 1,
'AC_ENABLE_SHARED' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AM_PROG_LIBTOOL' => 1,
'_LT_PROG_ECHO_BACKSLASH' => 1,
'AC_LIBTOOL_FC' => 1,
'AC_PROG_EGREP' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_LTDL_SYMBOL_USCORE' => 1,
'_LT_AC_FILE_LTDLL_C' => 1,
'AC_LIBLTDL_INSTALLABLE' => 1,
'LTVERSION_VERSION' => 1,
'AC_LIBTOOL_LANG_C_CONFIG' => 1,
'AM_ENABLE_SHARED' => 1,
'LT_AC_PROG_EGREP' => 1,
'_LT_AC_TRY_DLOPEN_SELF' => 1,
'AM_MISSING_HAS_RUN' => 1,
'AC_ENABLE_STATIC' => 1,
'm4_pattern_forbid' => 1,
'AC_LTDL_DLSYM_USCORE' => 1,
'AC_LIBTOOL_GCJ' => 1,
'_LT_PROG_LTMAIN' => 1,
'_AM_PROG_TAR' => 1,
'_LT_AC_SYS_LIBPATH_AIX' => 1,
'LT_FUNC_DLSYM_USCORE' => 1,
'_LT_AC_SHELL_INIT' => 1,
'AM_ENABLE_STATIC' => 1,
'_LT_AC_LANG_CXX_CONFIG' => 1,
'LT_SYS_DLOPEN_DEPLIBS' => 1,
'LT_PROG_GO' => 1
}
], 'Autom4te::Request' ),
bless( [
'1',
1,
[
'/usr/local/share/autoconf-2.69'
],
[
'/usr/local/share/autoconf-2.69/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.ac'
],
{
'AC_FC_PP_DEFINE' => 1,
'AM_CONDITIONAL' => 1,
'AM_PROG_FC_C_O' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'AM_NLS' => 1,
'AC_CONFIG_HEADERS' => 1,
'm4_pattern_forbid' => 1,
'AM_GNU_GETTEXT' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AM_PROG_CXX_C_O' => 1,
'AM_POT_TOOLS' => 1,
'AC_CONFIG_FILES' => 1,
'AC_CONFIG_LINKS' => 1,
'AC_LIBSOURCE' => 1,
'_AM_COND_ENDIF' => 1,
'AC_CANONICAL_HOST' => 1,
'_AM_COND_ELSE' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AM_PATH_GUILE' => 1,
'LT_INIT' => 1,
'm4_pattern_allow' => 1,
'AC_INIT' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AC_FC_PP_SRCEXT' => 1,
'AM_MAINTAINER_MODE' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_SUBST_TRACE' => 1,
'AH_OUTPUT' => 1,
'AM_PROG_MKDIR_P' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
'_m4_warn' => 1,
'm4_sinclude' => 1,
'AM_XGETTEXT_OPTION' => 1,
'AM_PROG_AR' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'_AM_COND_IF' => 1,
'AM_PROG_CC_C_O' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AC_CANONICAL_TARGET' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'sinclude' => 1,
'include' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AM_PROG_MOC' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_FC_FREEFORM' => 1,
'm4_include' => 1,
'AM_SILENT_RULES' => 1,
'LT_SUPPORTED_TAG' => 1,
'_LT_AC_TAGCONFIG' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_SUBST' => 1,
'AC_CONFIG_AUX_DIR' => 1
}
], 'Autom4te::Request' )
);

2787
autom4te.cache/traces.0 Normal file

File diff suppressed because it is too large Load diff

646
autom4te.cache/traces.1 Normal file
View file

@ -0,0 +1,646 @@
m4trace:configure.ac:26: -1- AC_INIT([cortex-strings], [1.1-2012.06~dev])
m4trace:configure.ac:26: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.ac:26: -1- m4_pattern_forbid([_AC_])
m4trace:configure.ac:26: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
m4trace:configure.ac:26: -1- m4_pattern_allow([^AS_FLAGS$])
m4trace:configure.ac:26: -1- m4_pattern_forbid([^_?m4_])
m4trace:configure.ac:26: -1- m4_pattern_forbid([^dnl$])
m4trace:configure.ac:26: -1- m4_pattern_forbid([^_?AS_])
m4trace:configure.ac:26: -1- AC_SUBST([SHELL])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([SHELL])
m4trace:configure.ac:26: -1- m4_pattern_allow([^SHELL$])
m4trace:configure.ac:26: -1- AC_SUBST([PATH_SEPARATOR])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PATH_SEPARATOR])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PATH_SEPARATOR$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_NAME])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_TARNAME])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_VERSION])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_STRING])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:26: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([PACKAGE_URL])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.ac:26: -1- AC_SUBST([exec_prefix], [NONE])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([exec_prefix])
m4trace:configure.ac:26: -1- m4_pattern_allow([^exec_prefix$])
m4trace:configure.ac:26: -1- AC_SUBST([prefix], [NONE])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([prefix])
m4trace:configure.ac:26: -1- m4_pattern_allow([^prefix$])
m4trace:configure.ac:26: -1- AC_SUBST([program_transform_name], [s,x,x,])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([program_transform_name])
m4trace:configure.ac:26: -1- m4_pattern_allow([^program_transform_name$])
m4trace:configure.ac:26: -1- AC_SUBST([bindir], ['${exec_prefix}/bin'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([bindir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^bindir$])
m4trace:configure.ac:26: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([sbindir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^sbindir$])
m4trace:configure.ac:26: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([libexecdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^libexecdir$])
m4trace:configure.ac:26: -1- AC_SUBST([datarootdir], ['${prefix}/share'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([datarootdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^datarootdir$])
m4trace:configure.ac:26: -1- AC_SUBST([datadir], ['${datarootdir}'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([datadir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^datadir$])
m4trace:configure.ac:26: -1- AC_SUBST([sysconfdir], ['${prefix}/etc'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([sysconfdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^sysconfdir$])
m4trace:configure.ac:26: -1- AC_SUBST([sharedstatedir], ['${prefix}/com'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([sharedstatedir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^sharedstatedir$])
m4trace:configure.ac:26: -1- AC_SUBST([localstatedir], ['${prefix}/var'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([localstatedir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^localstatedir$])
m4trace:configure.ac:26: -1- AC_SUBST([includedir], ['${prefix}/include'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([includedir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^includedir$])
m4trace:configure.ac:26: -1- AC_SUBST([oldincludedir], ['/usr/include'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([oldincludedir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^oldincludedir$])
m4trace:configure.ac:26: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
['${datarootdir}/doc/${PACKAGE}'])])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([docdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^docdir$])
m4trace:configure.ac:26: -1- AC_SUBST([infodir], ['${datarootdir}/info'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([infodir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^infodir$])
m4trace:configure.ac:26: -1- AC_SUBST([htmldir], ['${docdir}'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([htmldir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^htmldir$])
m4trace:configure.ac:26: -1- AC_SUBST([dvidir], ['${docdir}'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([dvidir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^dvidir$])
m4trace:configure.ac:26: -1- AC_SUBST([pdfdir], ['${docdir}'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([pdfdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^pdfdir$])
m4trace:configure.ac:26: -1- AC_SUBST([psdir], ['${docdir}'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([psdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^psdir$])
m4trace:configure.ac:26: -1- AC_SUBST([libdir], ['${exec_prefix}/lib'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([libdir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^libdir$])
m4trace:configure.ac:26: -1- AC_SUBST([localedir], ['${datarootdir}/locale'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([localedir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^localedir$])
m4trace:configure.ac:26: -1- AC_SUBST([mandir], ['${datarootdir}/man'])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([mandir])
m4trace:configure.ac:26: -1- m4_pattern_allow([^mandir$])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */
@%:@undef PACKAGE_NAME])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */
@%:@undef PACKAGE_TARNAME])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */
@%:@undef PACKAGE_VERSION])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */
@%:@undef PACKAGE_STRING])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */
@%:@undef PACKAGE_BUGREPORT])
m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL])
m4trace:configure.ac:26: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.ac:26: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */
@%:@undef PACKAGE_URL])
m4trace:configure.ac:26: -1- AC_SUBST([DEFS])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([DEFS])
m4trace:configure.ac:26: -1- m4_pattern_allow([^DEFS$])
m4trace:configure.ac:26: -1- AC_SUBST([ECHO_C])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([ECHO_C])
m4trace:configure.ac:26: -1- m4_pattern_allow([^ECHO_C$])
m4trace:configure.ac:26: -1- AC_SUBST([ECHO_N])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([ECHO_N])
m4trace:configure.ac:26: -1- m4_pattern_allow([^ECHO_N$])
m4trace:configure.ac:26: -1- AC_SUBST([ECHO_T])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([ECHO_T])
m4trace:configure.ac:26: -1- m4_pattern_allow([^ECHO_T$])
m4trace:configure.ac:26: -1- AC_SUBST([LIBS])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.ac:26: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:26: -1- AC_SUBST([build_alias])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([build_alias])
m4trace:configure.ac:26: -1- m4_pattern_allow([^build_alias$])
m4trace:configure.ac:26: -1- AC_SUBST([host_alias])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([host_alias])
m4trace:configure.ac:26: -1- m4_pattern_allow([^host_alias$])
m4trace:configure.ac:26: -1- AC_SUBST([target_alias])
m4trace:configure.ac:26: -1- AC_SUBST_TRACE([target_alias])
m4trace:configure.ac:26: -1- m4_pattern_allow([^target_alias$])
m4trace:configure.ac:27: -1- AM_INIT_AUTOMAKE([foreign subdir-objects color-tests dist-bzip2])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$])
m4trace:configure.ac:27: -1- AM_AUTOMAKE_VERSION([1.15])
m4trace:configure.ac:27: -1- AC_REQUIRE_AUX_FILE([install-sh])
m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_PROGRAM])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_PROGRAM])
m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_PROGRAM$])
m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_SCRIPT])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_SCRIPT])
m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_SCRIPT$])
m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_DATA])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_DATA])
m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_DATA$])
m4trace:configure.ac:27: -1- AC_SUBST([am__isrc], [' -I$(srcdir)'])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([am__isrc])
m4trace:configure.ac:27: -1- m4_pattern_allow([^am__isrc$])
m4trace:configure.ac:27: -1- _AM_SUBST_NOTMAKE([am__isrc])
m4trace:configure.ac:27: -1- AC_SUBST([CYGPATH_W])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([CYGPATH_W])
m4trace:configure.ac:27: -1- m4_pattern_allow([^CYGPATH_W$])
m4trace:configure.ac:27: -1- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([PACKAGE])
m4trace:configure.ac:27: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:27: -1- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([VERSION])
m4trace:configure.ac:27: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:27: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE])
m4trace:configure.ac:27: -1- m4_pattern_allow([^PACKAGE$])
m4trace:configure.ac:27: -1- AH_OUTPUT([PACKAGE], [/* Name of package */
@%:@undef PACKAGE])
m4trace:configure.ac:27: -1- AC_DEFINE_TRACE_LITERAL([VERSION])
m4trace:configure.ac:27: -1- m4_pattern_allow([^VERSION$])
m4trace:configure.ac:27: -1- AH_OUTPUT([VERSION], [/* Version number of package */
@%:@undef VERSION])
m4trace:configure.ac:27: -1- AC_REQUIRE_AUX_FILE([missing])
m4trace:configure.ac:27: -1- AC_SUBST([ACLOCAL])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([ACLOCAL])
m4trace:configure.ac:27: -1- m4_pattern_allow([^ACLOCAL$])
m4trace:configure.ac:27: -1- AC_SUBST([AUTOCONF])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AUTOCONF])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AUTOCONF$])
m4trace:configure.ac:27: -1- AC_SUBST([AUTOMAKE])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AUTOMAKE])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AUTOMAKE$])
m4trace:configure.ac:27: -1- AC_SUBST([AUTOHEADER])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AUTOHEADER])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AUTOHEADER$])
m4trace:configure.ac:27: -1- AC_SUBST([MAKEINFO])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([MAKEINFO])
m4trace:configure.ac:27: -1- m4_pattern_allow([^MAKEINFO$])
m4trace:configure.ac:27: -1- AC_SUBST([install_sh])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([install_sh])
m4trace:configure.ac:27: -1- m4_pattern_allow([^install_sh$])
m4trace:configure.ac:27: -1- AC_SUBST([STRIP])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([STRIP])
m4trace:configure.ac:27: -1- m4_pattern_allow([^STRIP$])
m4trace:configure.ac:27: -1- AC_SUBST([INSTALL_STRIP_PROGRAM])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([INSTALL_STRIP_PROGRAM])
m4trace:configure.ac:27: -1- m4_pattern_allow([^INSTALL_STRIP_PROGRAM$])
m4trace:configure.ac:27: -1- AC_REQUIRE_AUX_FILE([install-sh])
m4trace:configure.ac:27: -1- AC_SUBST([MKDIR_P])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([MKDIR_P])
m4trace:configure.ac:27: -1- m4_pattern_allow([^MKDIR_P$])
m4trace:configure.ac:27: -1- AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([mkdir_p])
m4trace:configure.ac:27: -1- m4_pattern_allow([^mkdir_p$])
m4trace:configure.ac:27: -1- AC_SUBST([AWK])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AWK])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AWK$])
m4trace:configure.ac:27: -1- AC_SUBST([SET_MAKE])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([SET_MAKE])
m4trace:configure.ac:27: -1- m4_pattern_allow([^SET_MAKE$])
m4trace:configure.ac:27: -1- AC_SUBST([am__leading_dot])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([am__leading_dot])
m4trace:configure.ac:27: -1- m4_pattern_allow([^am__leading_dot$])
m4trace:configure.ac:27: -1- AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AMTAR])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AMTAR$])
m4trace:configure.ac:27: -1- AC_SUBST([am__tar])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([am__tar])
m4trace:configure.ac:27: -1- m4_pattern_allow([^am__tar$])
m4trace:configure.ac:27: -1- AC_SUBST([am__untar])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([am__untar])
m4trace:configure.ac:27: -1- m4_pattern_allow([^am__untar$])
m4trace:configure.ac:27: -1- AM_SILENT_RULES
m4trace:configure.ac:27: -1- AC_SUBST([AM_V])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AM_V])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AM_V$])
m4trace:configure.ac:27: -1- _AM_SUBST_NOTMAKE([AM_V])
m4trace:configure.ac:27: -1- AC_SUBST([AM_DEFAULT_V])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AM_DEFAULT_V])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AM_DEFAULT_V$])
m4trace:configure.ac:27: -1- _AM_SUBST_NOTMAKE([AM_DEFAULT_V])
m4trace:configure.ac:27: -1- AC_SUBST([AM_DEFAULT_VERBOSITY])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AM_DEFAULT_VERBOSITY])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AM_DEFAULT_VERBOSITY$])
m4trace:configure.ac:27: -1- AC_SUBST([AM_BACKSLASH])
m4trace:configure.ac:27: -1- AC_SUBST_TRACE([AM_BACKSLASH])
m4trace:configure.ac:27: -1- m4_pattern_allow([^AM_BACKSLASH$])
m4trace:configure.ac:27: -1- _AM_SUBST_NOTMAKE([AM_BACKSLASH])
m4trace:configure.ac:28: -1- AC_CONFIG_HEADERS([config.h])
m4trace:configure.ac:29: -1- AC_CONFIG_FILES([Makefile])
m4trace:configure.ac:30: -1- AC_CANONICAL_HOST
m4trace:configure.ac:30: -1- AC_CANONICAL_BUILD
m4trace:configure.ac:30: -1- AC_REQUIRE_AUX_FILE([config.sub])
m4trace:configure.ac:30: -1- AC_REQUIRE_AUX_FILE([config.guess])
m4trace:configure.ac:30: -1- AC_SUBST([build], [$ac_cv_build])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([build])
m4trace:configure.ac:30: -1- m4_pattern_allow([^build$])
m4trace:configure.ac:30: -1- AC_SUBST([build_cpu], [$[1]])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([build_cpu])
m4trace:configure.ac:30: -1- m4_pattern_allow([^build_cpu$])
m4trace:configure.ac:30: -1- AC_SUBST([build_vendor], [$[2]])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([build_vendor])
m4trace:configure.ac:30: -1- m4_pattern_allow([^build_vendor$])
m4trace:configure.ac:30: -1- AC_SUBST([build_os])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([build_os])
m4trace:configure.ac:30: -1- m4_pattern_allow([^build_os$])
m4trace:configure.ac:30: -1- AC_SUBST([host], [$ac_cv_host])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([host])
m4trace:configure.ac:30: -1- m4_pattern_allow([^host$])
m4trace:configure.ac:30: -1- AC_SUBST([host_cpu], [$[1]])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([host_cpu])
m4trace:configure.ac:30: -1- m4_pattern_allow([^host_cpu$])
m4trace:configure.ac:30: -1- AC_SUBST([host_vendor], [$[2]])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([host_vendor])
m4trace:configure.ac:30: -1- m4_pattern_allow([^host_vendor$])
m4trace:configure.ac:30: -1- AC_SUBST([host_os])
m4trace:configure.ac:30: -1- AC_SUBST_TRACE([host_os])
m4trace:configure.ac:30: -1- m4_pattern_allow([^host_os$])
m4trace:configure.ac:31: -1- AC_SUBST([CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([CFLAGS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CFLAGS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:31: -1- AC_SUBST([LDFLAGS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([LDFLAGS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.ac:31: -1- AC_SUBST([LIBS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:31: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:31: -1- AC_SUBST([CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:31: -1- AC_SUBST([ac_ct_CC])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([ac_ct_CC])
m4trace:configure.ac:31: -1- m4_pattern_allow([^ac_ct_CC$])
m4trace:configure.ac:31: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([EXEEXT])
m4trace:configure.ac:31: -1- m4_pattern_allow([^EXEEXT$])
m4trace:configure.ac:31: -1- AC_SUBST([OBJEXT], [$ac_cv_objext])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([OBJEXT])
m4trace:configure.ac:31: -1- m4_pattern_allow([^OBJEXT$])
m4trace:configure.ac:31: -1- AC_REQUIRE_AUX_FILE([compile])
m4trace:configure.ac:31: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([DEPDIR])
m4trace:configure.ac:31: -1- m4_pattern_allow([^DEPDIR$])
m4trace:configure.ac:31: -1- AC_SUBST([am__include])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__include])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__include$])
m4trace:configure.ac:31: -1- AC_SUBST([am__quote])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__quote])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__quote$])
m4trace:configure.ac:31: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
m4trace:configure.ac:31: -1- AC_SUBST([AMDEP_TRUE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([AMDEP_TRUE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^AMDEP_TRUE$])
m4trace:configure.ac:31: -1- AC_SUBST([AMDEP_FALSE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([AMDEP_FALSE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^AMDEP_FALSE$])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([AMDEP_TRUE])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([AMDEP_FALSE])
m4trace:configure.ac:31: -1- AC_SUBST([AMDEPBACKSLASH])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([AMDEPBACKSLASH])
m4trace:configure.ac:31: -1- m4_pattern_allow([^AMDEPBACKSLASH$])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])
m4trace:configure.ac:31: -1- AC_SUBST([am__nodep])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__nodep])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__nodep$])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([am__nodep])
m4trace:configure.ac:31: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CCDEPMODE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CCDEPMODE$])
m4trace:configure.ac:31: -1- AM_CONDITIONAL([am__fastdepCC], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3])
m4trace:configure.ac:31: -1- AC_SUBST([am__fastdepCC_TRUE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__fastdepCC_TRUE$])
m4trace:configure.ac:31: -1- AC_SUBST([am__fastdepCC_FALSE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__fastdepCC_FALSE$])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE])
m4trace:configure.ac:31: -1- AC_SUBST([CCAS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CCAS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CCAS$])
m4trace:configure.ac:31: -1- AC_SUBST([CCASFLAGS])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CCASFLAGS])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CCASFLAGS$])
m4trace:configure.ac:31: -1- AC_SUBST([CCASDEPMODE], [depmode=$am_cv_CCAS_dependencies_compiler_type])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([CCASDEPMODE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^CCASDEPMODE$])
m4trace:configure.ac:31: -1- AM_CONDITIONAL([am__fastdepCCAS], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CCAS_dependencies_compiler_type" = gcc3])
m4trace:configure.ac:31: -1- AC_SUBST([am__fastdepCCAS_TRUE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__fastdepCCAS_TRUE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__fastdepCCAS_TRUE$])
m4trace:configure.ac:31: -1- AC_SUBST([am__fastdepCCAS_FALSE])
m4trace:configure.ac:31: -1- AC_SUBST_TRACE([am__fastdepCCAS_FALSE])
m4trace:configure.ac:31: -1- m4_pattern_allow([^am__fastdepCCAS_FALSE$])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([am__fastdepCCAS_TRUE])
m4trace:configure.ac:31: -1- _AM_SUBST_NOTMAKE([am__fastdepCCAS_FALSE])
m4trace:configure.ac:32: -1- AC_SUBST([CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:32: -1- AC_SUBST([CFLAGS])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CFLAGS])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CFLAGS$])
m4trace:configure.ac:32: -1- AC_SUBST([LDFLAGS])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([LDFLAGS])
m4trace:configure.ac:32: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.ac:32: -1- AC_SUBST([LIBS])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.ac:32: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.ac:32: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:32: -1- AC_SUBST([CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:32: -1- AC_SUBST([CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:32: -1- AC_SUBST([CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:32: -1- AC_SUBST([CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CC$])
m4trace:configure.ac:32: -1- AC_SUBST([ac_ct_CC])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([ac_ct_CC])
m4trace:configure.ac:32: -1- m4_pattern_allow([^ac_ct_CC$])
m4trace:configure.ac:32: -1- AC_REQUIRE_AUX_FILE([compile])
m4trace:configure.ac:32: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([CCDEPMODE])
m4trace:configure.ac:32: -1- m4_pattern_allow([^CCDEPMODE$])
m4trace:configure.ac:32: -1- AM_CONDITIONAL([am__fastdepCC], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3])
m4trace:configure.ac:32: -1- AC_SUBST([am__fastdepCC_TRUE])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([am__fastdepCC_TRUE])
m4trace:configure.ac:32: -1- m4_pattern_allow([^am__fastdepCC_TRUE$])
m4trace:configure.ac:32: -1- AC_SUBST([am__fastdepCC_FALSE])
m4trace:configure.ac:32: -1- AC_SUBST_TRACE([am__fastdepCC_FALSE])
m4trace:configure.ac:32: -1- m4_pattern_allow([^am__fastdepCC_FALSE$])
m4trace:configure.ac:32: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_TRUE])
m4trace:configure.ac:32: -1- _AM_SUBST_NOTMAKE([am__fastdepCC_FALSE])
m4trace:configure.ac:33: -1- AC_PROG_LIBTOOL
m4trace:configure.ac:33: -1- _m4_warn([obsolete], [The macro `AC_PROG_LIBTOOL' is obsolete.
You should run autoupdate.], [aclocal.m4:121: AC_PROG_LIBTOOL is expanded from...
configure.ac:33: the top level])
m4trace:configure.ac:33: -1- LT_INIT
m4trace:configure.ac:33: -1- m4_pattern_forbid([^_?LT_[A-Z_]+$])
m4trace:configure.ac:33: -1- m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])
m4trace:configure.ac:33: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])
m4trace:configure.ac:33: -1- AC_SUBST([LIBTOOL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([LIBTOOL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LIBTOOL$])
m4trace:configure.ac:33: -1- AC_SUBST([SED])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([SED])
m4trace:configure.ac:33: -1- m4_pattern_allow([^SED$])
m4trace:configure.ac:33: -1- AC_SUBST([GREP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([GREP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:33: -1- AC_SUBST([EGREP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([EGREP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^EGREP$])
m4trace:configure.ac:33: -1- AC_SUBST([FGREP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([FGREP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^FGREP$])
m4trace:configure.ac:33: -1- AC_SUBST([GREP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([GREP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^GREP$])
m4trace:configure.ac:33: -1- AC_SUBST([LD])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([LD])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LD$])
m4trace:configure.ac:33: -1- AC_SUBST([DUMPBIN])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([DUMPBIN])
m4trace:configure.ac:33: -1- m4_pattern_allow([^DUMPBIN$])
m4trace:configure.ac:33: -1- AC_SUBST([ac_ct_DUMPBIN])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([ac_ct_DUMPBIN])
m4trace:configure.ac:33: -1- m4_pattern_allow([^ac_ct_DUMPBIN$])
m4trace:configure.ac:33: -1- AC_SUBST([DUMPBIN])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([DUMPBIN])
m4trace:configure.ac:33: -1- m4_pattern_allow([^DUMPBIN$])
m4trace:configure.ac:33: -1- AC_SUBST([NM])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([NM])
m4trace:configure.ac:33: -1- m4_pattern_allow([^NM$])
m4trace:configure.ac:33: -1- AC_SUBST([LN_S], [$as_ln_s])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([LN_S])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LN_S$])
m4trace:configure.ac:33: -1- AC_SUBST([OBJDUMP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([OBJDUMP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^OBJDUMP$])
m4trace:configure.ac:33: -1- AC_SUBST([OBJDUMP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([OBJDUMP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^OBJDUMP$])
m4trace:configure.ac:33: -1- AC_SUBST([DLLTOOL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([DLLTOOL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^DLLTOOL$])
m4trace:configure.ac:33: -1- AC_SUBST([DLLTOOL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([DLLTOOL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^DLLTOOL$])
m4trace:configure.ac:33: -1- AC_SUBST([AR])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([AR])
m4trace:configure.ac:33: -1- m4_pattern_allow([^AR$])
m4trace:configure.ac:33: -1- AC_SUBST([ac_ct_AR])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([ac_ct_AR])
m4trace:configure.ac:33: -1- m4_pattern_allow([^ac_ct_AR$])
m4trace:configure.ac:33: -1- AC_SUBST([STRIP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([STRIP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^STRIP$])
m4trace:configure.ac:33: -1- AC_SUBST([RANLIB])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([RANLIB])
m4trace:configure.ac:33: -1- m4_pattern_allow([^RANLIB$])
m4trace:configure.ac:33: -1- m4_pattern_allow([LT_OBJDIR])
m4trace:configure.ac:33: -1- AC_DEFINE_TRACE_LITERAL([LT_OBJDIR])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LT_OBJDIR$])
m4trace:configure.ac:33: -1- AH_OUTPUT([LT_OBJDIR], [/* Define to the sub-directory where libtool stores uninstalled libraries. */
@%:@undef LT_OBJDIR])
m4trace:configure.ac:33: -1- LT_SUPPORTED_TAG([CC])
m4trace:configure.ac:33: -1- AC_SUBST([MANIFEST_TOOL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([MANIFEST_TOOL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^MANIFEST_TOOL$])
m4trace:configure.ac:33: -1- AC_SUBST([DSYMUTIL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([DSYMUTIL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^DSYMUTIL$])
m4trace:configure.ac:33: -1- AC_SUBST([NMEDIT])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([NMEDIT])
m4trace:configure.ac:33: -1- m4_pattern_allow([^NMEDIT$])
m4trace:configure.ac:33: -1- AC_SUBST([LIPO])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([LIPO])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LIPO$])
m4trace:configure.ac:33: -1- AC_SUBST([OTOOL])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([OTOOL])
m4trace:configure.ac:33: -1- m4_pattern_allow([^OTOOL$])
m4trace:configure.ac:33: -1- AC_SUBST([OTOOL64])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([OTOOL64])
m4trace:configure.ac:33: -1- m4_pattern_allow([^OTOOL64$])
m4trace:configure.ac:33: -1- AC_SUBST([LT_SYS_LIBRARY_PATH])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([LT_SYS_LIBRARY_PATH])
m4trace:configure.ac:33: -1- m4_pattern_allow([^LT_SYS_LIBRARY_PATH$])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the <dlfcn.h> header file. */
@%:@undef HAVE_DLFCN_H])
m4trace:configure.ac:33: -1- AC_SUBST([CPP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([CPP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:33: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.ac:33: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.ac:33: -1- AC_SUBST([CPP])
m4trace:configure.ac:33: -1- AC_SUBST_TRACE([CPP])
m4trace:configure.ac:33: -1- m4_pattern_allow([^CPP$])
m4trace:configure.ac:33: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS])
m4trace:configure.ac:33: -1- m4_pattern_allow([^STDC_HEADERS$])
m4trace:configure.ac:33: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */
@%:@undef STDC_HEADERS])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the <sys/types.h> header file. */
@%:@undef HAVE_SYS_TYPES_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the <sys/stat.h> header file. */
@%:@undef HAVE_SYS_STAT_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the <stdlib.h> header file. */
@%:@undef HAVE_STDLIB_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the <string.h> header file. */
@%:@undef HAVE_STRING_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the <memory.h> header file. */
@%:@undef HAVE_MEMORY_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the <strings.h> header file. */
@%:@undef HAVE_STRINGS_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the <inttypes.h> header file. */
@%:@undef HAVE_INTTYPES_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the <stdint.h> header file. */
@%:@undef HAVE_STDINT_H])
m4trace:configure.ac:33: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the <unistd.h> header file. */
@%:@undef HAVE_UNISTD_H])
m4trace:configure.ac:33: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DLFCN_H])
m4trace:configure.ac:33: -1- m4_pattern_allow([^HAVE_DLFCN_H$])
m4trace:configure.ac:53: -1- AM_CONDITIONAL([HOST_AARCH32], [test x$arch = xaarch32])
m4trace:configure.ac:53: -1- AC_SUBST([HOST_AARCH32_TRUE])
m4trace:configure.ac:53: -1- AC_SUBST_TRACE([HOST_AARCH32_TRUE])
m4trace:configure.ac:53: -1- m4_pattern_allow([^HOST_AARCH32_TRUE$])
m4trace:configure.ac:53: -1- AC_SUBST([HOST_AARCH32_FALSE])
m4trace:configure.ac:53: -1- AC_SUBST_TRACE([HOST_AARCH32_FALSE])
m4trace:configure.ac:53: -1- m4_pattern_allow([^HOST_AARCH32_FALSE$])
m4trace:configure.ac:53: -1- _AM_SUBST_NOTMAKE([HOST_AARCH32_TRUE])
m4trace:configure.ac:53: -1- _AM_SUBST_NOTMAKE([HOST_AARCH32_FALSE])
m4trace:configure.ac:54: -1- AM_CONDITIONAL([HOST_AARCH64], [test x$arch = xaarch64])
m4trace:configure.ac:54: -1- AC_SUBST([HOST_AARCH64_TRUE])
m4trace:configure.ac:54: -1- AC_SUBST_TRACE([HOST_AARCH64_TRUE])
m4trace:configure.ac:54: -1- m4_pattern_allow([^HOST_AARCH64_TRUE$])
m4trace:configure.ac:54: -1- AC_SUBST([HOST_AARCH64_FALSE])
m4trace:configure.ac:54: -1- AC_SUBST_TRACE([HOST_AARCH64_FALSE])
m4trace:configure.ac:54: -1- m4_pattern_allow([^HOST_AARCH64_FALSE$])
m4trace:configure.ac:54: -1- _AM_SUBST_NOTMAKE([HOST_AARCH64_TRUE])
m4trace:configure.ac:54: -1- _AM_SUBST_NOTMAKE([HOST_AARCH64_FALSE])
m4trace:configure.ac:55: -1- AM_CONDITIONAL([HOST_GENERIC], [test x$arch = xgeneric])
m4trace:configure.ac:55: -1- AC_SUBST([HOST_GENERIC_TRUE])
m4trace:configure.ac:55: -1- AC_SUBST_TRACE([HOST_GENERIC_TRUE])
m4trace:configure.ac:55: -1- m4_pattern_allow([^HOST_GENERIC_TRUE$])
m4trace:configure.ac:55: -1- AC_SUBST([HOST_GENERIC_FALSE])
m4trace:configure.ac:55: -1- AC_SUBST_TRACE([HOST_GENERIC_FALSE])
m4trace:configure.ac:55: -1- m4_pattern_allow([^HOST_GENERIC_FALSE$])
m4trace:configure.ac:55: -1- _AM_SUBST_NOTMAKE([HOST_GENERIC_TRUE])
m4trace:configure.ac:55: -1- _AM_SUBST_NOTMAKE([HOST_GENERIC_FALSE])
m4trace:configure.ac:69: -1- AC_SUBST([submachine])
m4trace:configure.ac:69: -1- AC_SUBST_TRACE([submachine])
m4trace:configure.ac:69: -1- m4_pattern_allow([^submachine$])
m4trace:configure.ac:70: -1- AM_CONDITIONAL([WITH_SUBMACHINE], [test x$submachine != x])
m4trace:configure.ac:70: -1- AC_SUBST([WITH_SUBMACHINE_TRUE])
m4trace:configure.ac:70: -1- AC_SUBST_TRACE([WITH_SUBMACHINE_TRUE])
m4trace:configure.ac:70: -1- m4_pattern_allow([^WITH_SUBMACHINE_TRUE$])
m4trace:configure.ac:70: -1- AC_SUBST([WITH_SUBMACHINE_FALSE])
m4trace:configure.ac:70: -1- AC_SUBST_TRACE([WITH_SUBMACHINE_FALSE])
m4trace:configure.ac:70: -1- m4_pattern_allow([^WITH_SUBMACHINE_FALSE$])
m4trace:configure.ac:70: -1- _AM_SUBST_NOTMAKE([WITH_SUBMACHINE_TRUE])
m4trace:configure.ac:70: -1- _AM_SUBST_NOTMAKE([WITH_SUBMACHINE_FALSE])
m4trace:configure.ac:73: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from...
configure.ac:73: the top level])
m4trace:configure.ac:77: -1- AC_SUBST([with_neon])
m4trace:configure.ac:77: -1- AC_SUBST_TRACE([with_neon])
m4trace:configure.ac:77: -1- m4_pattern_allow([^with_neon$])
m4trace:configure.ac:78: -1- AM_CONDITIONAL([WITH_NEON], [test x$with_neon = xyes])
m4trace:configure.ac:78: -1- AC_SUBST([WITH_NEON_TRUE])
m4trace:configure.ac:78: -1- AC_SUBST_TRACE([WITH_NEON_TRUE])
m4trace:configure.ac:78: -1- m4_pattern_allow([^WITH_NEON_TRUE$])
m4trace:configure.ac:78: -1- AC_SUBST([WITH_NEON_FALSE])
m4trace:configure.ac:78: -1- AC_SUBST_TRACE([WITH_NEON_FALSE])
m4trace:configure.ac:78: -1- m4_pattern_allow([^WITH_NEON_FALSE$])
m4trace:configure.ac:78: -1- _AM_SUBST_NOTMAKE([WITH_NEON_TRUE])
m4trace:configure.ac:78: -1- _AM_SUBST_NOTMAKE([WITH_NEON_FALSE])
m4trace:configure.ac:81: -2- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete.
You should run autoupdate.], [../../lib/autoconf/general.m4:207: AC_HELP_STRING is expanded from...
configure.ac:81: the top level])
m4trace:configure.ac:85: -1- AC_SUBST([with_vfp])
m4trace:configure.ac:85: -1- AC_SUBST_TRACE([with_vfp])
m4trace:configure.ac:85: -1- m4_pattern_allow([^with_vfp$])
m4trace:configure.ac:86: -1- AM_CONDITIONAL([WITH_VFP], [test x$with_vfp = xyes])
m4trace:configure.ac:86: -1- AC_SUBST([WITH_VFP_TRUE])
m4trace:configure.ac:86: -1- AC_SUBST_TRACE([WITH_VFP_TRUE])
m4trace:configure.ac:86: -1- m4_pattern_allow([^WITH_VFP_TRUE$])
m4trace:configure.ac:86: -1- AC_SUBST([WITH_VFP_FALSE])
m4trace:configure.ac:86: -1- AC_SUBST_TRACE([WITH_VFP_FALSE])
m4trace:configure.ac:86: -1- m4_pattern_allow([^WITH_VFP_FALSE$])
m4trace:configure.ac:86: -1- _AM_SUBST_NOTMAKE([WITH_VFP_TRUE])
m4trace:configure.ac:86: -1- _AM_SUBST_NOTMAKE([WITH_VFP_FALSE])
m4trace:configure.ac:88: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
m4trace:configure.ac:88: -1- m4_pattern_allow([^LIB@&t@OBJS$])
m4trace:configure.ac:88: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([LTLIBOBJS])
m4trace:configure.ac:88: -1- m4_pattern_allow([^LTLIBOBJS$])
m4trace:configure.ac:88: -1- AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])
m4trace:configure.ac:88: -1- AC_SUBST([am__EXEEXT_TRUE])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([am__EXEEXT_TRUE])
m4trace:configure.ac:88: -1- m4_pattern_allow([^am__EXEEXT_TRUE$])
m4trace:configure.ac:88: -1- AC_SUBST([am__EXEEXT_FALSE])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([am__EXEEXT_FALSE])
m4trace:configure.ac:88: -1- m4_pattern_allow([^am__EXEEXT_FALSE$])
m4trace:configure.ac:88: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_TRUE])
m4trace:configure.ac:88: -1- _AM_SUBST_NOTMAKE([am__EXEEXT_FALSE])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([top_builddir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([top_build_prefix])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([srcdir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([abs_srcdir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([top_srcdir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([abs_top_srcdir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([builddir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([abs_builddir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([abs_top_builddir])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([INSTALL])
m4trace:configure.ac:88: -1- AC_SUBST_TRACE([MKDIR_P])
m4trace:configure.ac:88: -1- AC_REQUIRE_AUX_FILE([ltmain.sh])

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

311
benchmarks/dhry/dhry.h Normal file
View file

@ -0,0 +1,311 @@
/*
**************************************************************************
* DHRYSTONE 2.1 BENCHMARK PC VERSION
**************************************************************************
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry.h (part 1 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
* Siemens AG, AUT E 51
* Postfach 3220
* 8520 Erlangen
* Germany (West)
* Phone: [+49]-9131-7-20330
* (8-17 Central European Time)
* Usenet: ..!mcsun!unido!estevax!weicker
*
* Original Version (in Ada) published in
* "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
* pp. 1013 - 1030, together with the statistics
* on which the distribution of statements etc. is based.
*
* In this C version, the following C library functions are used:
* - strcpy, strcmp (inside the measurement loop)
* - printf, scanf (outside the measurement loop)
* In addition, Berkeley UNIX system calls "times ()" or "time ()"
* are used for execution time measurement. For measurements
* on other systems, these calls have to be changed.
*
* Collection of Results:
* Reinhold Weicker (address see above) and
*
* Rick Richardson
* PC Research. Inc.
* 94 Apple Orchard Drive
* Tinton Falls, NJ 07724
* Phone: (201) 389-8963 (9-17 EST)
* Usenet: ...!uunet!pcrat!rick
*
* Please send results to Rick Richardson and/or Reinhold Weicker.
* Complete information should be given on hardware and software used.
* Hardware information includes: Machine type, CPU, type and size
* of caches; for microprocessors: clock frequency, memory speed
* (number of wait states).
* Software information includes: Compiler (and runtime library)
* manufacturer and version, compilation switches, OS version.
* The Operating System version may give an indication about the
* compiler; Dhrystone itself performs no OS calls in the measurement
* loop.
*
* The complete output generated by the program should be mailed
* such that at least some checks for correctness can be made.
*
**************************************************************************
*
* This version has changes made by Roy Longbottom to conform to a common
* format for a series of standard benchmarks for PCs:
*
* Running time greater than 5 seconds due to inaccuracy of the PC clock.
*
* Automatic adjustment of run time, no manually inserted parameters.
*
* Initial display of calibration times to confirm linearity.
*
* Display of results within one screen (or at a slow speed as the test
* progresses) so that it can be seen to have run successfully.
*
* Facilities to type in details of system used etc.
*
* All results and details appended to a results file.
*
*
* Roy Longbottom
* 101323.2241@compuserve.com
*
**************************************************************************
*
* For details of history, changes, other defines, benchmark construction
* statistics see official versions from ftp.nosc.mil/pub/aburto where
* the latest table of results (dhry.tbl) are available. See also
* netlib@ornl.gov
*
**************************************************************************
*
* Defines: The following "Defines" are possible:
* -DREG=register (default: Not defined)
* As an approximation to what an average C programmer
* might do, the "register" storage class is applied
* (if enabled by -DREG=register)
* - for local variables, if they are used (dynamically)
* five or more times
* - for parameters if they are used (dynamically)
* six or more times
* Note that an optimal "register" strategy is
* compiler-dependent, and that "register" declarations
* do not necessarily lead to faster execution.
* -DNOSTRUCTASSIGN (default: Not defined)
* Define if the C compiler does not support
* assignment of structures.
* -DNOENUMS (default: Not defined)
* Define if the C compiler does not support
* enumeration types.
***************************************************************************
*
* Compilation model and measurement (IMPORTANT):
*
* This C version of Dhrystone consists of three files:
* - dhry.h (this file, containing global definitions and comments)
* - dhry_1.c (containing the code corresponding to Ada package Pack_1)
* - dhry_2.c (containing the code corresponding to Ada package Pack_2)
*
* The following "ground rules" apply for measurements:
* - Separate compilation
* - No procedure merging
* - Otherwise, compiler optimizations are allowed but should be indicated
* - Default results are those without register declarations
* See the companion paper "Rationale for Dhrystone Version 2" for a more
* detailed discussion of these ground rules.
*
* For 16-Bit processors (e.g. 80186, 80286), times for all compilation
* models ("small", "medium", "large" etc.) should be given if possible,
* together with a definition of these models for the compiler system used.
*
**************************************************************************
* Examples of Pentium Results
*
* Dhrystone Benchmark Version 2.1 (Language: C)
*
* Month run 4/1996
* PC model Escom
* CPU Pentium
* Clock MHz 100
* Cache 256K
* Options Neptune chipset
* OS/DOS Windows 95
* Compiler Watcom C/ C++ 10.5 Win386
* OptLevel -otexan -zp8 -fp5 -5r
* Run by Roy Longbottom
* From UK
* Mail 101323.2241@compuserve.com
*
* Final values (* implementation-dependent):
*
* Int_Glob: O.K. 5
* Bool_Glob: O.K. 1
* Ch_1_Glob: O.K. A
* Ch_2_Glob: O.K. B
* Arr_1_Glob[8]: O.K. 7
* Arr_2_Glob8/7: O.K. 1600010
* Ptr_Glob->
* Ptr_Comp: * 98008
* Discr: O.K. 0
* Enum_Comp: O.K. 2
* Int_Comp: O.K. 17
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
* Next_Ptr_Glob->
* Ptr_Comp: * 98008 same as above
* Discr: O.K. 0
* Enum_Comp: O.K. 1
* Int_Comp: O.K. 18
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
* Int_1_Loc: O.K. 5
* Int_2_Loc: O.K. 13
* Int_3_Loc: O.K. 7
* Enum_Loc: O.K. 1
* Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
* Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
*
* Register option Selected.
*
* Microseconds 1 loop: 4.53
* Dhrystones / second: 220690
* VAX MIPS rating: 125.61
*
*
* Dhrystone Benchmark Version 2.1 (Language: C)
*
* Month run 4/1996
* PC model Escom
* CPU Pentium
* Clock MHz 100
* Cache 256K
* Options Neptune chipset
* OS/DOS Windows 95
* Compiler Watcom C/ C++ 10.5 Win386
* OptLevel No optimisation
* Run by Roy Longbottom
* From UK
* Mail 101323.2241@compuserve.com
*
* Final values (* implementation-dependent):
*
* Int_Glob: O.K. 5
* Bool_Glob: O.K. 1
* Ch_1_Glob: O.K. A
* Ch_2_Glob: O.K. B
* Arr_1_Glob[8]: O.K. 7
* Arr_2_Glob8/7: O.K. 320010
* Ptr_Glob->
* Ptr_Comp: * 98004
* Discr: O.K. 0
* Enum_Comp: O.K. 2
* Int_Comp: O.K. 17
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
* Next_Ptr_Glob->
* Ptr_Comp: * 98004 same as above
* Discr: O.K. 0
* Enum_Comp: O.K. 1
* Int_Comp: O.K. 18
* Str_Comp: O.K. DHRYSTONE PROGRAM, SOME STRING
* Int_1_Loc: O.K. 5
* Int_2_Loc: O.K. 13
* Int_3_Loc: O.K. 7
* Enum_Loc: O.K. 1
* Str_1_Loc: O.K. DHRYSTONE PROGRAM, 1'ST STRING
* Str_2_Loc: O.K. DHRYSTONE PROGRAM, 2'ND STRING
*
* Register option Not selected.
*
* Microseconds 1 loop: 20.06
* Dhrystones / second: 49844
* VAX MIPS rating: 28.37
*
**************************************************************************
*/
/* Compiler and system dependent definitions: */
#ifndef TIME
#define TIMES
#endif
/* Use times(2) time function unless */
/* explicitly defined otherwise */
#ifdef TIMES
/* #include <sys/types.h>
#include <sys/times.h> */
/* for "times" */
#endif
#define Mic_secs_Per_Second 1000000.0
/* Berkeley UNIX C returns process times in seconds/HZ */
#ifdef NOSTRUCTASSIGN
#define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
#else
#define structassign(d, s) d = s
#endif
#ifdef NOENUM
#define Ident_1 0
#define Ident_2 1
#define Ident_3 2
#define Ident_4 3
#define Ident_5 4
typedef int Enumeration;
#else
typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
Enumeration;
#endif
/* for boolean and enumeration types in Ada, Pascal */
/* General definitions: */
#include <stdio.h>
#include <string.h>
/* for strcpy, strcmp */
#define Null 0
/* Value of a Null pointer */
#define true 1
#define false 0
typedef int One_Thirty;
typedef int One_Fifty;
typedef char Capital_Letter;
typedef int Boolean;
typedef char Str_30 [31];
typedef int Arr_1_Dim [50];
typedef int Arr_2_Dim [50] [50];
typedef struct record
{
struct record *Ptr_Comp;
Enumeration Discr;
union {
struct {
Enumeration Enum_Comp;
int Int_Comp;
char Str_Comp [31];
} var_1;
struct {
Enumeration E_Comp_2;
char Str_2_Comp [31];
} var_2;
struct {
char Ch_1_Comp;
char Ch_2_Comp;
} var_3;
} variant;
} Rec_Type, *Rec_Pointer;

778
benchmarks/dhry/dhry_1.c Normal file
View file

@ -0,0 +1,778 @@
/*
*************************************************************************
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry_1.c (part 2 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
*
*************************************************************************
*/
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include "dhry.h"
/*COMPILER COMPILER COMPILER COMPILER COMPILER COMPILER COMPILER*/
#ifdef COW
#define compiler "Watcom C/C++ 10.5 Win386"
#define options " -otexan -zp8 -5r -ms"
#endif
#ifdef CNW
#define compiler "Watcom C/C++ 10.5 Win386"
#define options " No optimisation"
#endif
#ifdef COD
#define compiler "Watcom C/C++ 10.5 Dos4GW"
#define options " -otexan -zp8 -5r -ms"
#endif
#ifdef CND
#define compiler "Watcom C/C++ 10.5 Dos4GW"
#define options " No optimisation"
#endif
#ifdef CONT
#define compiler "Watcom C/C++ 10.5 Win32NT"
#define options " -otexan -zp8 -5r -ms"
#endif
#ifdef CNNT
#define compiler "Watcom C/C++ 10.5 Win32NT"
#define options " No optimisation"
#endif
#ifdef COO2
#define compiler "Watcom C/C++ 10.5 OS/2-32"
#define options " -otexan -zp8 -5r -ms"
#endif
#ifdef CNO2
#define compiler "Watcom C/C++ 10.5 OS/2-32"
#define options " No optimisation"
#endif
/* Global Variables: */
Rec_Pointer Ptr_Glob,
Next_Ptr_Glob;
int Int_Glob;
Boolean Bool_Glob;
char Ch_1_Glob,
Ch_2_Glob;
int Arr_1_Glob [50];
int Arr_2_Glob [50] [50];
int getinput = 1;
char Reg_Define[100] = "Register option Selected.";
Enumeration Func_1 (Capital_Letter Ch_1_Par_Val,
Capital_Letter Ch_2_Par_Val);
/*
forward declaration necessary since Enumeration may not simply be int
*/
#ifndef ROPT
#define REG
/* REG becomes defined as empty */
/* i.e. no register variables */
#else
#define REG register
#endif
void Proc_1 (REG Rec_Pointer Ptr_Val_Par);
void Proc_2 (One_Fifty *Int_Par_Ref);
void Proc_3 (Rec_Pointer *Ptr_Ref_Par);
void Proc_4 ();
void Proc_5 ();
void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par);
void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val,
One_Fifty *Int_Par_Ref);
void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref,
int Int_1_Par_Val, int Int_2_Par_Val);
Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref);
/* variables for time measurement: */
#define Too_Small_Time 2
/* Measurements should last at least 2 seconds */
double Begin_Time,
End_Time,
User_Time;
double Microseconds,
Dhrystones_Per_Second,
Vax_Mips;
/* end of variables for time measurement */
void main (int argc, char *argv[])
/*****/
/* main program, corresponds to procedures */
/* Main and Proc_0 in the Ada version */
{
double dtime();
One_Fifty Int_1_Loc;
REG One_Fifty Int_2_Loc;
One_Fifty Int_3_Loc;
REG char Ch_Index;
Enumeration Enum_Loc;
Str_30 Str_1_Loc;
Str_30 Str_2_Loc;
REG int Run_Index;
REG int Number_Of_Runs;
int endit, count = 10;
FILE *Ap;
char general[9][80] = {" "};
/* Initializations */
if (argc > 1)
{
switch (argv[1][0])
{
case 'N':
getinput = 0;
break;
case 'n':
getinput = 0;
break;
}
}
if ((Ap = fopen("Dhry.txt","a+")) == NULL)
{
printf("Can not open Dhry.txt\n\n");
printf("Press any key\n");
exit(1);
}
/***********************************************************************
* Change for compiler and optimisation used *
***********************************************************************/
Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
Ptr_Glob->Discr = Ident_1;
Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
Ptr_Glob->variant.var_1.Int_Comp = 40;
strcpy (Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING");
strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
Arr_2_Glob [8][7] = 10;
/* Was missing in published program. Without this statement, */
/* Arr_2_Glob [8][7] would have an undefined value. */
/* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
/* overflow may occur for this array element. */
printf ("\n");
printf ("Dhrystone Benchmark, Version 2.1 (Language: C or C++)\n");
printf ("\n");
if (getinput == 0)
{
printf ("No run time input data\n\n");
}
else
{
printf ("With run time input data\n\n");
}
printf ("Compiler %s\n", compiler);
printf ("Optimisation %s\n", options);
#ifdef ROPT
printf ("Register option selected\n\n");
#else
printf ("Register option not selected\n\n");
strcpy(Reg_Define, "Register option Not selected.");
#endif
/*
if (Reg)
{
printf ("Program compiled with 'register' attribute\n");
printf ("\n");
}
else
{
printf ("Program compiled without 'register' attribute\n");
printf ("\n");
}
printf ("Please give the number of runs through the benchmark: ");
{
int n;
scanf ("%d", &n);
Number_Of_Runs = n;
}
printf ("\n");
printf ("Execution starts, %d runs through Dhrystone\n",
Number_Of_Runs);
*/
Number_Of_Runs = 5000;
do
{
Number_Of_Runs = Number_Of_Runs * 2;
count = count - 1;
Arr_2_Glob [8][7] = 10;
/***************/
/* Start timer */
/***************/
Begin_Time = dtime();
for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
{
Proc_5();
Proc_4();
/* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
Int_1_Loc = 2;
Int_2_Loc = 3;
strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
Enum_Loc = Ident_2;
Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
/* Bool_Glob == 1 */
while (Int_1_Loc < Int_2_Loc) /* loop body executed once */
{
Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
/* Int_3_Loc == 7 */
Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
/* Int_3_Loc == 7 */
Int_1_Loc += 1;
} /* while */
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
/* Int_Glob == 5 */
Proc_1 (Ptr_Glob);
for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
/* loop body executed twice */
{
if (Enum_Loc == Func_1 (Ch_Index, 'C'))
/* then, not executed */
{
Proc_6 (Ident_1, &Enum_Loc);
strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
Int_2_Loc = Run_Index;
Int_Glob = Run_Index;
}
}
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
Int_2_Loc = Int_2_Loc * Int_1_Loc;
Int_1_Loc = Int_2_Loc / Int_3_Loc;
Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
/* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
Proc_2 (&Int_1_Loc);
/* Int_1_Loc == 5 */
} /* loop "for Run_Index" */
/**************/
/* Stop timer */
/**************/
End_Time = dtime();
User_Time = End_Time - Begin_Time;
printf ("%12.0f runs %6.2f seconds \n",(double) Number_Of_Runs, User_Time);
if (User_Time > 5)
{
count = 0;
}
else
{
if (User_Time < 0.1)
{
Number_Of_Runs = Number_Of_Runs * 5;
}
}
} /* calibrate/run do while */
while (count >0);
printf ("\n");
printf ("Final values (* implementation-dependent):\n");
printf ("\n");
printf ("Int_Glob: ");
if (Int_Glob == 5) printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Int_Glob);
printf ("Bool_Glob: ");
if (Bool_Glob == 1) printf ("O.K. ");
else printf ("WRONG ");
printf ("%d\n", Bool_Glob);
printf ("Ch_1_Glob: ");
if (Ch_1_Glob == 'A') printf ("O.K. ");
else printf ("WRONG ");
printf ("%c ", Ch_1_Glob);
printf ("Ch_2_Glob: ");
if (Ch_2_Glob == 'B') printf ("O.K. ");
else printf ("WRONG ");
printf ("%c\n", Ch_2_Glob);
printf ("Arr_1_Glob[8]: ");
if (Arr_1_Glob[8] == 7) printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Arr_1_Glob[8]);
printf ("Arr_2_Glob8/7: ");
if (Arr_2_Glob[8][7] == Number_Of_Runs + 10)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%10d\n", Arr_2_Glob[8][7]);
printf ("Ptr_Glob-> ");
printf (" Ptr_Comp: * %d\n", (int) Ptr_Glob->Ptr_Comp);
printf (" Discr: ");
if (Ptr_Glob->Discr == 0) printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Ptr_Glob->Discr);
printf ("Enum_Comp: ");
if (Ptr_Glob->variant.var_1.Enum_Comp == 2)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d\n", Ptr_Glob->variant.var_1.Enum_Comp);
printf (" Int_Comp: ");
if (Ptr_Glob->variant.var_1.Int_Comp == 17) printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Ptr_Glob->variant.var_1.Int_Comp);
printf ("Str_Comp: ");
if (strcmp(Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING") == 0)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%s\n", Ptr_Glob->variant.var_1.Str_Comp);
printf ("Next_Ptr_Glob-> ");
printf (" Ptr_Comp: * %d", (int) Next_Ptr_Glob->Ptr_Comp);
printf (" same as above\n");
printf (" Discr: ");
if (Next_Ptr_Glob->Discr == 0)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Next_Ptr_Glob->Discr);
printf ("Enum_Comp: ");
if (Next_Ptr_Glob->variant.var_1.Enum_Comp == 1)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
printf (" Int_Comp: ");
if (Next_Ptr_Glob->variant.var_1.Int_Comp == 18)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Next_Ptr_Glob->variant.var_1.Int_Comp);
printf ("Str_Comp: ");
if (strcmp(Next_Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING") == 0)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%s\n", Next_Ptr_Glob->variant.var_1.Str_Comp);
printf ("Int_1_Loc: ");
if (Int_1_Loc == 5)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Int_1_Loc);
printf ("Int_2_Loc: ");
if (Int_2_Loc == 13)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d\n", Int_2_Loc);
printf ("Int_3_Loc: ");
if (Int_3_Loc == 7)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d ", Int_3_Loc);
printf ("Enum_Loc: ");
if (Enum_Loc == 1)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%d\n", Enum_Loc);
printf ("Str_1_Loc: ");
if (strcmp(Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING") == 0)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%s\n", Str_1_Loc);
printf ("Str_2_Loc: ");
if (strcmp(Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING") == 0)
printf ("O.K. ");
else printf ("WRONG ");
printf ("%s\n", Str_2_Loc);
printf ("\n");
if (User_Time < Too_Small_Time)
{
printf ("Measured time too small to obtain meaningful results\n");
printf ("Please increase number of runs\n");
printf ("\n");
}
else
{
Microseconds = User_Time * Mic_secs_Per_Second
/ (double) Number_Of_Runs;
Dhrystones_Per_Second = (double) Number_Of_Runs / User_Time;
Vax_Mips = Dhrystones_Per_Second / 1757.0;
printf ("Microseconds for one run through Dhrystone: ");
printf ("%12.2lf \n", Microseconds);
printf ("Dhrystones per Second: ");
printf ("%10.0lf \n", Dhrystones_Per_Second);
printf ("VAX MIPS rating = ");
printf ("%12.2lf \n",Vax_Mips);
printf ("\n");
/************************************************************************
* Type details of hardware, software etc. *
************************************************************************/
if (getinput == 1)
{
printf ("Enter the following which will be added with results to file DHRY.TXT\n");
printf ("When submitting a number of results you need only provide details once\n");
printf ("but a cross reference such as an abbreviated CPU type would be useful.\n");
printf ("You can kill (exit or close) the program now and no data will be added.\n\n");
printf ("PC Supplier/model ? ");
gets(general[1]);
printf ("CPU chip ? ");
gets(general[2]);
printf ("Clock MHz ? ");
gets(general[3]);
printf ("Cache size ? ");
gets(general[4]);
printf ("Chipset & H/W options ? ");
gets(general[5]);
printf ("OS/DOS version ? ");
gets(general[6]);
printf ("Your name ? ");
gets(general[7]);
printf ("Company/Location ? ");
gets(general[8]);
printf ("E-mail address ? ");
gets(general[0]);
}
/************************************************************************
* Add results to output file Dhry.txt *
************************************************************************/
fprintf (Ap, "-------------------- -----------------------------------"
"\n");
fprintf (Ap, "Dhrystone Benchmark Version 2.1 (Language: C++)\n\n");
fprintf (Ap, "PC model %s\n", general[1]);
fprintf (Ap, "CPU %s\n", general[2]);
fprintf (Ap, "Clock MHz %s\n", general[3]);
fprintf (Ap, "Cache %s\n", general[4]);
fprintf (Ap, "Options %s\n", general[5]);
fprintf (Ap, "OS/DOS %s\n", general[6]);
fprintf (Ap, "Compiler %s\n", compiler);
fprintf (Ap, "OptLevel %s\n", options);
fprintf (Ap, "Run by %s\n", general[7]);
fprintf (Ap, "From %s\n", general[8]);
fprintf (Ap, "Mail %s\n\n", general[0]);
fprintf (Ap, "Final values (* implementation-dependent):\n");
fprintf (Ap, "\n");
fprintf (Ap, "Int_Glob: ");
if (Int_Glob == 5) fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Int_Glob);
fprintf (Ap, "Bool_Glob: ");
if (Bool_Glob == 1) fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Bool_Glob);
fprintf (Ap, "Ch_1_Glob: ");
if (Ch_1_Glob == 'A') fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%c\n", Ch_1_Glob);
fprintf (Ap, "Ch_2_Glob: ");
if (Ch_2_Glob == 'B') fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%c\n", Ch_2_Glob);
fprintf (Ap, "Arr_1_Glob[8]: ");
if (Arr_1_Glob[8] == 7) fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Arr_1_Glob[8]);
fprintf (Ap, "Arr_2_Glob8/7: ");
if (Arr_2_Glob[8][7] == Number_Of_Runs + 10)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%10d\n", Arr_2_Glob[8][7]);
fprintf (Ap, "Ptr_Glob-> \n");
fprintf (Ap, " Ptr_Comp: * %d\n", (int) Ptr_Glob->Ptr_Comp);
fprintf (Ap, " Discr: ");
if (Ptr_Glob->Discr == 0) fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Ptr_Glob->Discr);
fprintf (Ap, " Enum_Comp: ");
if (Ptr_Glob->variant.var_1.Enum_Comp == 2)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Ptr_Glob->variant.var_1.Enum_Comp);
fprintf (Ap, " Int_Comp: ");
if (Ptr_Glob->variant.var_1.Int_Comp == 17) fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Ptr_Glob->variant.var_1.Int_Comp);
fprintf (Ap, " Str_Comp: ");
if (strcmp(Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING") == 0)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%s\n", Ptr_Glob->variant.var_1.Str_Comp);
fprintf (Ap, "Next_Ptr_Glob-> \n");
fprintf (Ap, " Ptr_Comp: * %d", (int) Next_Ptr_Glob->Ptr_Comp);
fprintf (Ap, " same as above\n");
fprintf (Ap, " Discr: ");
if (Next_Ptr_Glob->Discr == 0)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Next_Ptr_Glob->Discr);
fprintf (Ap, " Enum_Comp: ");
if (Next_Ptr_Glob->variant.var_1.Enum_Comp == 1)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
fprintf (Ap, " Int_Comp: ");
if (Next_Ptr_Glob->variant.var_1.Int_Comp == 18)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
fprintf (Ap, " Str_Comp: ");
if (strcmp(Next_Ptr_Glob->variant.var_1.Str_Comp,
"DHRYSTONE PROGRAM, SOME STRING") == 0)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%s\n", Next_Ptr_Glob->variant.var_1.Str_Comp);
fprintf (Ap, "Int_1_Loc: ");
if (Int_1_Loc == 5)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Int_1_Loc);
fprintf (Ap, "Int_2_Loc: ");
if (Int_2_Loc == 13)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Int_2_Loc);
fprintf (Ap, "Int_3_Loc: ");
if (Int_3_Loc == 7)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Int_3_Loc);
fprintf (Ap, "Enum_Loc: ");
if (Enum_Loc == 1)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%d\n", Enum_Loc);
fprintf (Ap, "Str_1_Loc: ");
if (strcmp(Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING") == 0)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%s\n", Str_1_Loc);
fprintf (Ap, "Str_2_Loc: ");
if (strcmp(Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING") == 0)
fprintf (Ap, "O.K. ");
else fprintf (Ap, "WRONG ");
fprintf (Ap, "%s\n", Str_2_Loc);
fprintf (Ap, "\n");
fprintf(Ap,"%s\n",Reg_Define);
fprintf (Ap, "\n");
fprintf(Ap,"Microseconds 1 loop: %12.2lf\n",Microseconds);
fprintf(Ap,"Dhrystones / second: %10.0lf\n",Dhrystones_Per_Second);
fprintf(Ap,"VAX MIPS rating: %12.2lf\n\n",Vax_Mips);
fclose(Ap);
}
printf ("\n");
printf ("A new results file will have been created in the same directory as the\n");
printf (".EXE files if one did not already exist. If you made a mistake on input, \n");
printf ("you can use a text editor to correct it, delete the results or copy \n");
printf ("them to a different file name. If you intend to run multiple tests you\n");
printf ("you may wish to rename DHRY.TXT with a more informative title.\n\n");
printf ("Please submit feedback and results files as a posting in Section 12\n");
printf ("or to Roy_Longbottom@compuserve.com\n\n");
if (getinput == 1)
{
printf("Press any key to exit\n");
printf ("\nIf this is displayed you must close the window in the normal way\n");
}
}
void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
/******************/
/* executed once */
{
REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
/* == Ptr_Glob_Next */
/* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */
/* corresponds to "rename" in Ada, "with" in Pascal */
structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
Ptr_Val_Par->variant.var_1.Int_Comp = 5;
Next_Record->variant.var_1.Int_Comp
= Ptr_Val_Par->variant.var_1.Int_Comp;
Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
Proc_3 (&Next_Record->Ptr_Comp);
/* Ptr_Val_Par->Ptr_Comp->Ptr_Comp
== Ptr_Glob->Ptr_Comp */
if (Next_Record->Discr == Ident_1)
/* then, executed */
{
Next_Record->variant.var_1.Int_Comp = 6;
Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
&Next_Record->variant.var_1.Enum_Comp);
Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
&Next_Record->variant.var_1.Int_Comp);
}
else /* not executed */
structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
} /* Proc_1 */
void Proc_2 (One_Fifty *Int_Par_Ref)
/******************/
/* executed once */
/* *Int_Par_Ref == 1, becomes 4 */
{
One_Fifty Int_Loc;
Enumeration Enum_Loc;
Int_Loc = *Int_Par_Ref + 10;
do /* executed once */
if (Ch_1_Glob == 'A')
/* then, executed */
{
Int_Loc -= 1;
*Int_Par_Ref = Int_Loc - Int_Glob;
Enum_Loc = Ident_1;
} /* if */
while (Enum_Loc != Ident_1); /* true */
} /* Proc_2 */
void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
/******************/
/* executed once */
/* Ptr_Ref_Par becomes Ptr_Glob */
{
if (Ptr_Glob != Null)
/* then, executed */
*Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
} /* Proc_3 */
void Proc_4 () /* without parameters */
/*******/
/* executed once */
{
Boolean Bool_Loc;
Bool_Loc = Ch_1_Glob == 'A';
Bool_Glob = Bool_Loc | Bool_Glob;
Ch_2_Glob = 'B';
} /* Proc_4 */
void Proc_5 () /* without parameters */
/*******/
/* executed once */
{
Ch_1_Glob = 'A';
Bool_Glob = false;
} /* Proc_5 */
/* Procedure for the assignment of structures, */
/* if the C compiler doesn't support this feature */
#ifdef NOSTRUCTASSIGN
memcpy (d, s, l)
register char *d;
register char *s;
register int l;
{
while (l--) *d++ = *s++;
}
#endif
double dtime()
{
/* #include <ctype.h> */
#define HZ CLOCKS_PER_SEC
clock_t tnow;
double q;
tnow = clock();
q = (double)tnow / (double)HZ;
return q;
}

186
benchmarks/dhry/dhry_2.c Normal file
View file

@ -0,0 +1,186 @@
/*
*************************************************************************
*
* "DHRYSTONE" Benchmark Program
* -----------------------------
*
* Version: C, Version 2.1
*
* File: dhry_2.c (part 3 of 3)
*
* Date: May 25, 1988
*
* Author: Reinhold P. Weicker
*
*************************************************************************
*/
#include "dhry.h"
#ifndef REG
#define REG
/* REG becomes defined as empty */
/* i.e. no register variables */
#else
#define REG register
#endif
extern int Int_Glob;
extern char Ch_1_Glob;
Boolean Func_3 (Enumeration Enum_Par_Val);
void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
/*********************************/
/* executed once */
/* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
{
*Enum_Ref_Par = Enum_Val_Par;
if (! Func_3 (Enum_Val_Par))
/* then, not executed */
*Enum_Ref_Par = Ident_4;
switch (Enum_Val_Par)
{
case Ident_1:
*Enum_Ref_Par = Ident_1;
break;
case Ident_2:
if (Int_Glob > 100)
/* then */
*Enum_Ref_Par = Ident_1;
else *Enum_Ref_Par = Ident_4;
break;
case Ident_3: /* executed */
*Enum_Ref_Par = Ident_2;
break;
case Ident_4: break;
case Ident_5:
*Enum_Ref_Par = Ident_3;
break;
} /* switch */
} /* Proc_6 */
void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val,
One_Fifty *Int_Par_Ref)
/**********************************************/
/* executed three times */
/* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
/* Int_Par_Ref becomes 7 */
/* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
/* Int_Par_Ref becomes 17 */
/* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
/* Int_Par_Ref becomes 18 */
{
One_Fifty Int_Loc;
Int_Loc = Int_1_Par_Val + 2;
*Int_Par_Ref = Int_2_Par_Val + Int_Loc;
} /* Proc_7 */
void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref,
int Int_1_Par_Val, int Int_2_Par_Val)
/*********************************************************************/
/* executed once */
/* Int_Par_Val_1 == 3 */
/* Int_Par_Val_2 == 7 */
{
REG One_Fifty Int_Index;
REG One_Fifty Int_Loc;
Int_Loc = Int_1_Par_Val + 5;
Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
Int_Glob = 5;
} /* Proc_8 */
Enumeration Func_1 (Capital_Letter Ch_1_Par_Val,
Capital_Letter Ch_2_Par_Val)
/*************************************************/
/* executed three times */
/* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
/* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
/* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
{
Capital_Letter Ch_1_Loc;
Capital_Letter Ch_2_Loc;
Ch_1_Loc = Ch_1_Par_Val;
Ch_2_Loc = Ch_1_Loc;
if (Ch_2_Loc != Ch_2_Par_Val)
/* then, executed */
return (Ident_1);
else /* not executed */
{
Ch_1_Glob = Ch_1_Loc;
return (Ident_2);
}
} /* Func_1 */
Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
/*************************************************/
/* executed once */
/* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
/* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
{
REG One_Thirty Int_Loc;
Capital_Letter Ch_Loc;
Int_Loc = 2;
while (Int_Loc <= 2) /* loop body executed once */
if (Func_1 (Str_1_Par_Ref[Int_Loc],
Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
/* then, executed */
{
Ch_Loc = 'A';
Int_Loc += 1;
} /* if, while */
if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
/* then, not executed */
Int_Loc = 7;
if (Ch_Loc == 'R')
/* then, not executed */
return (true);
else /* executed */
{
if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
/* then, not executed */
{
Int_Loc += 7;
Int_Glob = Int_Loc;
return (true);
}
else /* executed */
return (false);
} /* if Ch_Loc */
} /* Func_2 */
Boolean Func_3 (Enumeration Enum_Par_Val)
/***************************/
/* executed once */
/* Enum_Par_Val == Ident_3 */
{
Enumeration Enum_Loc;
Enum_Loc = Enum_Par_Val;
if (Enum_Loc == Ident_3)
/* then, executed */
return (true);
else /* not executed */
return (false);
} /* Func_3 */

View file

View file

@ -0,0 +1,89 @@
benchmarks/multi/libmulti_a-harness.o: benchmarks/multi/harness.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h /usr/include/time.h \
/usr/include/sys/timespec.h /usr/include/sys/_timespec.h \
/usr/include/xlocale/_time.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdint.h \
/usr/include/stdint.h /usr/include/machine/_stdint.h \
/usr/include/x86/_stdint.h /usr/include/sys/_stdint.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdarg.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdbool.h \
/usr/include/assert.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h \
/usr/include/machine/endian.h /usr/include/x86/endian.h \
/usr/include/sys/_pthreadtypes.h /usr/include/sys/select.h \
/usr/include/sys/_sigset.h /usr/include/sys/_timeval.h \
/usr/include/sys/unistd.h /usr/include/errno.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:
/usr/include/time.h:
/usr/include/sys/timespec.h:
/usr/include/sys/_timespec.h:
/usr/include/xlocale/_time.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdint.h:
/usr/include/stdint.h:
/usr/include/machine/_stdint.h:
/usr/include/x86/_stdint.h:
/usr/include/sys/_stdint.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdio.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdarg.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdbool.h:
/usr/include/assert.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/unistd.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h:
/usr/include/machine/endian.h:
/usr/include/x86/endian.h:
/usr/include/sys/_pthreadtypes.h:
/usr/include/sys/select.h:
/usr/include/sys/_sigset.h:
/usr/include/sys/_timeval.h:
/usr/include/sys/unistd.h:
/usr/include/errno.h:

View file

407
benchmarks/multi/harness.c Normal file
View file

@ -0,0 +1,407 @@
/*
* Copyright (c) 2011, Linaro Limited
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Linaro nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** A simple harness that times how long a string function takes to
* run.
*/
/* PENDING: Add EPL */
#include <string.h>
#include <time.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#define NUM_ELEMS(_x) (sizeof(_x) / sizeof((_x)[0]))
#ifndef VERSION
#define VERSION "(unknown version)"
#endif
/** Make sure a function is called by using the return value */
#define SPOIL(_x) volatile long x = (long)(_x); (void)x
/** Type of functions that can be tested */
typedef void (*stub_t)(void *dest, void *src, size_t n);
/** Meta data about one test */
struct test
{
/** Test name */
const char *name;
/** Function to test */
stub_t stub;
};
/** Flush the cache by reading a chunk of memory */
static void empty(volatile char *against)
{
/* We know that there's a 16 k cache with 64 byte lines giving
a total of 256 lines. Read randomly from 256*5 places should
flush everything */
int offset = (1024 - 256)*1024;
for (int i = offset; i < offset + 16*1024*3; i += 64)
{
against[i];
}
}
/** Stub that does nothing. Used for calibrating */
static void xbounce(void *dest, void *src, size_t n)
{
SPOIL(0);
}
/** Stub that calls memcpy */
static void xmemcpy(void *dest, void *src, size_t n)
{
SPOIL(memcpy(dest, src, n));
}
/** Stub that calls memset */
static void xmemset(void *dest, void *src, size_t n)
{
SPOIL(memset(dest, 0, n));
}
/** Stub that calls memcmp */
static void xmemcmp(void *dest, void *src, size_t n)
{
SPOIL(memcmp(dest, src, n));
}
/** Stub that calls strcpy */
static void xstrcpy(void *dest, void *src, size_t n)
{
SPOIL(strcpy(dest, src));
}
/** Stub that calls strlen */
static void xstrlen(void *dest, void *src, size_t n)
{
SPOIL(strlen(dest));
}
/** Stub that calls strcmp */
static void xstrcmp(void *dest, void *src, size_t n)
{
SPOIL(strcmp(dest, src));
}
/** Stub that calls strchr */
static void xstrchr(void *dest, void *src, size_t n)
{
/* Put the character at the end of the string and before the null */
((char *)src)[n-1] = 32;
SPOIL(strchr(src, 32));
}
/** Stub that calls memchr */
static void xmemchr(void *dest, void *src, size_t n)
{
/* Put the character at the end of the block */
((char *)src)[n-1] = 32;
SPOIL(memchr(src, 32, n));
}
/** All functions that can be tested */
static const struct test tests[] =
{
{ "bounce", xbounce },
{ "memchr", xmemchr },
{ "memcpy", xmemcpy },
{ "memset", xmemset },
{ "memcmp", xmemcmp },
{ "strchr", xstrchr },
{ "strcmp", xstrcmp },
{ "strcpy", xstrcpy },
{ "strlen", xstrlen },
{ NULL }
};
/** Show basic usage */
static void usage(const char* name)
{
printf("%s %s: run a string related benchmark.\n"
"usage: %s [-c block-size] [-l loop-count] [-a alignment|src_alignment:dst_alignment] [-f] [-t test-name] [-r run-id]\n"
, name, VERSION, name);
printf("Tests:");
for (const struct test *ptest = tests; ptest->name != NULL; ptest++)
{
printf(" %s", ptest->name);
}
printf("\n");
exit(-1);
}
/** Find the test by name */
static const struct test *find_test(const char *name)
{
if (name == NULL)
{
return tests + 0;
}
else
{
for (const struct test *p = tests; p->name != NULL; p++)
{
if (strcmp(p->name, name) == 0)
{
return p;
}
}
}
return NULL;
}
#define MIN_BUFFER_SIZE 1024*1024
#define MAX_ALIGNMENT 256
/** Take a pointer and ensure that the lower bits == alignment */
static char *realign(char *p, int alignment)
{
uintptr_t pp = (uintptr_t)p;
pp = (pp + (MAX_ALIGNMENT - 1)) & ~(MAX_ALIGNMENT - 1);
pp += alignment;
return (char *)pp;
}
static int parse_int_arg(const char *arg, const char *exe_name)
{
long int ret;
errno = 0;
ret = strtol(arg, NULL, 0);
if (errno)
{
usage(exe_name);
}
return (int)ret;
}
static void parse_alignment_arg(const char *arg, const char *exe_name,
int *src_alignment, int *dst_alignment)
{
long int ret;
char *endptr;
errno = 0;
ret = strtol(arg, &endptr, 0);
if (errno)
{
usage(exe_name);
}
*src_alignment = (int)ret;
if (ret > 256 || ret < 1)
{
printf("Alignment should be in the range [1, 256].\n");
usage(exe_name);
}
if (ret == 256)
ret = 0;
if (endptr && *endptr == ':')
{
errno = 0;
ret = strtol(endptr + 1, NULL, 0);
if (errno)
{
usage(exe_name);
}
if (ret > 256 || ret < 1)
{
printf("Alignment should be in the range [1, 256].\n");
usage(exe_name);
}
if (ret == 256)
ret = 0;
}
*dst_alignment = (int)ret;
}
/** Setup and run a test */
int main(int argc, char **argv)
{
/* Size of src and dest buffers */
size_t buffer_size = MIN_BUFFER_SIZE;
/* Number of bytes per call */
int count = 31;
/* Number of times to run */
int loops = 10000000;
/* True to flush the cache each time */
int flush = 0;
/* Name of the test */
const char *name = NULL;
/* Alignment of buffers */
int src_alignment = 8;
int dst_alignment = 8;
/* Name of the run */
const char *run_id = "0";
int opt;
while ((opt = getopt(argc, argv, "c:l:ft:r:hva:")) > 0)
{
switch (opt)
{
case 'c':
count = parse_int_arg(optarg, argv[0]);
break;
case 'l':
loops = parse_int_arg(optarg, argv[0]);
break;
case 'a':
parse_alignment_arg(optarg, argv[0], &src_alignment, &dst_alignment);
break;
case 'f':
flush = 1;
break;
case 't':
name = strdup(optarg);
break;
case 'r':
run_id = strdup(optarg);
break;
case 'h':
usage(argv[0]);
break;
default:
usage(argv[0]);
break;
}
}
/* Find the test by name */
const struct test *ptest = find_test(name);
if (ptest == NULL)
{
usage(argv[0]);
}
if (count + MAX_ALIGNMENT * 2 > MIN_BUFFER_SIZE)
{
buffer_size = count + MAX_ALIGNMENT * 2;
}
/* Buffers to read and write from */
char *src = malloc(buffer_size);
char *dest = malloc(buffer_size);
assert(src != NULL && dest != NULL);
src = realign(src, src_alignment);
dest = realign(dest, dst_alignment);
/* Fill the buffer with non-zero, reproducable random data */
srandom(1539);
for (int i = 0; i < buffer_size; i++)
{
src[i] = (char)random() | 1;
dest[i] = src[i];
}
/* Make sure the buffers are null terminated for any string tests */
src[count] = 0;
dest[count] = 0;
struct timespec start, end;
int err = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start);
assert(err == 0);
/* Preload */
stub_t stub = ptest->stub;
/* Run two variants to reduce the cost of testing for the flush */
if (flush == 0)
{
for (int i = 0; i < loops; i++)
{
(*stub)(dest, src, count);
}
}
else
{
for (int i = 0; i < loops; i++)
{
(*stub)(dest, src, count);
empty(dest);
}
}
err = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end);
assert(err == 0);
/* Drop any leading path and pull the variant name out of the executable */
char *variant = strrchr(argv[0], '/');
if (variant == NULL)
{
variant = argv[0];
}
variant = strstr(variant, "try-");
assert(variant != NULL);
double elapsed = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) * 1e-9;
/* Estimate the bounce time. Measured on a Panda. */
double bounced = 0.448730 * loops / 50000000;
/* Dump both machine and human readable versions */
printf("%s:%s:%u:%u:%d:%d:%s:%.6f: took %.6f s for %u calls to %s of %u bytes. ~%.3f MB/s corrected.\n",
variant + 4, ptest->name,
count, loops, src_alignment, dst_alignment, run_id,
elapsed,
elapsed, loops, ptest->name, count,
(double)loops*count/(elapsed - bounced)/(1024*1024));
return 0;
}

347
compile Executable file
View file

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1433
config.guess vendored Executable file

File diff suppressed because it is too large Load diff

62
config.h Normal file
View file

@ -0,0 +1,62 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "cortex-strings"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "cortex-strings"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "cortex-strings 1.1-2012.06~dev"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "cortex-strings"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.1-2012.06~dev"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.1-2012.06~dev"

61
config.h.in Normal file
View file

@ -0,0 +1,61 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

323
config.log Normal file
View file

@ -0,0 +1,323 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cortex-strings configure 1.1-2012.06~dev, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --target=aarch64-none-elf
## --------- ##
## Platform. ##
## --------- ##
hostname = zapp
uname -m = amd64
uname -r = 11.0-CURRENT
uname -s = FreeBSD
uname -v = FreeBSD 11.0-CURRENT #10 181fb67(zfs-test): Thu May 26 14:22:06 BST 2016 andrew@zapp:/usr/obj/usr/src/sys/GENERIC
/usr/bin/uname -p = amd64
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /sbin
PATH: /bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /usr/games
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /home/andrew/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2193: checking for a BSD-compatible install
configure:2261: result: /usr/bin/install -c
configure:2272: checking whether build environment is sane
configure:2327: result: yes
configure:2478: checking for a thread-safe mkdir -p
configure:2517: result: ./install-sh -c -d
configure:2524: checking for gawk
configure:2554: result: no
configure:2524: checking for mawk
configure:2554: result: no
configure:2524: checking for nawk
configure:2540: found /usr/bin/nawk
configure:2551: result: nawk
configure:2562: checking whether make sets $(MAKE)
configure:2584: result: yes
configure:2613: checking whether make supports nested variables
configure:2630: result: yes
configure:2764: checking build system type
configure:2778: result: amd64-unknown-freebsd11.0
configure:2798: checking host system type
configure:2811: result: amd64-unknown-freebsd11.0
configure:2843: checking for style of include used by make
configure:2871: result: GNU
configure:2942: checking for gcc
configure:2969: result: aarch64-none-elf-gcc
configure:3198: checking for C compiler version
configure:3207: aarch64-none-elf-gcc --version >&5
aarch64-none-elf-gcc (FreeBSD Ports Collection for aarch64noneelf) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3218: $? = 0
configure:3207: aarch64-none-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=aarch64-none-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-none-elf/5.3.0/lto-wrapper
Target: aarch64-none-elf
Configured with: /wrkdirs/usr/ports/devel/aarch64-none-elf-gcc/work/gcc-5.3.0/configure --target=aarch64-none-elf --disable-nls --enable-languages=c,c++ --without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports Collection for aarch64noneelf' --with-system-zlib --with-as=/usr/local/bin/aarch64-none-elf-as --with-ld=/usr/local/bin/aarch64-none-elf-ld --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/ --build=x86_64-portbld-freebsd11.0
Thread model: single
gcc version 5.3.0 (FreeBSD Ports Collection for aarch64noneelf)
configure:3218: $? = 0
configure:3207: aarch64-none-elf-gcc -V >&5
aarch64-none-elf-gcc: error: unrecognized command line option '-V'
aarch64-none-elf-gcc: fatal error: no input files
compilation terminated.
configure:3218: $? = 1
configure:3207: aarch64-none-elf-gcc -qversion >&5
aarch64-none-elf-gcc: error: unrecognized command line option '-qversion'
aarch64-none-elf-gcc: fatal error: no input files
compilation terminated.
configure:3218: $? = 1
configure:3238: checking whether the C compiler works
configure:3260: aarch64-none-elf-gcc conftest.c >&5
/usr/local/bin/aarch64-none-elf-ld: cannot find crt0.o: No such file or directory
/usr/local/bin/aarch64-none-elf-ld: skipping incompatible /lib/libc.so.7 when searching for /lib/libc.so.7
/usr/local/bin/aarch64-none-elf-ld: cannot find /lib/libc.so.7
/usr/local/bin/aarch64-none-elf-ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
/usr/local/bin/aarch64-none-elf-ld: cannot find /usr/lib/libc_nonshared.a
/usr/local/bin/aarch64-none-elf-ld: skipping incompatible /usr/lib/libssp_nonshared.a when searching for /usr/lib/libssp_nonshared.a
/usr/local/bin/aarch64-none-elf-ld: cannot find /usr/lib/libssp_nonshared.a
collect2: error: ld returned 1 exit status
configure:3264: $? = 1
configure:3302: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "cortex-strings"
| #define PACKAGE_TARNAME "cortex-strings"
| #define PACKAGE_VERSION "1.1-2012.06~dev"
| #define PACKAGE_STRING "cortex-strings 1.1-2012.06~dev"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "cortex-strings"
| #define VERSION "1.1-2012.06~dev"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3307: error: in `/home/andrew/freebsd/repo/cortex-strings':
configure:3310: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=amd64-unknown-freebsd11.0
ac_cv_env_CCASFLAGS_set=''
ac_cv_env_CCASFLAGS_value=''
ac_cv_env_CCAS_set=''
ac_cv_env_CCAS_value=''
ac_cv_env_CC_set=set
ac_cv_env_CC_value=aarch64-none-elf-gcc
ac_cv_env_CFLAGS_set=''
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=''
ac_cv_env_CPPFLAGS_value=''
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_LT_SYS_LIBRARY_PATH_set=''
ac_cv_env_LT_SYS_LIBRARY_PATH_value=''
ac_cv_env_build_alias_set=''
ac_cv_env_build_alias_value=''
ac_cv_env_host_alias_set=''
ac_cv_env_host_alias_value=''
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=aarch64-none-elf
ac_cv_host=amd64-unknown-freebsd11.0
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=nawk
ac_cv_prog_ac_ct_CC=aarch64-none-elf-gcc
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /home/andrew/freebsd/repo/cortex-strings/missing aclocal-1.15'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AUTOCONF='${SHELL} /home/andrew/freebsd/repo/cortex-strings/missing autoconf'
AUTOHEADER='${SHELL} /home/andrew/freebsd/repo/cortex-strings/missing autoheader'
AUTOMAKE='${SHELL} /home/andrew/freebsd/repo/cortex-strings/missing automake-1.15'
AWK='nawk'
CC='aarch64-none-elf-gcc'
CCAS=''
CCASDEPMODE=''
CCASFLAGS=''
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
HOST_AARCH32_FALSE=''
HOST_AARCH32_TRUE=''
HOST_AARCH64_FALSE=''
HOST_AARCH64_TRUE=''
HOST_GENERIC_FALSE=''
HOST_GENERIC_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAKEINFO='${SHELL} /home/andrew/freebsd/repo/cortex-strings/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='./install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='cortex-strings'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='cortex-strings'
PACKAGE_STRING='cortex-strings 1.1-2012.06~dev'
PACKAGE_TARNAME='cortex-strings'
PACKAGE_URL=''
PACKAGE_VERSION='1.1-2012.06~dev'
PATH_SEPARATOR=':'
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='1.1-2012.06~dev'
WITH_NEON_FALSE=''
WITH_NEON_TRUE=''
WITH_SUBMACHINE_FALSE=''
WITH_SUBMACHINE_TRUE=''
WITH_VFP_FALSE=''
WITH_VFP_TRUE=''
ac_ct_AR=''
ac_ct_CC='aarch64-none-elf-gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCCAS_FALSE=''
am__fastdepCCAS_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='amd64-unknown-freebsd11.0'
build_alias=''
build_cpu='amd64'
build_os='freebsd11.0'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='amd64-unknown-freebsd11.0'
host_alias=''
host_cpu='amd64'
host_os='freebsd11.0'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/andrew/freebsd/repo/cortex-strings/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
submachine=''
sysconfdir='${prefix}/etc'
target_alias='aarch64-none-elf'
with_neon=''
with_vfp=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "cortex-strings"
#define PACKAGE_TARNAME "cortex-strings"
#define PACKAGE_VERSION "1.1-2012.06~dev"
#define PACKAGE_STRING "cortex-strings 1.1-2012.06~dev"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "cortex-strings"
#define VERSION "1.1-2012.06~dev"
configure: exit 77

1977
config.status Executable file

File diff suppressed because it is too large Load diff

1804
config.sub vendored Executable file

File diff suppressed because it is too large Load diff

15139
configure vendored Executable file

File diff suppressed because it is too large Load diff

88
configure.ac Normal file
View file

@ -0,0 +1,88 @@
# Copyright (c) 2011-2012, Linaro Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Linaro nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_INIT(cortex-strings, 1.1-2012.06~dev)
AM_INIT_AUTOMAKE(foreign subdir-objects color-tests dist-bzip2)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES(Makefile)
AC_CANONICAL_HOST
AM_PROG_AS
AC_PROG_CC
AC_PROG_LIBTOOL
default_submachine=
case $host in
aarch64*-*-*)
arch=aarch64
;;
arm*-*-*)
arch=aarch32
default_submachine=cortex-a9
;;
x86_64-*-*-*)
arch=generic
;;
*)
AC_MSG_ERROR([unknown architecture $host])
;;
esac
AM_CONDITIONAL([HOST_AARCH32], [test x$arch = xaarch32])
AM_CONDITIONAL([HOST_AARCH64], [test x$arch = xaarch64])
AM_CONDITIONAL([HOST_GENERIC], [test x$arch = xgeneric])
AC_ARG_WITH([cpu],
AS_HELP_STRING([--with-cpu=CPU],
[select code for CPU variant @<:@default=cortex-a9@:>@]]),
[dnl
case "$withval" in
yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
no) ;;
*) submachine="$withval" ;;
esac
],
[submachine=$default_submachine])
AC_SUBST(submachine)
AM_CONDITIONAL([WITH_SUBMACHINE], [test x$submachine != x])
AC_ARG_WITH([neon],
AC_HELP_STRING([--with-neon],
[include NEON specific routines @<:@default=yes@:>@]),
[with_neon=$withval],
[with_neon=yes])
AC_SUBST(with_neon)
AM_CONDITIONAL(WITH_NEON, test x$with_neon = xyes)
AC_ARG_WITH([vfp],
AC_HELP_STRING([--with-vfp],
[include VFP specific routines @<:@default=yes@:>@]),
[with_vfp=$withval],
[with_vfp=yes])
AC_SUBST(with_vfp)
AM_CONDITIONAL(WITH_VFP, test x$with_vfp = xyes)
AC_OUTPUT

791
depcomp Executable file
View file

@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

501
install-sh Executable file
View file

@ -0,0 +1,501 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

11642
libtool Executable file

File diff suppressed because it is too large Load diff

11147
ltmain.sh Executable file

File diff suppressed because it is too large Load diff

215
missing Executable file
View file

@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1,341 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_32_BYTE_CACHE_LINE
#define CACHE_LINE_SIZE 32
#else
#define CACHE_LINE_SIZE 64
#endif
/*
* Optimized memcmp() for Cortex-A9.
*/
.text
.globl memcmp
.type memcmp,%function
memcmp:
.fnstart
pld [r0, #(CACHE_LINE_SIZE * 0)]
pld [r0, #(CACHE_LINE_SIZE * 1)]
/* take of the case where length is 0 or the buffers are the same */
cmp r0, r1
moveq r0, #0
bxeq lr
pld [r1, #(CACHE_LINE_SIZE * 0)]
pld [r1, #(CACHE_LINE_SIZE * 1)]
/* make sure we have at least 8+4 bytes, this simplify things below
* and avoid some overhead for small blocks
*/
cmp r2, #(8+4)
bmi 10f
/*
* Neon optimization
* Comparing 32 bytes at a time
*/
#if defined(__ARM_NEON__) && defined(NEON_UNALIGNED_ACCESS)
subs r2, r2, #32
blo 3f
/* preload all the cache lines we need. */
pld [r0, #(CACHE_LINE_SIZE * 2)]
pld [r1, #(CACHE_LINE_SIZE * 2)]
1: /* The main loop compares 32 bytes at a time */
vld1.8 {d0 - d3}, [r0]!
pld [r0, #(CACHE_LINE_SIZE * 2)]
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(CACHE_LINE_SIZE * 2)]
/* Start subtracting the values and merge results */
vsub.i8 q0, q2
vsub.i8 q1, q3
vorr q2, q0, q1
vorr d4, d5
vmov r3, ip, d4
/* Check if there are any differences among the 32 bytes */
orrs r3, ip
bne 2f
subs r2, r2, #32
bhs 1b
b 3f
2:
/* Check if the difference was in the first or last 16 bytes */
sub r0, #32
vorr d0, d1
sub r1, #32
vmov r3, ip, d0
orrs r3, ip
/* if the first 16 bytes are equal, we only have to rewind 16 bytes */
ittt eq
subeq r2, #16
addeq r0, #16
addeq r1, #16
3: /* fix-up the remaining count */
add r2, r2, #32
cmp r2, #(8+4)
bmi 10f
#endif
.save {r4, lr}
/* save registers */
stmfd sp!, {r4, lr}
/* since r0 hold the result, move the first source
* pointer somewhere else
*/
mov r4, r0
/* align first pointer to word boundary
* offset = -src & 3
*/
rsb r3, r4, #0
ands r3, r3, #3
beq 0f
/* align first pointer */
sub r2, r2, r3
1: ldrb r0, [r4], #1
ldrb ip, [r1], #1
subs r0, r0, ip
bne 9f
subs r3, r3, #1
bne 1b
0: /* here the first pointer is aligned, and we have at least 4 bytes
* to process.
*/
/* see if the pointers are congruent */
eor r0, r4, r1
ands r0, r0, #3
bne 5f
/* congruent case, 32 bytes per iteration
* We need to make sure there are at least 32+4 bytes left
* because we effectively read ahead one word, and we could
* read past the buffer (and segfault) if we're not careful.
*/
ldr ip, [r1]
subs r2, r2, #(32 + 4)
bmi 1f
0: pld [r4, #(CACHE_LINE_SIZE * 2)]
pld [r1, #(CACHE_LINE_SIZE * 2)]
ldr r0, [r4], #4
ldr lr, [r1, #4]!
eors r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
bne 2f
subs r2, r2, #32
bhs 0b
/* do we have at least 4 bytes left? */
1: adds r2, r2, #(32 - 4 + 4)
bmi 4f
/* finish off 4 bytes at a time */
3: ldr r0, [r4], #4
ldr ip, [r1], #4
eors r0, r0, ip
bne 2f
subs r2, r2, #4
bhs 3b
/* are we done? */
4: adds r2, r2, #4
moveq r0, #0
beq 9f
/* finish off the remaining bytes */
b 8f
2: /* the last 4 bytes are different, restart them */
sub r4, r4, #4
sub r1, r1, #4
mov r2, #4
/* process the last few bytes */
8: ldrb r0, [r4], #1
ldrb ip, [r1], #1
// stall
subs r0, r0, ip
bne 9f
subs r2, r2, #1
bne 8b
9: /* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
10: /* process less than 12 bytes */
cmp r2, #0
moveq r0, #0
bxeq lr
mov r3, r0
11:
ldrb r0, [r3], #1
ldrb ip, [r1], #1
subs r0, ip
bxne lr
subs r2, r2, #1
bne 11b
bx lr
5: /*************** non-congruent case ***************/
and r0, r1, #3
cmp r0, #2
bne 4f
/* here, offset is 2 (16-bits aligned, special cased) */
/* make sure we have at least 16 bytes to process */
subs r2, r2, #16
addmi r2, r2, #16
bmi 8b
/* align the unaligned pointer */
bic r1, r1, #3
ldr lr, [r1], #4
6: pld [r1, #(CACHE_LINE_SIZE * 2)]
pld [r4, #(CACHE_LINE_SIZE * 2)]
mov ip, lr, lsr #16
ldr lr, [r1], #4
ldr r0, [r4], #4
orr ip, ip, lr, lsl #16
eors r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #16
bhs 6b
sub r1, r1, #2
/* are we done? */
adds r2, r2, #16
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #(4+2)
sub r4, r4, #4
mov r2, #4
b 8b
4: /*************** offset is 1 or 3 (less optimized) ***************/
stmfd sp!, {r5, r6, r7}
// r5 = rhs
// r6 = lhs
// r7 = scratch
mov r5, r0, lsl #3 /* r5 = right shift */
rsb r6, r5, #32 /* r6 = left shift */
/* align the unaligned pointer */
bic r1, r1, #3
ldr r7, [r1], #4
sub r2, r2, #8
6: mov ip, r7, lsr r5
ldr r7, [r1], #4
ldr r0, [r4], #4
orr ip, ip, r7, lsl r6
eors r0, r0, ip
moveq ip, r7, lsr r5
ldreq r7, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, r7, lsl r6
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #8
bhs 6b
sub r1, r1, r6, lsr #3
ldmfd sp!, {r5, r6, r7}
/* are we done? */
adds r2, r2, #8
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #4
sub r1, r1, r6, lsr #3
sub r4, r4, #4
mov r2, #4
ldmfd sp!, {r5, r6, r7}
b 8b
.fnend
.size memcmp, .-memcmp

View file

@ -0,0 +1,325 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 2013 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Prototype: void *memcpy (void *dst, const void *src, size_t count). */
// This version is tuned for the Cortex-A15 processor.
.text
.syntax unified
.fpu neon
#define CACHE_LINE_SIZE 64
.globl memcpy
.type memcpy,%function
memcpy:
.fnstart
// Assumes that n >= 0, and dst, src are valid pointers.
// For any sizes less than 832 use the neon code that doesn't
// care about the src alignment. This avoids any checks
// for src alignment, and offers the best improvement since
// smaller sized copies are dominated by the overhead of
// the pre and post main loop.
// For larger copies, if src and dst cannot both be aligned to
// word boundaries, use the neon code.
// For all other copies, align dst to a double word boundary
// and copy using LDRD/STRD instructions.
// Save registers (r0 holds the return value):
// optimized push {r0, lr}.
.save {r0, lr}
pld [r1, #(CACHE_LINE_SIZE*16)]
push {r0, lr}
cmp r2, #16
blo copy_less_than_16_unknown_align
cmp r2, #832
bge check_alignment
copy_unknown_alignment:
// Unknown alignment of src and dst.
// Assumes that the first few bytes have already been prefetched.
// Align destination to 128 bits. The mainloop store instructions
// require this alignment or they will throw an exception.
rsb r3, r0, #0
ands r3, r3, #0xF
beq 2f
// Copy up to 15 bytes (count in r3).
sub r2, r2, r3
movs ip, r3, lsl #31
itt mi
ldrbmi lr, [r1], #1
strbmi lr, [r0], #1
itttt cs
ldrbcs ip, [r1], #1
ldrbcs lr, [r1], #1
strbcs ip, [r0], #1
strbcs lr, [r0], #1
movs ip, r3, lsl #29
bge 1f
// Copies 4 bytes, dst 32 bits aligned before, at least 64 bits after.
vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]!
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
1: bcc 2f
// Copies 8 bytes, dst 64 bits aligned before, at least 128 bits after.
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0, :64]!
2: // Make sure we have at least 64 bytes to copy.
subs r2, r2, #64
blo 2f
1: // The main loop copies 64 bytes at a time.
vld1.8 {d0 - d3}, [r1]!
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(CACHE_LINE_SIZE*4)]
subs r2, r2, #64
vst1.8 {d0 - d3}, [r0, :128]!
vst1.8 {d4 - d7}, [r0, :128]!
bhs 1b
2: // Fix-up the remaining count and make sure we have >= 32 bytes left.
adds r2, r2, #32
blo 3f
// 32 bytes. These cache lines were already preloaded.
vld1.8 {d0 - d3}, [r1]!
sub r2, r2, #32
vst1.8 {d0 - d3}, [r0, :128]!
3: // Less than 32 left.
add r2, r2, #32
tst r2, #0x10
beq copy_less_than_16_unknown_align
// Copies 16 bytes, destination 128 bits aligned.
vld1.8 {d0, d1}, [r1]!
vst1.8 {d0, d1}, [r0, :128]!
copy_less_than_16_unknown_align:
// Copy up to 15 bytes (count in r2).
movs ip, r2, lsl #29
bcc 1f
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0]!
1: bge 2f
vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]!
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]!
2: // Copy 0 to 4 bytes.
lsls r2, r2, #31
itt ne
ldrbne lr, [r1], #1
strbne lr, [r0], #1
itttt cs
ldrbcs ip, [r1], #1
ldrbcs lr, [r1]
strbcs ip, [r0], #1
strbcs lr, [r0]
pop {r0, pc}
check_alignment:
// If src and dst cannot both be aligned to a word boundary,
// use the unaligned copy version.
eor r3, r0, r1
ands r3, r3, #0x3
bne copy_unknown_alignment
// To try and improve performance, stack layout changed,
// i.e., not keeping the stack looking like users expect
// (highest numbered register at highest address).
// TODO: Add debug frame directives.
// We don't need exception unwind directives, because the code below
// does not throw any exceptions and does not call any other functions.
// Generally, newlib functions like this lack debug information for
// assembler source.
.save {r4, r5}
strd r4, r5, [sp, #-8]!
.save {r6, r7}
strd r6, r7, [sp, #-8]!
.save {r8, r9}
strd r8, r9, [sp, #-8]!
// Optimized for already aligned dst code.
ands ip, r0, #3
bne dst_not_word_aligned
word_aligned:
// Align the destination buffer to 8 bytes, to make sure double
// loads and stores don't cross a cache line boundary,
// as they are then more expensive even if the data is in the cache
// (require two load/store issue cycles instead of one).
// If only one of the buffers is not 8 bytes aligned,
// then it's more important to align dst than src,
// because there is more penalty for stores
// than loads that cross a cacheline boundary.
// This check and realignment are only done if there is >= 832
// bytes to copy.
// Dst is word aligned, but check if it is already double word aligned.
ands r3, r0, #4
beq 1f
ldr r3, [r1], #4
str r3, [r0], #4
sub r2, #4
1: // Can only get here if > 64 bytes to copy, so don't do check r2.
sub r2, #64
2: // Every loop iteration copies 64 bytes.
.irp offset, #0, #8, #16, #24, #32
ldrd r4, r5, [r1, \offset]
strd r4, r5, [r0, \offset]
.endr
ldrd r4, r5, [r1, #40]
ldrd r6, r7, [r1, #48]
ldrd r8, r9, [r1, #56]
// Keep the pld as far from the next load as possible.
// The amount to prefetch was determined experimentally using
// large sizes, and verifying the prefetch size does not affect
// the smaller copies too much.
// WARNING: If the ldrd and strd instructions get too far away
// from each other, performance suffers. Three loads
// in a row is the best tradeoff.
pld [r1, #(CACHE_LINE_SIZE*16)]
strd r4, r5, [r0, #40]
strd r6, r7, [r0, #48]
strd r8, r9, [r0, #56]
add r0, r0, #64
add r1, r1, #64
subs r2, r2, #64
bge 2b
// Fix-up the remaining count and make sure we have >= 32 bytes left.
adds r2, r2, #32
blo 4f
// Copy 32 bytes. These cache lines were already preloaded.
.irp offset, #0, #8, #16, #24
ldrd r4, r5, [r1, \offset]
strd r4, r5, [r0, \offset]
.endr
add r1, r1, #32
add r0, r0, #32
sub r2, r2, #32
4: // Less than 32 left.
add r2, r2, #32
tst r2, #0x10
beq 5f
// Copy 16 bytes.
.irp offset, #0, #8
ldrd r4, r5, [r1, \offset]
strd r4, r5, [r0, \offset]
.endr
add r1, r1, #16
add r0, r0, #16
5: // Copy up to 15 bytes (count in r2).
movs ip, r2, lsl #29
bcc 1f
// Copy 8 bytes.
ldrd r4, r5, [r1], #8
strd r4, r5, [r0], #8
1: bge 2f
// Copy 4 bytes.
ldr r4, [r1], #4
str r4, [r0], #4
2: // Copy 0 to 4 bytes.
lsls r2, r2, #31
itt ne
ldrbne lr, [r1], #1
strbne lr, [r0], #1
itttt cs
ldrbcs ip, [r1], #1
ldrbcs lr, [r1]
strbcs ip, [r0], #1
strbcs lr, [r0]
// Restore registers: optimized pop {r0, pc}
ldrd r8, r9, [sp], #8
ldrd r6, r7, [sp], #8
ldrd r4, r5, [sp], #8
pop {r0, pc}
dst_not_word_aligned:
// Align dst to word.
rsb ip, ip, #4
cmp ip, #2
itt gt
ldrbgt lr, [r1], #1
strbgt lr, [r0], #1
itt ge
ldrbge lr, [r1], #1
strbge lr, [r0], #1
ldrb lr, [r1], #1
strb lr, [r0], #1
sub r2, r2, ip
// Src is guaranteed to be at least word aligned by this point.
b word_aligned
.fnend
.size memcpy, .-memcpy

View file

@ -0,0 +1,159 @@
/*
* Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Optimized memset() for ARM.
*
* memset() returns its first argument.
*/
.fpu neon
.syntax unified
.globl memset
.type memset,%function
memset:
.fnstart
.save {r0}
stmfd sp!, {r0}
// The new algorithm is slower for copies < 16 so use the old
// neon code in that case.
cmp r2, #16
blo set_less_than_16_unknown_align
// Use strd which requires an even and odd register so move the
// values so that:
// r0 and r1 contain the memset value
// r2 is the number of bytes to set
// r3 is the destination pointer
mov r3, r0
// Copy the byte value in every byte of r1.
mov r1, r1, lsl #24
orr r1, r1, r1, lsr #8
orr r1, r1, r1, lsr #16
check_alignment:
// Align destination to a double word to avoid the strd crossing
// a cache line boundary.
ands ip, r3, #7
bne do_double_word_align
double_word_aligned:
mov r0, r1
subs r2, #64
blo set_less_than_64
1: // Main loop sets 64 bytes at a time.
.irp offset, #0, #8, #16, #24, #32, #40, #48, #56
strd r0, r1, [r3, \offset]
.endr
add r3, #64
subs r2, #64
bge 1b
set_less_than_64:
// Restore r2 to the count of bytes left to set.
add r2, #64
lsls ip, r2, #27
bcc set_less_than_32
// Set 32 bytes.
.irp offset, #0, #8, #16, #24
strd r0, r1, [r3, \offset]
.endr
add r3, #32
set_less_than_32:
bpl set_less_than_16
// Set 16 bytes.
.irp offset, #0, #8
strd r0, r1, [r3, \offset]
.endr
add r3, #16
set_less_than_16:
// Less than 16 bytes to set.
lsls ip, r2, #29
bcc set_less_than_8
// Set 8 bytes.
strd r0, r1, [r3], #8
set_less_than_8:
bpl set_less_than_4
// Set 4 bytes
str r1, [r3], #4
set_less_than_4:
lsls ip, r2, #31
it ne
strbne r1, [r3], #1
itt cs
strbcs r1, [r3], #1
strbcs r1, [r3]
ldmfd sp!, {r0}
bx lr
do_double_word_align:
rsb ip, ip, #8
sub r2, r2, ip
movs r0, ip, lsl #31
it mi
strbmi r1, [r3], #1
itt cs
strbcs r1, [r3], #1
strbcs r1, [r3], #1
// Dst is at least word aligned by this point.
cmp ip, #4
blo double_word_aligned
str r1, [r3], #4
b double_word_aligned
set_less_than_16_unknown_align:
// Set up to 15 bytes.
vdup.8 d0, r1
movs ip, r2, lsl #29
bcc 1f
vst1.8 {d0}, [r0]!
1: bge 2f
vst1.32 {d0[0]}, [r0]!
2: movs ip, r2, lsl #31
it mi
strbmi r1, [r0], #1
itt cs
strbcs r1, [r0], #1
strbcs r1, [r0], #1
ldmfd sp!, {r0}
bx lr
.fnend
.size memset, .-memset

View file

@ -0,0 +1,378 @@
/*
* Copyright (c) 2013 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __ARMEB__
#define S2LOMEM lsl
#define S2LOMEMEQ lsleq
#define S2HIMEM lsr
#define MSB 0x000000ff
#define LSB 0xff000000
#define BYTE0_OFFSET 24
#define BYTE1_OFFSET 16
#define BYTE2_OFFSET 8
#define BYTE3_OFFSET 0
#else /* not __ARMEB__ */
#define S2LOMEM lsr
#define S2LOMEMEQ lsreq
#define S2HIMEM lsl
#define BYTE0_OFFSET 0
#define BYTE1_OFFSET 8
#define BYTE2_OFFSET 16
#define BYTE3_OFFSET 24
#define MSB 0xff000000
#define LSB 0x000000ff
#endif /* not __ARMEB__ */
.syntax unified
#if defined (__thumb__)
.thumb
.thumb_func
#endif
.globl strcmp
.type strcmp,%function
strcmp:
.fnstart
/* Use LDRD whenever possible. */
/* The main thing to look out for when comparing large blocks is that
the loads do not cross a page boundary when loading past the index
of the byte with the first difference or the first string-terminator.
For example, if the strings are identical and the string-terminator
is at index k, byte by byte comparison will not load beyond address
s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
k; double word - up to 7 bytes. If the load of these bytes crosses
a page boundary, it might cause a memory fault (if the page is not mapped)
that would not have happened in byte by byte comparison.
If an address is (double) word aligned, then a load of a (double) word
from that address will not cross a page boundary.
Therefore, the algorithm below considers word and double-word alignment
of strings separately. */
/* High-level description of the algorithm.
* The fast path: if both strings are double-word aligned,
use LDRD to load two words from each string in every loop iteration.
* If the strings have the same offset from a word boundary,
use LDRB to load and compare byte by byte until
the first string is aligned to a word boundary (at most 3 bytes).
This is optimized for quick return on short unaligned strings.
* If the strings have the same offset from a double-word boundary,
use LDRD to load two words from each string in every loop iteration, as in the fast path.
* If the strings do not have the same offset from a double-word boundary,
load a word from the second string before the loop to initialize the queue.
Use LDRD to load two words from every string in every loop iteration.
Inside the loop, load the second word from the second string only after comparing
the first word, using the queued value, to guarantee safety across page boundaries.
* If the strings do not have the same offset from a word boundary,
use LDR and a shift queue. Order of loads and comparisons matters,
similarly to the previous case.
* Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
* The only difference between ARM and Thumb modes is the use of CBZ instruction.
* The only difference between big and little endian is the use of REV in little endian
to compute the return value, instead of MOV.
*/
.macro m_cbz reg label
#ifdef __thumb2__
cbz \reg, \label
#else /* not defined __thumb2__ */
cmp \reg, #0
beq \label
#endif /* not defined __thumb2__ */
.endm /* m_cbz */
.macro m_cbnz reg label
#ifdef __thumb2__
cbnz \reg, \label
#else /* not defined __thumb2__ */
cmp \reg, #0
bne \label
#endif /* not defined __thumb2__ */
.endm /* m_cbnz */
.macro init
/* Macro to save temporary registers and prepare magic values. */
subs sp, sp, #16
strd r4, r5, [sp, #8]
strd r6, r7, [sp]
mvn r6, #0 /* all F */
mov r7, #0 /* all 0 */
.endm /* init */
.macro magic_compare_and_branch w1 w2 label
/* Macro to compare registers w1 and w2 and conditionally branch to label. */
cmp \w1, \w2 /* Are w1 and w2 the same? */
magic_find_zero_bytes \w1
it eq
cmpeq ip, #0 /* Is there a zero byte in w1? */
bne \label
.endm /* magic_compare_and_branch */
.macro magic_find_zero_bytes w1
/* Macro to find all-zero bytes in w1, result is in ip. */
#if (defined (__ARM_FEATURE_DSP))
uadd8 ip, \w1, r6
sel ip, r7, r6
#else /* not defined (__ARM_FEATURE_DSP) */
/* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
Coincidently, these processors only have Thumb-2 mode, where we can use the
the (large) magic constant available directly as an immediate in instructions.
Note that we cannot use the magic constant in ARM mode, where we need
to create the constant in a register. */
sub ip, \w1, #0x01010101
bic ip, ip, \w1
and ip, ip, #0x80808080
#endif /* not defined (__ARM_FEATURE_DSP) */
.endm /* magic_find_zero_bytes */
.macro setup_return w1 w2
#ifdef __ARMEB__
mov r1, \w1
mov r2, \w2
#else /* not __ARMEB__ */
rev r1, \w1
rev r2, \w2
#endif /* not __ARMEB__ */
.endm /* setup_return */
pld [r0, #0]
pld [r1, #0]
/* Are both strings double-word aligned? */
orr ip, r0, r1
tst ip, #7
bne do_align
/* Fast path. */
init
doubleword_aligned:
/* Get here when the strings to compare are double-word aligned. */
/* Compare two words in every iteration. */
.p2align 2
2:
pld [r0, #16]
pld [r1, #16]
/* Load the next double-word from each string. */
ldrd r2, r3, [r0], #8
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r2, w2=r4, label=return_24
magic_compare_and_branch w1=r3, w2=r5, label=return_35
b 2b
do_align:
/* Is the first string word-aligned? */
ands ip, r0, #3
beq word_aligned_r0
/* Fast compare byte by byte until the first string is word-aligned. */
/* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
to read until the next word boundary is 4-ip. */
bic r0, r0, #3
ldr r2, [r0], #4
lsls ip, ip, #31
beq byte2
bcs byte3
byte1:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE1_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
byte2:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE2_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
byte3:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE3_OFFSET
subs ip, r3, ip
bne fast_return
m_cbnz reg=r3, label=word_aligned_r0
fast_return:
mov r0, ip
bx lr
word_aligned_r0:
init
/* The first string is word-aligned. */
/* Is the second string word-aligned? */
ands ip, r1, #3
bne strcmp_unaligned
word_aligned:
/* The strings are word-aligned. */
/* Is the first string double-word aligned? */
tst r0, #4
beq doubleword_aligned_r0
/* If r0 is not double-word aligned yet, align it by loading
and comparing the next word from each string. */
ldr r2, [r0], #4
ldr r4, [r1], #4
magic_compare_and_branch w1=r2 w2=r4 label=return_24
doubleword_aligned_r0:
/* Get here when r0 is double-word aligned. */
/* Is r1 doubleword_aligned? */
tst r1, #4
beq doubleword_aligned
/* Get here when the strings to compare are word-aligned,
r0 is double-word aligned, but r1 is not double-word aligned. */
/* Initialize the queue. */
ldr r5, [r1], #4
/* Compare two words in every iteration. */
.p2align 2
3:
pld [r0, #16]
pld [r1, #16]
/* Load the next double-word from each string and compare. */
ldrd r2, r3, [r0], #8
magic_compare_and_branch w1=r2 w2=r5 label=return_25
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r3 w2=r4 label=return_34
b 3b
.macro miscmp_word offsetlo offsethi
/* Macro to compare misaligned strings. */
/* r0, r1 are word-aligned, and at least one of the strings
is not double-word aligned. */
/* Compare one word in every loop iteration. */
/* OFFSETLO is the original bit-offset of r1 from a word-boundary,
OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word). */
/* Initialize the shift queue. */
ldr r5, [r1], #4
/* Compare one word from each string in every loop iteration. */
.p2align 2
7:
ldr r3, [r0], #4
S2LOMEM r5, r5, #\offsetlo
magic_find_zero_bytes w1=r3
cmp r7, ip, S2HIMEM #\offsetlo
and r2, r3, r6, S2LOMEM #\offsetlo
it eq
cmpeq r2, r5
bne return_25
ldr r5, [r1], #4
cmp ip, #0
eor r3, r2, r3
S2HIMEM r2, r5, #\offsethi
it eq
cmpeq r3, r2
bne return_32
b 7b
.endm /* miscmp_word */
strcmp_unaligned:
/* r0 is word-aligned, r1 is at offset ip from a word. */
/* Align r1 to the (previous) word-boundary. */
bic r1, r1, #3
/* Unaligned comparison word by word using LDRs. */
cmp ip, #2
beq miscmp_word_16 /* If ip == 2. */
bge miscmp_word_24 /* If ip == 3. */
miscmp_word offsetlo=8 offsethi=24 /* If ip == 1. */
miscmp_word_16: miscmp_word offsetlo=16 offsethi=16
miscmp_word_24: miscmp_word offsetlo=24 offsethi=8
return_32:
setup_return w1=r3, w2=r2
b do_return
return_34:
setup_return w1=r3, w2=r4
b do_return
return_25:
setup_return w1=r2, w2=r5
b do_return
return_35:
setup_return w1=r3, w2=r5
b do_return
return_24:
setup_return w1=r2, w2=r4
do_return:
#ifdef __ARMEB__
mov r0, ip
#else /* not __ARMEB__ */
rev r0, ip
#endif /* not __ARMEB__ */
/* Restore temporaries early, before computing the return value. */
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
/* There is a zero or a different byte between r1 and r2. */
/* r0 contains a mask of all-zero bytes in r1. */
/* Using r0 and not ip here because cbz requires low register. */
m_cbz reg=r0, label=compute_return_value
clz r0, r0
/* r0 contains the number of bits on the left of the first all-zero byte in r1. */
rsb r0, r0, #24
/* Here, r0 contains the number of bits on the right of the first all-zero byte in r1. */
lsr r1, r1, r0
lsr r2, r2, r0
compute_return_value:
movs r0, #1
cmp r1, r2
/* The return value is computed as follows.
If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
which means r0:=r0-r0-1 and r0 is #-1 at return.
If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
which means r0:=r0-r0 and r0 is #0 at return.
(C==0 and Z==1) cannot happen because the carry bit is "not borrow". */
it ls
sbcls r0, r0, r0
bx lr
.fnend
.size strcmp, .-strcmp

View file

@ -0,0 +1,136 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (c) 2008 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Android adaptation and tweak by Jim Huang <jserv@0xlab.org>.
*/
.globl strcpy
.type strcpy, %function
.text
strcpy:
.fnstart
PLD [r1, #0]
eor r2, r0, r1
mov ip, r0
tst r2, #3
bne 4f
tst r1, #3
bne 3f
5:
str r5, [sp, #-4]!
mov r5, #0x01
orr r5, r5, r5, lsl #8
orr r5, r5, r5, lsl #16
str r4, [sp, #-4]!
tst r1, #4
ldr r3, [r1], #4
beq 2f
sub r2, r3, r5
bics r2, r2, r3
tst r2, r5, lsl #7
itt eq
streq r3, [ip], #4
ldreq r3, [r1], #4
bne 1f
/* Inner loop. We now know that r1 is 64-bit aligned, so we
can safely fetch up to two words. This allows us to avoid
load stalls. */
.p2align 2
2:
PLD [r1, #8]
ldr r4, [r1], #4
sub r2, r3, r5
bics r2, r2, r3
tst r2, r5, lsl #7
sub r2, r4, r5
bne 1f
str r3, [ip], #4
bics r2, r2, r4
tst r2, r5, lsl #7
itt eq
ldreq r3, [r1], #4
streq r4, [ip], #4
beq 2b
mov r3, r4
1:
#ifdef __ARMEB__
rors r3, r3, #24
#endif
strb r3, [ip], #1
tst r3, #0xff
#ifdef __ARMEL__
ror r3, r3, #8
#endif
bne 1b
ldr r4, [sp], #4
ldr r5, [sp], #4
bx lr
/* Strings have the same offset from word alignment, but it's
not zero. */
3:
tst r1, #1
beq 1f
ldrb r2, [r1], #1
strb r2, [ip], #1
cmp r2, #0
it eq
bxeq lr
1:
tst r1, #2
beq 5b
ldrh r2, [r1], #2
#ifdef __ARMEB__
tst r2, #0xff00
iteet ne
strneh r2, [ip], #2
lsreq r2, r2, #8
streqb r2, [ip]
tstne r2, #0xff
#else
tst r2, #0xff
itet ne
strneh r2, [ip], #2
streqb r2, [ip]
tstne r2, #0xff00
#endif
bne 5b
bx lr
/* src and dst do not have a common word-alignement. Fall back to
byte copying. */
4:
ldrb r2, [r1], #1
strb r2, [ip], #1
cmp r2, #0
bne 4b
bx lr
.fnend

View file

@ -0,0 +1,132 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#include <stdint.h>
#undef strlen
#define __ARM_HAVE_PLD 1
size_t strlen(const char *s)
{
__builtin_prefetch(s);
__builtin_prefetch(s+32);
union {
const char *b;
const uint32_t *w;
uintptr_t i;
} u;
// these are some scratch variables for the asm code below
uint32_t v, t;
// initialize the string length to zero
size_t l = 0;
// align the pointer to a 32-bit word boundary
u.b = s;
while (u.i & 0x3) {
if (__builtin_expect(*u.b++ == 0, 0)) {
goto done;
}
l++;
}
// loop for each word, testing if it contains a zero byte
// if so, exit the loop and update the length.
// We need to process 32 bytes per loop to schedule PLD properly
// and achieve the maximum bus speed.
asm(
"ldr %[v], [%[s]], #4 \n"
"sub %[l], %[l], %[s] \n"
"0: \n"
#if __ARM_HAVE_PLD
"pld [%[s], #64] \n"
#endif
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
#if !defined(__OPTIMIZE_SIZE__)
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]] , #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
#endif
"beq 0b \n"
"1: \n"
"add %[l], %[l], %[s] \n"
"tst %[v], #0xFF \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF00 \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF0000 \n"
"addne %[l], %[l], #1 \n"
"2: \n"
: [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b)
: "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL)
: "cc"
);
done:
return l;
}

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1,341 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_32_BYTE_CACHE_LINE
#define CACHE_LINE_SIZE 32
#else
#define CACHE_LINE_SIZE 64
#endif
/*
* Optimized memcmp() for Cortex-A9.
*/
.text
.globl memcmp
.type memcmp,%function
memcmp:
.fnstart
pld [r0, #(CACHE_LINE_SIZE * 0)]
pld [r0, #(CACHE_LINE_SIZE * 1)]
/* take of the case where length is 0 or the buffers are the same */
cmp r0, r1
moveq r0, #0
bxeq lr
pld [r1, #(CACHE_LINE_SIZE * 0)]
pld [r1, #(CACHE_LINE_SIZE * 1)]
/* make sure we have at least 8+4 bytes, this simplify things below
* and avoid some overhead for small blocks
*/
cmp r2, #(8+4)
bmi 10f
/*
* Neon optimization
* Comparing 32 bytes at a time
*/
#if defined(__ARM_NEON__) && defined(NEON_UNALIGNED_ACCESS)
subs r2, r2, #32
blo 3f
/* preload all the cache lines we need. */
pld [r0, #(CACHE_LINE_SIZE * 2)]
pld [r1, #(CACHE_LINE_SIZE * 2)]
1: /* The main loop compares 32 bytes at a time */
vld1.8 {d0 - d3}, [r0]!
pld [r0, #(CACHE_LINE_SIZE * 2)]
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(CACHE_LINE_SIZE * 2)]
/* Start subtracting the values and merge results */
vsub.i8 q0, q2
vsub.i8 q1, q3
vorr q2, q0, q1
vorr d4, d5
vmov r3, ip, d4
/* Check if there are any differences among the 32 bytes */
orrs r3, ip
bne 2f
subs r2, r2, #32
bhs 1b
b 3f
2:
/* Check if the difference was in the first or last 16 bytes */
sub r0, #32
vorr d0, d1
sub r1, #32
vmov r3, ip, d0
orrs r3, ip
/* if the first 16 bytes are equal, we only have to rewind 16 bytes */
ittt eq
subeq r2, #16
addeq r0, #16
addeq r1, #16
3: /* fix-up the remaining count */
add r2, r2, #32
cmp r2, #(8+4)
bmi 10f
#endif
.save {r4, lr}
/* save registers */
stmfd sp!, {r4, lr}
/* since r0 hold the result, move the first source
* pointer somewhere else
*/
mov r4, r0
/* align first pointer to word boundary
* offset = -src & 3
*/
rsb r3, r4, #0
ands r3, r3, #3
beq 0f
/* align first pointer */
sub r2, r2, r3
1: ldrb r0, [r4], #1
ldrb ip, [r1], #1
subs r0, r0, ip
bne 9f
subs r3, r3, #1
bne 1b
0: /* here the first pointer is aligned, and we have at least 4 bytes
* to process.
*/
/* see if the pointers are congruent */
eor r0, r4, r1
ands r0, r0, #3
bne 5f
/* congruent case, 32 bytes per iteration
* We need to make sure there are at least 32+4 bytes left
* because we effectively read ahead one word, and we could
* read past the buffer (and segfault) if we're not careful.
*/
ldr ip, [r1]
subs r2, r2, #(32 + 4)
bmi 1f
0: pld [r4, #(CACHE_LINE_SIZE * 2)]
pld [r1, #(CACHE_LINE_SIZE * 2)]
ldr r0, [r4], #4
ldr lr, [r1, #4]!
eors r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
bne 2f
subs r2, r2, #32
bhs 0b
/* do we have at least 4 bytes left? */
1: adds r2, r2, #(32 - 4 + 4)
bmi 4f
/* finish off 4 bytes at a time */
3: ldr r0, [r4], #4
ldr ip, [r1], #4
eors r0, r0, ip
bne 2f
subs r2, r2, #4
bhs 3b
/* are we done? */
4: adds r2, r2, #4
moveq r0, #0
beq 9f
/* finish off the remaining bytes */
b 8f
2: /* the last 4 bytes are different, restart them */
sub r4, r4, #4
sub r1, r1, #4
mov r2, #4
/* process the last few bytes */
8: ldrb r0, [r4], #1
ldrb ip, [r1], #1
// stall
subs r0, r0, ip
bne 9f
subs r2, r2, #1
bne 8b
9: /* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
10: /* process less than 12 bytes */
cmp r2, #0
moveq r0, #0
bxeq lr
mov r3, r0
11:
ldrb r0, [r3], #1
ldrb ip, [r1], #1
subs r0, ip
bxne lr
subs r2, r2, #1
bne 11b
bx lr
5: /*************** non-congruent case ***************/
and r0, r1, #3
cmp r0, #2
bne 4f
/* here, offset is 2 (16-bits aligned, special cased) */
/* make sure we have at least 16 bytes to process */
subs r2, r2, #16
addmi r2, r2, #16
bmi 8b
/* align the unaligned pointer */
bic r1, r1, #3
ldr lr, [r1], #4
6: pld [r1, #(CACHE_LINE_SIZE * 2)]
pld [r4, #(CACHE_LINE_SIZE * 2)]
mov ip, lr, lsr #16
ldr lr, [r1], #4
ldr r0, [r4], #4
orr ip, ip, lr, lsl #16
eors r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #16
bhs 6b
sub r1, r1, #2
/* are we done? */
adds r2, r2, #16
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #(4+2)
sub r4, r4, #4
mov r2, #4
b 8b
4: /*************** offset is 1 or 3 (less optimized) ***************/
stmfd sp!, {r5, r6, r7}
// r5 = rhs
// r6 = lhs
// r7 = scratch
mov r5, r0, lsl #3 /* r5 = right shift */
rsb r6, r5, #32 /* r6 = left shift */
/* align the unaligned pointer */
bic r1, r1, #3
ldr r7, [r1], #4
sub r2, r2, #8
6: mov ip, r7, lsr r5
ldr r7, [r1], #4
ldr r0, [r4], #4
orr ip, ip, r7, lsl r6
eors r0, r0, ip
moveq ip, r7, lsr r5
ldreq r7, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, r7, lsl r6
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #8
bhs 6b
sub r1, r1, r6, lsr #3
ldmfd sp!, {r5, r6, r7}
/* are we done? */
adds r2, r2, #8
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #4
sub r1, r1, r6, lsr #3
sub r4, r4, #4
mov r2, #4
ldmfd sp!, {r5, r6, r7}
b 8b
.fnend
.size memcmp, .-memcmp

View file

@ -0,0 +1,212 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* This code assumes it is running on a processor that supports all arm v7
* instructions, that supports neon instructions, and that has a 32 byte
* cache line.
*/
.text
.fpu neon
#define CACHE_LINE_SIZE 32
.globl memcpy
.type memcpy,%function
memcpy:
.fnstart
.save {r0, lr}
/* start preloading as early as possible */
pld [r1, #(CACHE_LINE_SIZE * 0)]
stmfd sp!, {r0, lr}
pld [r1, #(CACHE_LINE_SIZE * 2)]
// Check so divider is at least 16 bytes, needed for alignment code.
cmp r2, #16
blo 5f
/* check if buffers are aligned. If so, run arm-only version */
eor r3, r0, r1
ands r3, r3, #0x3
beq 11f
/* Check the upper size limit for Neon unaligned memory access in memcpy */
cmp r2, #224
blo 3f
/* align destination to 16 bytes for the write-buffer */
rsb r3, r0, #0
ands r3, r3, #0xF
beq 3f
/* copy up to 15-bytes (count in r3) */
sub r2, r2, r3
movs ip, r3, lsl #31
ldrmib lr, [r1], #1
strmib lr, [r0], #1
ldrcsb ip, [r1], #1
ldrcsb lr, [r1], #1
strcsb ip, [r0], #1
strcsb lr, [r0], #1
movs ip, r3, lsl #29
bge 1f
// copies 4 bytes, destination 32-bits aligned
vld1.32 {d0[0]}, [r1]!
vst1.32 {d0[0]}, [r0, :32]!
1: bcc 2f
// copies 8 bytes, destination 64-bits aligned
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0, :64]!
2:
/* preload immediately the next cache line, which we may need */
pld [r1, #(CACHE_LINE_SIZE * 0)]
pld [r1, #(CACHE_LINE_SIZE * 2)]
3:
/* make sure we have at least 64 bytes to copy */
subs r2, r2, #64
blo 2f
/* preload all the cache lines we need */
pld [r1, #(CACHE_LINE_SIZE * 4)]
pld [r1, #(CACHE_LINE_SIZE * 6)]
1: /* The main loop copies 64 bytes at a time */
vld1.8 {d0 - d3}, [r1]!
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(CACHE_LINE_SIZE * 6)]
subs r2, r2, #64
vst1.8 {d0 - d3}, [r0]!
vst1.8 {d4 - d7}, [r0]!
bhs 1b
2: /* fix-up the remaining count and make sure we have >= 32 bytes left */
add r2, r2, #64
subs r2, r2, #32
blo 4f
3: /* 32 bytes at a time. These cache lines were already preloaded */
vld1.8 {d0 - d3}, [r1]!
subs r2, r2, #32
vst1.8 {d0 - d3}, [r0]!
bhs 3b
4: /* less than 32 left */
add r2, r2, #32
tst r2, #0x10
beq 5f
// copies 16 bytes, 128-bits aligned
vld1.8 {d0, d1}, [r1]!
vst1.8 {d0, d1}, [r0]!
5: /* copy up to 15-bytes (count in r2) */
movs ip, r2, lsl #29
bcc 1f
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0]!
1: bge 2f
vld1.32 {d0[0]}, [r1]!
vst1.32 {d0[0]}, [r0]!
2: movs ip, r2, lsl #31
ldrmib r3, [r1], #1
ldrcsb ip, [r1], #1
ldrcsb lr, [r1], #1
strmib r3, [r0], #1
strcsb ip, [r0], #1
strcsb lr, [r0], #1
ldmfd sp!, {r0, lr}
bx lr
11:
/* Simple arm-only copy loop to handle aligned copy operations */
stmfd sp!, {r4, r5, r6, r7, r8}
pld [r1, #(CACHE_LINE_SIZE * 4)]
/* Check alignment */
rsb r3, r1, #0
ands r3, #3
beq 2f
/* align source to 32 bits. We need to insert 2 instructions between
* a ldr[b|h] and str[b|h] because byte and half-word instructions
* stall 2 cycles.
*/
movs r12, r3, lsl #31
sub r2, r2, r3 /* we know that r3 <= r2 because r2 >= 4 */
ldrmib r3, [r1], #1
ldrcsb r4, [r1], #1
ldrcsb r5, [r1], #1
strmib r3, [r0], #1
strcsb r4, [r0], #1
strcsb r5, [r0], #1
2:
subs r2, r2, #64
blt 4f
3: /* Main copy loop, copying 64 bytes at a time */
pld [r1, #(CACHE_LINE_SIZE * 8)]
ldmia r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
stmia r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
ldmia r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
stmia r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
subs r2, r2, #64
bge 3b
4: /* Check if there are > 32 bytes left */
adds r2, r2, #64
subs r2, r2, #32
blt 5f
/* Copy 32 bytes */
ldmia r1!, {r3, r4, r5, r6, r7, r8, r12, lr}
stmia r0!, {r3, r4, r5, r6, r7, r8, r12, lr}
subs r2, #32
5: /* Handle any remaining bytes */
adds r2, #32
beq 6f
movs r12, r2, lsl #28
ldmcsia r1!, {r3, r4, r5, r6} /* 16 bytes */
ldmmiia r1!, {r7, r8} /* 8 bytes */
stmcsia r0!, {r3, r4, r5, r6}
stmmiia r0!, {r7, r8}
movs r12, r2, lsl #30
ldrcs r3, [r1], #4 /* 4 bytes */
ldrmih r4, [r1], #2 /* 2 bytes */
strcs r3, [r0], #4
strmih r4, [r0], #2
tst r2, #0x1
ldrneb r3, [r1] /* last byte */
strneb r3, [r0]
6:
ldmfd sp!, {r4, r5, r6, r7, r8}
ldmfd sp!, {r0, pc}
.fnend
.size memcpy, .-memcpy

View file

@ -0,0 +1,149 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* This code assumes it is running on a processor that supports all arm v7
* instructions and that supports neon instructions.
*/
.text
.fpu neon
/* memset() returns its first argument. */
.globl memset
.type memset,%function
memset:
.fnstart
# The neon memset only wins for less than 132.
cmp r2, #132
bhi 11f
.save {r0}
stmfd sp!, {r0}
vdup.8 q0, r1
/* make sure we have at least 32 bytes to write */
subs r2, r2, #32
blo 2f
vmov q1, q0
1: /* The main loop writes 32 bytes at a time */
subs r2, r2, #32
vst1.8 {d0 - d3}, [r0]!
bhs 1b
2: /* less than 32 left */
add r2, r2, #32
tst r2, #0x10
beq 3f
// writes 16 bytes, 128-bits aligned
vst1.8 {d0, d1}, [r0]!
3: /* write up to 15-bytes (count in r2) */
movs ip, r2, lsl #29
bcc 1f
vst1.8 {d0}, [r0]!
1: bge 2f
vst1.32 {d0[0]}, [r0]!
2: movs ip, r2, lsl #31
strmib r1, [r0], #1
strcsb r1, [r0], #1
strcsb r1, [r0], #1
ldmfd sp!, {r0}
bx lr
11:
/* compute the offset to align the destination
* offset = (4-(src&3))&3 = -src & 3
*/
.save {r0, r4-r7, lr}
stmfd sp!, {r0, r4-r7, lr}
rsb r3, r0, #0
ands r3, r3, #3
cmp r3, r2
movhi r3, r2
/* splat r1 */
mov r1, r1, lsl #24
orr r1, r1, r1, lsr #8
orr r1, r1, r1, lsr #16
movs r12, r3, lsl #31
strcsb r1, [r0], #1 /* can't use strh (alignment unknown) */
strcsb r1, [r0], #1
strmib r1, [r0], #1
subs r2, r2, r3
ldmlsfd sp!, {r0, r4-r7, lr} /* return */
bxls lr
/* align the destination to a cache-line */
mov r12, r1
mov lr, r1
mov r4, r1
mov r5, r1
mov r6, r1
mov r7, r1
rsb r3, r0, #0
ands r3, r3, #0x1C
beq 3f
cmp r3, r2
andhi r3, r2, #0x1C
sub r2, r2, r3
/* conditionally writes 0 to 7 words (length in r3) */
movs r3, r3, lsl #28
stmcsia r0!, {r1, lr}
stmcsia r0!, {r1, lr}
stmmiia r0!, {r1, lr}
movs r3, r3, lsl #2
strcs r1, [r0], #4
3:
subs r2, r2, #32
mov r3, r1
bmi 2f
1: subs r2, r2, #32
stmia r0!, {r1,r3,r4,r5,r6,r7,r12,lr}
bhs 1b
2: add r2, r2, #32
/* conditionally stores 0 to 31 bytes */
movs r2, r2, lsl #28
stmcsia r0!, {r1,r3,r12,lr}
stmmiia r0!, {r1, lr}
movs r2, r2, lsl #2
strcs r1, [r0], #4
strmih r1, [r0], #2
movs r2, r2, lsl #2
strcsb r1, [r0]
ldmfd sp!, {r0, r4-r7, lr}
bx lr
.fnend
.size memset, .-memset

View file

@ -0,0 +1,545 @@
/*
* Copyright (c) 2013 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __ARMEB__
#define S2LOMEM lsl
#define S2LOMEMEQ lsleq
#define S2HIMEM lsr
#define MSB 0x000000ff
#define LSB 0xff000000
#define BYTE0_OFFSET 24
#define BYTE1_OFFSET 16
#define BYTE2_OFFSET 8
#define BYTE3_OFFSET 0
#else /* not __ARMEB__ */
#define S2LOMEM lsr
#define S2LOMEMEQ lsreq
#define S2HIMEM lsl
#define BYTE0_OFFSET 0
#define BYTE1_OFFSET 8
#define BYTE2_OFFSET 16
#define BYTE3_OFFSET 24
#define MSB 0xff000000
#define LSB 0x000000ff
#endif /* not __ARMEB__ */
.syntax unified
#if defined (__thumb__)
.thumb
.thumb_func
#endif
.globl strcmp
.type strcmp,%function
strcmp:
.fnstart
/* Use LDRD whenever possible. */
/* The main thing to look out for when comparing large blocks is that
the loads do not cross a page boundary when loading past the index
of the byte with the first difference or the first string-terminator.
For example, if the strings are identical and the string-terminator
is at index k, byte by byte comparison will not load beyond address
s1+k and s2+k; word by word comparison may load up to 3 bytes beyond
k; double word - up to 7 bytes. If the load of these bytes crosses
a page boundary, it might cause a memory fault (if the page is not mapped)
that would not have happened in byte by byte comparison.
If an address is (double) word aligned, then a load of a (double) word
from that address will not cross a page boundary.
Therefore, the algorithm below considers word and double-word alignment
of strings separately. */
/* High-level description of the algorithm.
* The fast path: if both strings are double-word aligned,
use LDRD to load two words from each string in every loop iteration.
* If the strings have the same offset from a word boundary,
use LDRB to load and compare byte by byte until
the first string is aligned to a word boundary (at most 3 bytes).
This is optimized for quick return on short unaligned strings.
* If the strings have the same offset from a double-word boundary,
use LDRD to load two words from each string in every loop iteration, as in the fast path.
* If the strings do not have the same offset from a double-word boundary,
load a word from the second string before the loop to initialize the queue.
Use LDRD to load two words from every string in every loop iteration.
Inside the loop, load the second word from the second string only after comparing
the first word, using the queued value, to guarantee safety across page boundaries.
* If the strings do not have the same offset from a word boundary,
use LDR and a shift queue. Order of loads and comparisons matters,
similarly to the previous case.
* Use UADD8 and SEL to compare words, and use REV and CLZ to compute the return value.
* The only difference between ARM and Thumb modes is the use of CBZ instruction.
* The only difference between big and little endian is the use of REV in little endian
to compute the return value, instead of MOV.
*/
.macro m_cbz reg label
#ifdef __thumb2__
cbz \reg, \label
#else /* not defined __thumb2__ */
cmp \reg, #0
beq \label
#endif /* not defined __thumb2__ */
.endm /* m_cbz */
.macro m_cbnz reg label
#ifdef __thumb2__
cbnz \reg, \label
#else /* not defined __thumb2__ */
cmp \reg, #0
bne \label
#endif /* not defined __thumb2__ */
.endm /* m_cbnz */
.macro init
/* Macro to save temporary registers and prepare magic values. */
subs sp, sp, #16
strd r4, r5, [sp, #8]
strd r6, r7, [sp]
mvn r6, #0 /* all F */
mov r7, #0 /* all 0 */
.endm /* init */
.macro magic_compare_and_branch w1 w2 label
/* Macro to compare registers w1 and w2 and conditionally branch to label. */
cmp \w1, \w2 /* Are w1 and w2 the same? */
magic_find_zero_bytes \w1
it eq
cmpeq ip, #0 /* Is there a zero byte in w1? */
bne \label
.endm /* magic_compare_and_branch */
.macro magic_find_zero_bytes w1
/* Macro to find all-zero bytes in w1, result is in ip. */
#if (defined (__ARM_FEATURE_DSP))
uadd8 ip, \w1, r6
sel ip, r7, r6
#else /* not defined (__ARM_FEATURE_DSP) */
/* __ARM_FEATURE_DSP is not defined for some Cortex-M processors.
Coincidently, these processors only have Thumb-2 mode, where we can use the
the (large) magic constant available directly as an immediate in instructions.
Note that we cannot use the magic constant in ARM mode, where we need
to create the constant in a register. */
sub ip, \w1, #0x01010101
bic ip, ip, \w1
and ip, ip, #0x80808080
#endif /* not defined (__ARM_FEATURE_DSP) */
.endm /* magic_find_zero_bytes */
.macro setup_return w1 w2
#ifdef __ARMEB__
mov r1, \w1
mov r2, \w2
#else /* not __ARMEB__ */
rev r1, \w1
rev r2, \w2
#endif /* not __ARMEB__ */
.endm /* setup_return */
pld [r0, #0]
pld [r1, #0]
/* Are both strings double-word aligned? */
orr ip, r0, r1
tst ip, #7
bne do_align
/* Fast path. */
init
doubleword_aligned:
/* Get here when the strings to compare are double-word aligned. */
/* Compare two words in every iteration. */
.p2align 2
2:
pld [r0, #16]
pld [r1, #16]
/* Load the next double-word from each string. */
ldrd r2, r3, [r0], #8
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r2, w2=r4, label=return_24
magic_compare_and_branch w1=r3, w2=r5, label=return_35
b 2b
do_align:
/* Is the first string word-aligned? */
ands ip, r0, #3
beq word_aligned_r0
/* Fast compare byte by byte until the first string is word-aligned. */
/* The offset of r0 from a word boundary is in ip. Thus, the number of bytes
to read until the next word boundary is 4-ip. */
bic r0, r0, #3
ldr r2, [r0], #4
lsls ip, ip, #31
beq byte2
bcs byte3
byte1:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE1_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
byte2:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE2_OFFSET
subs ip, r3, ip
bne fast_return
m_cbz reg=r3, label=fast_return
byte3:
ldrb ip, [r1], #1
uxtb r3, r2, ror #BYTE3_OFFSET
subs ip, r3, ip
bne fast_return
m_cbnz reg=r3, label=word_aligned_r0
fast_return:
mov r0, ip
bx lr
word_aligned_r0:
init
/* The first string is word-aligned. */
/* Is the second string word-aligned? */
ands ip, r1, #3
bne strcmp_unaligned
word_aligned:
/* The strings are word-aligned. */
/* Is the first string double-word aligned? */
tst r0, #4
beq doubleword_aligned_r0
/* If r0 is not double-word aligned yet, align it by loading
and comparing the next word from each string. */
ldr r2, [r0], #4
ldr r4, [r1], #4
magic_compare_and_branch w1=r2 w2=r4 label=return_24
doubleword_aligned_r0:
/* Get here when r0 is double-word aligned. */
/* Is r1 doubleword_aligned? */
tst r1, #4
beq doubleword_aligned
/* Get here when the strings to compare are word-aligned,
r0 is double-word aligned, but r1 is not double-word aligned. */
/* Initialize the queue. */
ldr r5, [r1], #4
/* Compare two words in every iteration. */
.p2align 2
3:
pld [r0, #16]
pld [r1, #16]
/* Load the next double-word from each string and compare. */
ldrd r2, r3, [r0], #8
magic_compare_and_branch w1=r2 w2=r5 label=return_25
ldrd r4, r5, [r1], #8
magic_compare_and_branch w1=r3 w2=r4 label=return_34
b 3b
.macro miscmp_word offsetlo offsethi
/* Macro to compare misaligned strings. */
/* r0, r1 are word-aligned, and at least one of the strings
is not double-word aligned. */
/* Compare one word in every loop iteration. */
/* OFFSETLO is the original bit-offset of r1 from a word-boundary,
OFFSETHI is 32 - OFFSETLO (i.e., offset from the next word). */
/* Initialize the shift queue. */
ldr r5, [r1], #4
/* Compare one word from each string in every loop iteration. */
.p2align 2
7:
ldr r3, [r0], #4
S2LOMEM r5, r5, #\offsetlo
magic_find_zero_bytes w1=r3
cmp r7, ip, S2HIMEM #\offsetlo
and r2, r3, r6, S2LOMEM #\offsetlo
it eq
cmpeq r2, r5
bne return_25
ldr r5, [r1], #4
cmp ip, #0
eor r3, r2, r3
S2HIMEM r2, r5, #\offsethi
it eq
cmpeq r3, r2
bne return_32
b 7b
.endm /* miscmp_word */
return_32:
setup_return w1=r3, w2=r2
b do_return
return_34:
setup_return w1=r3, w2=r4
b do_return
return_25:
setup_return w1=r2, w2=r5
b do_return
return_35:
setup_return w1=r3, w2=r5
b do_return
return_24:
setup_return w1=r2, w2=r4
do_return:
#ifdef __ARMEB__
mov r0, ip
#else /* not __ARMEB__ */
rev r0, ip
#endif /* not __ARMEB__ */
/* Restore temporaries early, before computing the return value. */
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
/* There is a zero or a different byte between r1 and r2. */
/* r0 contains a mask of all-zero bytes in r1. */
/* Using r0 and not ip here because cbz requires low register. */
m_cbz reg=r0, label=compute_return_value
clz r0, r0
/* r0 contains the number of bits on the left of the first all-zero byte in r1. */
rsb r0, r0, #24
/* Here, r0 contains the number of bits on the right of the first all-zero byte in r1. */
lsr r1, r1, r0
lsr r2, r2, r0
compute_return_value:
movs r0, #1
cmp r1, r2
/* The return value is computed as follows.
If r1>r2 then (C==1 and Z==0) and LS doesn't hold and r0 is #1 at return.
If r1<r2 then (C==0 and Z==0) and we execute SBC with carry_in=0,
which means r0:=r0-r0-1 and r0 is #-1 at return.
If r1=r2 then (C==1 and Z==1) and we execute SBC with carry_in=1,
which means r0:=r0-r0 and r0 is #0 at return.
(C==0 and Z==1) cannot happen because the carry bit is "not borrow". */
it ls
sbcls r0, r0, r0
bx lr
/* The code from the previous version of strcmp.S handles all of the
* cases where the first string and seconds string cannot both be
* aligned to a word boundary faster than the new algorithm. See
* bionic/libc/arch-arm/cortex-a15/bionic/strcmp.S for the unedited
* version of the code.
*/
strcmp_unaligned:
wp1 .req r0
wp2 .req r1
b1 .req r2
w1 .req r4
w2 .req r5
t1 .req ip
@ r3 is scratch
2:
mov b1, #1
orr b1, b1, b1, lsl #8
orr b1, b1, b1, lsl #16
and t1, wp2, #3
bic wp2, wp2, #3
ldr w1, [wp1], #4
ldr w2, [wp2], #4
cmp t1, #2
beq 2f
bhi 3f
/* Critical inner Loop: Block with 3 bytes initial overlap */
.p2align 2
1:
bic t1, w1, #MSB
cmp t1, w2, S2LOMEM #8
sub r3, w1, b1
bic r3, r3, w1
bne 4f
ands r3, r3, b1, lsl #7
it eq
ldreq w2, [wp2], #4
bne 5f
eor t1, t1, w1
cmp t1, w2, S2HIMEM #24
bne 6f
ldr w1, [wp1], #4
b 1b
4:
S2LOMEM w2, w2, #8
b 8f
5:
#ifdef __ARMEB__
/* The syndrome value may contain false ones if the string ends
* with the bytes 0x01 0x00
*/
tst w1, #0xff000000
itt ne
tstne w1, #0x00ff0000
tstne w1, #0x0000ff00
beq 7f
#else
bics r3, r3, #0xff000000
bne 7f
#endif
ldrb w2, [wp2]
S2LOMEM t1, w1, #24
#ifdef __ARMEB__
lsl w2, w2, #24
#endif
b 8f
6:
S2LOMEM t1, w1, #24
and w2, w2, #LSB
b 8f
/* Critical inner Loop: Block with 2 bytes initial overlap */
.p2align 2
2:
S2HIMEM t1, w1, #16
sub r3, w1, b1
S2LOMEM t1, t1, #16
bic r3, r3, w1
cmp t1, w2, S2LOMEM #16
bne 4f
ands r3, r3, b1, lsl #7
it eq
ldreq w2, [wp2], #4
bne 5f
eor t1, t1, w1
cmp t1, w2, S2HIMEM #16
bne 6f
ldr w1, [wp1], #4
b 2b
5:
#ifdef __ARMEB__
/* The syndrome value may contain false ones if the string ends
* with the bytes 0x01 0x00
*/
tst w1, #0xff000000
it ne
tstne w1, #0x00ff0000
beq 7f
#else
lsls r3, r3, #16
bne 7f
#endif
ldrh w2, [wp2]
S2LOMEM t1, w1, #16
#ifdef __ARMEB__
lsl w2, w2, #16
#endif
b 8f
6:
S2HIMEM w2, w2, #16
S2LOMEM t1, w1, #16
4:
S2LOMEM w2, w2, #16
b 8f
/* Critical inner Loop: Block with 1 byte initial overlap */
.p2align 2
3:
and t1, w1, #LSB
cmp t1, w2, S2LOMEM #24
sub r3, w1, b1
bic r3, r3, w1
bne 4f
ands r3, r3, b1, lsl #7
it eq
ldreq w2, [wp2], #4
bne 5f
eor t1, t1, w1
cmp t1, w2, S2HIMEM #8
bne 6f
ldr w1, [wp1], #4
b 3b
4:
S2LOMEM w2, w2, #24
b 8f
5:
/* The syndrome value may contain false ones if the string ends
* with the bytes 0x01 0x00
*/
tst w1, #LSB
beq 7f
ldr w2, [wp2], #4
6:
S2LOMEM t1, w1, #8
bic w2, w2, #MSB
b 8f
7:
mov r0, #0
/* Restore registers and stack. */
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
bx lr
8:
and r2, t1, #LSB
and r0, w2, #LSB
cmp r0, #1
it cs
cmpcs r0, r2
itt eq
S2LOMEMEQ t1, t1, #8
S2LOMEMEQ w2, w2, #8
beq 8b
sub r0, r2, r0
/* Restore registers and stack. */
ldrd r6, r7, [sp]
ldrd r4, r5, [sp, #8]
adds sp, sp, #16
bx lr
.fnend
.size strcmp, .-strcmp

View file

@ -0,0 +1,136 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (c) 2008 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Android adaptation and tweak by Jim Huang <jserv@0xlab.org>.
*/
.globl strcpy
.type strcpy, %function
.text
strcpy:
.fnstart
PLD [r1, #0]
eor r2, r0, r1
mov ip, r0
tst r2, #3
bne 4f
tst r1, #3
bne 3f
5:
str r5, [sp, #-4]!
mov r5, #0x01
orr r5, r5, r5, lsl #8
orr r5, r5, r5, lsl #16
str r4, [sp, #-4]!
tst r1, #4
ldr r3, [r1], #4
beq 2f
sub r2, r3, r5
bics r2, r2, r3
tst r2, r5, lsl #7
itt eq
streq r3, [ip], #4
ldreq r3, [r1], #4
bne 1f
/* Inner loop. We now know that r1 is 64-bit aligned, so we
can safely fetch up to two words. This allows us to avoid
load stalls. */
.p2align 2
2:
PLD [r1, #8]
ldr r4, [r1], #4
sub r2, r3, r5
bics r2, r2, r3
tst r2, r5, lsl #7
sub r2, r4, r5
bne 1f
str r3, [ip], #4
bics r2, r2, r4
tst r2, r5, lsl #7
itt eq
ldreq r3, [r1], #4
streq r4, [ip], #4
beq 2b
mov r3, r4
1:
#ifdef __ARMEB__
rors r3, r3, #24
#endif
strb r3, [ip], #1
tst r3, #0xff
#ifdef __ARMEL__
ror r3, r3, #8
#endif
bne 1b
ldr r4, [sp], #4
ldr r5, [sp], #4
bx lr
/* Strings have the same offset from word alignment, but it's
not zero. */
3:
tst r1, #1
beq 1f
ldrb r2, [r1], #1
strb r2, [ip], #1
cmp r2, #0
it eq
bxeq lr
1:
tst r1, #2
beq 5b
ldrh r2, [r1], #2
#ifdef __ARMEB__
tst r2, #0xff00
iteet ne
strneh r2, [ip], #2
lsreq r2, r2, #8
streqb r2, [ip]
tstne r2, #0xff
#else
tst r2, #0xff
itet ne
strneh r2, [ip], #2
streqb r2, [ip]
tstne r2, #0xff00
#endif
bne 5b
bx lr
/* src and dst do not have a common word-alignement. Fall back to
byte copying. */
4:
ldrb r2, [r1], #1
strb r2, [ip], #1
cmp r2, #0
bne 4b
bx lr
.fnend

View file

@ -0,0 +1,132 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#include <stdint.h>
#undef strlen
#define __ARM_HAVE_PLD 1
size_t strlen(const char *s)
{
__builtin_prefetch(s);
__builtin_prefetch(s+32);
union {
const char *b;
const uint32_t *w;
uintptr_t i;
} u;
// these are some scratch variables for the asm code below
uint32_t v, t;
// initialize the string length to zero
size_t l = 0;
// align the pointer to a 32-bit word boundary
u.b = s;
while (u.i & 0x3) {
if (__builtin_expect(*u.b++ == 0, 0)) {
goto done;
}
l++;
}
// loop for each word, testing if it contains a zero byte
// if so, exit the loop and update the length.
// We need to process 32 bytes per loop to schedule PLD properly
// and achieve the maximum bus speed.
asm(
"ldr %[v], [%[s]], #4 \n"
"sub %[l], %[l], %[s] \n"
"0: \n"
#if __ARM_HAVE_PLD
"pld [%[s], #64] \n"
#endif
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
#if !defined(__OPTIMIZE_SIZE__)
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]] , #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [%[s]], #4 \n"
#endif
"beq 0b \n"
"1: \n"
"add %[l], %[l], %[s] \n"
"tst %[v], #0xFF \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF00 \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF0000 \n"
"addne %[l], %[l], #1 \n"
"2: \n"
: [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b)
: "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL)
: "cc"
);
done:
return l;
}

View file

View file

@ -0,0 +1,25 @@
reference/bionic-c/bcopy.o: reference/bionic-c/bcopy.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,27 @@
reference/bionic-c/memchr.o: reference/bionic-c/memchr.c \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stddef.h \
/usr/include/sys/_types.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/string.h /usr/include/sys/_null.h /usr/include/strings.h \
/usr/include/xlocale/_strings.h /usr/include/xlocale/_string.h
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stddef.h:
/usr/include/sys/_types.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/string.h:
/usr/include/sys/_null.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,25 @@
reference/bionic-c/memcmp.o: reference/bionic-c/memcmp.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,27 @@
reference/bionic-c/memcpy.o: reference/bionic-c/memcpy.c \
reference/bionic-c/bcopy.c /usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
reference/bionic-c/bcopy.c:
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,38 @@
reference/bionic-c/memset.o: reference/bionic-c/memset.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdint.h \
/usr/include/stdint.h /usr/include/machine/_stdint.h \
/usr/include/x86/_stdint.h /usr/include/sys/_stdint.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include/stdint.h:
/usr/include/stdint.h:
/usr/include/machine/_stdint.h:
/usr/include/x86/_stdint.h:
/usr/include/sys/_stdint.h:

View file

@ -0,0 +1,25 @@
reference/bionic-c/strchr.o: reference/bionic-c/strchr.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,25 @@
reference/bionic-c/strcmp.o: reference/bionic-c/strcmp.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,25 @@
reference/bionic-c/strcpy.o: reference/bionic-c/strcpy.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

@ -0,0 +1,25 @@
reference/bionic-c/strlen.o: reference/bionic-c/strlen.c \
/usr/include/string.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/include/strings.h /usr/include/xlocale/_strings.h \
/usr/include/xlocale/_string.h
/usr/include/string.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/include/strings.h:
/usr/include/xlocale/_strings.h:
/usr/include/xlocale/_string.h:

View file

128
reference/bionic-c/bcopy.c Normal file
View file

@ -0,0 +1,128 @@
/* $OpenBSD: bcopy.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
/*
* sizeof(word) MUST BE A POWER OF TWO
* SO THAT wmask BELOW IS ALL ONES
*/
typedef long word; /* "word" used for optimal copy speed */
#define wsize sizeof(word)
#define wmask (wsize - 1)
/*
* Copy a block of memory, handling overlap.
* This is the routine that actually implements
* (the portable versions of) bcopy, memcpy, and memmove.
*/
#ifdef MEMCOPY
void *
memcpy(void *dst0, const void *src0, size_t length)
#else
#ifdef MEMMOVE
void *
memmove(void *dst0, const void *src0, size_t length)
#else
void
bcopy(const void *src0, void *dst0, size_t length)
#endif
#endif
{
char *dst = dst0;
const char *src = src0;
size_t t;
if (length == 0 || dst == src) /* nothing to do */
goto done;
/*
* Macros: loop-t-times; and loop-t-times, t>0
*/
#define TLOOP(s) if (t) TLOOP1(s)
#define TLOOP1(s) do { s; } while (--t)
if ((unsigned long)dst < (unsigned long)src) {
/*
* Copy forward.
*/
t = (long)src; /* only need low bits */
if ((t | (long)dst) & wmask) {
/*
* Try to align operands. This cannot be done
* unless the low bits match.
*/
if ((t ^ (long)dst) & wmask || length < wsize)
t = length;
else
t = wsize - (t & wmask);
length -= t;
TLOOP1(*dst++ = *src++);
}
/*
* Copy whole words, then mop up any trailing bytes.
*/
t = length / wsize;
TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
t = length & wmask;
TLOOP(*dst++ = *src++);
} else {
/*
* Copy backwards. Otherwise essentially the same.
* Alignment works as before, except that it takes
* (t&wmask) bytes to align, not wsize-(t&wmask).
*/
src += length;
dst += length;
t = (long)src;
if ((t | (long)dst) & wmask) {
if ((t ^ (long)dst) & wmask || length <= wsize)
t = length;
else
t &= wmask;
length -= t;
TLOOP1(*--dst = *--src);
}
t = length / wsize;
TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src);
t = length & wmask;
TLOOP(*--dst = *--src);
}
done:
#if defined(MEMCOPY) || defined(MEMMOVE)
return (dst0);
#else
return;
#endif
}

View file

@ -0,0 +1,46 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stddef.h>
#include <string.h>
void *memchr(const void *s, int c, size_t n)
{
const unsigned char* p = s;
const unsigned char* end = p + n;
for (;;) {
if (p >= end || p[0] == c) break; p++;
if (p >= end || p[0] == c) break; p++;
if (p >= end || p[0] == c) break; p++;
if (p >= end || p[0] == c) break; p++;
}
if (p >= end)
return NULL;
else
return (void*) p;
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
int memcmp(const void *s1, const void *s2, size_t n)
{
const unsigned char* p1 = s1;
const unsigned char* end1 = p1 + n;
const unsigned char* p2 = s2;
int d = 0;
for (;;) {
if (d || p1 >= end1) break;
d = (int)*p1++ - (int)*p2++;
if (d || p1 >= end1) break;
d = (int)*p1++ - (int)*p2++;
if (d || p1 >= end1) break;
d = (int)*p1++ - (int)*p2++;
if (d || p1 >= end1) break;
d = (int)*p1++ - (int)*p2++;
}
return d;
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#define MEMCOPY
#include "bcopy.c"

View file

@ -0,0 +1,44 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#include <stdint.h>
void* memset(void* dst, int c, size_t n)
{
char* q = dst;
char* end = q + n;
for (;;) {
if (q >= end) break; *q++ = (char) c;
if (q >= end) break; *q++ = (char) c;
if (q >= end) break; *q++ = (char) c;
if (q >= end) break; *q++ = (char) c;
}
return dst;
}

View file

@ -0,0 +1,44 @@
/* $OpenBSD: index.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#undef strchr
char *
strchr(const char *p, int ch)
{
for (;; ++p) {
if (*p == (char) ch)
return((char *)p);
if (!*p)
return((char *)NULL);
}
/* NOTREACHED */
}

View file

@ -0,0 +1,52 @@
/* $OpenBSD: strcmp.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#undef strcmp
#else
#include <lib/libkern/libkern.h>
#endif
/*
* Compare strings.
*/
int
strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2++)
if (*s1++ == 0)
return (0);
return (*(unsigned char *)s1 - *(unsigned char *)--s2);
}

View file

@ -0,0 +1,41 @@
/* $OpenBSD: strcpy.c,v 1.8 2005/08/08 08:05:37 espie Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
char *
strcpy(char *to, const char *from)
{
char *save = to;
for (; (*to = *from) != '\0'; ++from, ++to);
return(save);
}

View file

@ -0,0 +1,47 @@
/* $OpenBSD: strlen.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#else
#include <lib/libkern/libkern.h>
#endif
size_t
strlen(const char *str)
{
const char *s;
for (s = str; *s; ++s)
;
return (s - str);
}

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

82
reference/csl/arm_asm.h Normal file
View file

@ -0,0 +1,82 @@
/*
* Copyright (c) 2009 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARM_ASM__H
#define ARM_ASM__H
/* First define some macros that keep everything else sane. */
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__)
#define _ISA_ARM_7
#endif
#if defined (_ISA_ARM_7) || defined (__ARM_ARCH_6__) || \
defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6T2__) || \
defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__) || \
defined (__ARM_ARCH_6Z__)
#define _ISA_ARM_6
#endif
#if defined (_ISA_ARM_6) || defined (__ARM_ARCH_5__) || \
defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5TE__) || \
defined (__ARM_ARCH_5TEJ__)
#define _ISA_ARM_5
#endif
#if defined (_ISA_ARM_5) || defined (__ARM_ARCH_4T__)
#define _ISA_ARM_4T
#endif
#if defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7__) || \
defined (__ARM_ARCH_7EM__)
#define _ISA_THUMB_2
#endif
#if defined (_ISA_THUMB_2) || defined (__ARM_ARCH_6M__)
#define _ISA_THUMB_1
#endif
/* Now some macros for common instruction sequences. */
asm(".macro RETURN cond=\n\t"
#if defined (_ISA_ARM_4T) || defined (_ISA_THUMB_1)
"bx\\cond lr\n\t"
#else
"mov\\cond pc, lr\n\t"
#endif
".endm"
);
asm(".macro optpld base, offset=#0\n\t"
#if defined (_ISA_ARM_7)
"pld [\\base, \\offset]\n\t"
#endif
".endm"
);
#endif /* ARM_ASM__H */

291
reference/csl/memcpy.c Normal file
View file

@ -0,0 +1,291 @@
/* Copyright (c) 2009 CodeSourcery, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of CodeSourcery nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "arm_asm.h"
#include <string.h>
#include <stdint.h>
#include <stddef.h>
/* Standard operations for word-sized values. */
#define WORD_REF(ADDRESS, OFFSET) \
*((WORD_TYPE*)((char*)(ADDRESS) + (OFFSET)))
#define WORD_COPY(OUT, IN, OFFSET) \
WORD_REF(OUT, OFFSET) = WORD_REF(IN, OFFSET)
/* On processors with NEON, we use 128-bit vectors. Also,
we need to include arm_neon.h to use these. */
#if defined(__ARM_NEON__)
#include <arm_neon.h>
#define WORD_TYPE uint8x16_t
#define WORD_SIZE 16
#define MAYBE_PREFETCH(IN) __builtin_prefetch((IN), 0, 0)
/* On ARM processors with 64-bit ldrd instructions, we use those,
except on Cortex-M* where benchmarking has shown them to
be slower. */
#elif defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__) || defined(_ISA_ARM_6)
#define WORD_TYPE uint64_t
#define WORD_SIZE 8
#define MAYBE_PREFETCH(IN) __builtin_prefetch((IN), 0, 0)
/* On everything else, we use 32-bit loads and stores, and
do not use prefetching. */
#else
#define WORD_TYPE uint32_t
#define WORD_SIZE 4
#define MAYBE_PREFETCH(IN)
#endif
/* On all ARM platforms, 'SHORTWORD' is a 32-bit value. */
#define SHORTWORD_TYPE uint32_t
#define SHORTWORD_SIZE 4
#define SHORTWORD_REF(ADDRESS, OFFSET) \
*((SHORTWORD_TYPE*)((char*)(ADDRESS) + (OFFSET)))
#define SHORTWORD_COPY(OUT, IN, OFFSET) \
SHORTWORD_REF(OUT, OFFSET) = SHORTWORD_REF(IN, OFFSET)
/* Shifting directionality depends on endianness. */
#ifdef __ARMEB__
#define SHORTWORD_SHIFT(IN0, IN1, OFFSET) \
((IN0) << ((OFFSET)*8)) | ((IN1) >> (SHORTWORD_SIZE*8 - (OFFSET)*8))
#else
#define SHORTWORD_SHIFT(IN0, IN1, OFFSET) \
((IN0) >> ((OFFSET)*8)) | ((IN1) << (SHORTWORD_SIZE*8 - (OFFSET)*8))
#endif
void *memcpy(void *OUT, const void *IN, size_t N)
{
void* OUT0 = OUT;
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
const char* OUT_end = (char*)OUT + N;
while ((char*)OUT < OUT_end) {
*((char*)OUT) = *((char*)IN);
OUT++;
IN++;
}
return OUT0;
#else
/* Handle short strings and immediately return. */
if (__builtin_expect(N < SHORTWORD_SIZE, 1)) {
size_t i = 0;
while (i < N) {
((char*)OUT)[i] = ((char*)IN)[i];
i++;
}
return OUT;
}
const char* OUT_end = (char*)OUT + N;
/* Align OUT to SHORTWORD_SIZE. */
while ((uintptr_t)OUT % SHORTWORD_SIZE != 0) {
*(char*) (OUT++) = *(char*) (IN++);
}
if ((uintptr_t) IN % SHORTWORD_SIZE == 0) {
#if WORD_SIZE > SHORTWORD_SIZE
/* Align OUT to WORD_SIZE in steps of SHORTWORD_SIZE. */
if (__builtin_expect(OUT_end - (char*)OUT >= WORD_SIZE, 0)) {
while ((uintptr_t)OUT % WORD_SIZE != 0) {
SHORTWORD_COPY(OUT, IN, 0);
OUT += SHORTWORD_SIZE;
IN += SHORTWORD_SIZE;
}
if ((uintptr_t) IN % WORD_SIZE == 0) {
#endif /* WORD_SIZE > SHORTWORD_SIZE */
#if defined(__ARM_NEON__)
/* Testing on Cortex-A8 indicates that the following idiom
produces faster assembly code when doing vector copies,
but not when doing regular copies. */
size_t i = 0;
N = OUT_end - (char*)OUT;
MAYBE_PREFETCH(IN + 64);
MAYBE_PREFETCH(IN + 128);
MAYBE_PREFETCH(IN + 192);
if (N >= 640) {
MAYBE_PREFETCH(IN + 256);
MAYBE_PREFETCH(IN + 320);
MAYBE_PREFETCH(IN + 384);
MAYBE_PREFETCH(IN + 448);
MAYBE_PREFETCH(IN + 512);
MAYBE_PREFETCH(IN + 576);
MAYBE_PREFETCH(IN + 640);
MAYBE_PREFETCH(IN + 704);
/* We phrase the loop condition in this way so that the
i + WORD_SIZE * 16 value can be reused to increment i. */
while (i + WORD_SIZE * 16 <= N - 640) {
MAYBE_PREFETCH(IN + 768);
MAYBE_PREFETCH(IN + 832);
MAYBE_PREFETCH(IN + 896);
MAYBE_PREFETCH(IN + 960);
WORD_COPY(OUT, IN, i);
WORD_COPY(OUT, IN, i + WORD_SIZE * 1);
WORD_COPY(OUT, IN, i + WORD_SIZE * 2);
WORD_COPY(OUT, IN, i + WORD_SIZE * 3);
WORD_COPY(OUT, IN, i + WORD_SIZE * 4);
WORD_COPY(OUT, IN, i + WORD_SIZE * 5);
WORD_COPY(OUT, IN, i + WORD_SIZE * 6);
WORD_COPY(OUT, IN, i + WORD_SIZE * 7);
WORD_COPY(OUT, IN, i + WORD_SIZE * 8);
WORD_COPY(OUT, IN, i + WORD_SIZE * 9);
WORD_COPY(OUT, IN, i + WORD_SIZE * 10);
WORD_COPY(OUT, IN, i + WORD_SIZE * 11);
WORD_COPY(OUT, IN, i + WORD_SIZE * 12);
WORD_COPY(OUT, IN, i + WORD_SIZE * 13);
WORD_COPY(OUT, IN, i + WORD_SIZE * 14);
WORD_COPY(OUT, IN, i + WORD_SIZE * 15);
i += WORD_SIZE * 16;
}
}
while (i + WORD_SIZE * 16 <= N) {
WORD_COPY(OUT, IN, i);
WORD_COPY(OUT, IN, i + WORD_SIZE * 1);
WORD_COPY(OUT, IN, i + WORD_SIZE * 2);
WORD_COPY(OUT, IN, i + WORD_SIZE * 3);
WORD_COPY(OUT, IN, i + WORD_SIZE * 4);
WORD_COPY(OUT, IN, i + WORD_SIZE * 5);
WORD_COPY(OUT, IN, i + WORD_SIZE * 6);
WORD_COPY(OUT, IN, i + WORD_SIZE * 7);
WORD_COPY(OUT, IN, i + WORD_SIZE * 8);
WORD_COPY(OUT, IN, i + WORD_SIZE * 9);
WORD_COPY(OUT, IN, i + WORD_SIZE * 10);
WORD_COPY(OUT, IN, i + WORD_SIZE * 11);
WORD_COPY(OUT, IN, i + WORD_SIZE * 12);
WORD_COPY(OUT, IN, i + WORD_SIZE * 13);
WORD_COPY(OUT, IN, i + WORD_SIZE * 14);
WORD_COPY(OUT, IN, i + WORD_SIZE * 15);
i += WORD_SIZE * 16;
}
while (i + WORD_SIZE * 4 <= N) {
WORD_COPY(OUT, IN, i);
WORD_COPY(OUT, IN, i + WORD_SIZE * 1);
WORD_COPY(OUT, IN, i + WORD_SIZE * 2);
WORD_COPY(OUT, IN, i + WORD_SIZE * 3);
i += WORD_SIZE * 4;
}
while (i + WORD_SIZE <= N) {
WORD_COPY(OUT, IN, i);
i += WORD_SIZE;
}
OUT += i;
IN += i;
#else /* not defined(__ARM_NEON__) */
/* Note: 16-times unrolling is about 20% faster than 4-times
unrolling on both ARM Cortex-A8 and Cortex-M3. */
MAYBE_PREFETCH(IN + 64);
MAYBE_PREFETCH(IN + 128);
MAYBE_PREFETCH(IN + 192);
while (OUT_end - (char*)OUT >= WORD_SIZE * 16) {
MAYBE_PREFETCH(IN + 256);
MAYBE_PREFETCH(IN + 320);
WORD_COPY(OUT, IN, 0);
WORD_COPY(OUT, IN, WORD_SIZE * 1);
WORD_COPY(OUT, IN, WORD_SIZE * 2);
WORD_COPY(OUT, IN, WORD_SIZE * 3);
WORD_COPY(OUT, IN, WORD_SIZE * 4);
WORD_COPY(OUT, IN, WORD_SIZE * 5);
WORD_COPY(OUT, IN, WORD_SIZE * 6);
WORD_COPY(OUT, IN, WORD_SIZE * 7);
WORD_COPY(OUT, IN, WORD_SIZE * 8);
WORD_COPY(OUT, IN, WORD_SIZE * 9);
WORD_COPY(OUT, IN, WORD_SIZE * 10);
WORD_COPY(OUT, IN, WORD_SIZE * 11);
WORD_COPY(OUT, IN, WORD_SIZE * 12);
WORD_COPY(OUT, IN, WORD_SIZE * 13);
WORD_COPY(OUT, IN, WORD_SIZE * 14);
WORD_COPY(OUT, IN, WORD_SIZE * 15);
OUT += WORD_SIZE * 16;
IN += WORD_SIZE * 16;
}
while (WORD_SIZE * 4 <= OUT_end - (char*)OUT) {
WORD_COPY(OUT, IN, 0);
WORD_COPY(OUT, IN, WORD_SIZE * 1);
WORD_COPY(OUT, IN, WORD_SIZE * 2);
WORD_COPY(OUT, IN, WORD_SIZE * 3);
OUT += WORD_SIZE * 4;
IN += WORD_SIZE * 4;
}
while (WORD_SIZE <= OUT_end - (char*)OUT) {
WORD_COPY(OUT, IN, 0);
OUT += WORD_SIZE;
IN += WORD_SIZE;
}
#endif /* not defined(__ARM_NEON__) */
#if WORD_SIZE > SHORTWORD_SIZE
} else { /* if IN is not WORD_SIZE aligned */
while (SHORTWORD_SIZE * 4 <= OUT_end - (char*)OUT) {
SHORTWORD_COPY(OUT, IN, 0);
SHORTWORD_COPY(OUT, IN, SHORTWORD_SIZE * 1);
SHORTWORD_COPY(OUT, IN, SHORTWORD_SIZE * 2);
SHORTWORD_COPY(OUT, IN, SHORTWORD_SIZE * 3);
OUT += SHORTWORD_SIZE * 4;
IN += SHORTWORD_SIZE * 4;
}
} /* end if IN is not WORD_SIZE aligned */
} /* end if N >= WORD_SIZE */
while (SHORTWORD_SIZE <= OUT_end - (char*)OUT) {
SHORTWORD_COPY(OUT, IN, 0);
OUT += SHORTWORD_SIZE;
IN += SHORTWORD_SIZE;
}
#endif /* WORD_SIZE > SHORTWORD_SIZE */
} else { /* if IN is not SHORTWORD_SIZE aligned */
ptrdiff_t misalign = (uintptr_t)IN % SHORTWORD_SIZE;
SHORTWORD_TYPE temp1, temp2;
temp1 = SHORTWORD_REF(IN, -misalign);
/* Benchmarking indicates that unrolling this loop doesn't
produce a measurable performance improvement on ARM. */
while (SHORTWORD_SIZE <= OUT_end - (char*)OUT) {
IN += SHORTWORD_SIZE;
temp2 = SHORTWORD_REF(IN, -misalign);
SHORTWORD_REF(OUT, 0) = SHORTWORD_SHIFT(temp1, temp2, misalign);
temp1 = temp2;
OUT += SHORTWORD_SIZE;
}
} /* end if IN is not SHORTWORD_SIZE aligned */
while ((char*)OUT < OUT_end) {
*((char*)OUT) = *((char*)IN);
OUT++;
IN++;
}
return OUT0;
#endif
}

214
reference/csl/memset.c Normal file
View file

@ -0,0 +1,214 @@
/* Copyright (c) 2009 CodeSourcery, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of CodeSourcery nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY CODESOURCERY, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CODESOURCERY BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "arm_asm.h"
#include <string.h>
#include <stdint.h>
/* Standard operations for word-sized values. */
#define WORD_REF(ADDRESS, OFFSET) \
*((WORD_TYPE*)((char*)(ADDRESS) + (OFFSET)))
/* On processors with NEON, we use 128-bit vectors. Also,
we need to include arm_neon.h to use these. */
#if defined(__ARM_NEON__)
#include <arm_neon.h>
#define WORD_TYPE uint8x16_t
#define WORD_SIZE 16
#define WORD_DUPLICATE(VALUE) \
vdupq_n_u8(VALUE)
/* On ARM processors with 64-bit ldrd instructions, we use those,
except on Cortex-M* where benchmarking has shown them to
be slower. */
#elif defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
|| defined(__ARM_ARCH_5TEJ__) || defined(_ISA_ARM_6)
#define WORD_TYPE uint64_t
#define WORD_SIZE 8
/* ARM stores 64-bit values in two 32-bit registers and does not
have 64-bit multiply or bitwise-or instructions, so this union
operation results in optimal code. */
static inline uint64_t splat8(value) {
union { uint32_t ints[2]; uint64_t result; } quad;
quad.ints[0] = (unsigned char)(value) * 0x01010101;
quad.ints[1] = quad.ints[0];
return quad.result;
}
#define WORD_DUPLICATE(VALUE) \
splat8(VALUE)
/* On everything else, we use 32-bit loads and stores. */
#else
#define WORD_TYPE uint32_t
#define WORD_SIZE 4
#define WORD_DUPLICATE(VALUE) \
(unsigned char)(VALUE) * 0x01010101
#endif
/* On all ARM platforms, 'SHORTWORD' is a 32-bit value. */
#define SHORTWORD_TYPE uint32_t
#define SHORTWORD_SIZE 4
#define SHORTWORD_REF(ADDRESS, OFFSET) \
*((SHORTWORD_TYPE*)((char*)(ADDRESS) + (OFFSET)))
#define SHORTWORD_DUPLICATE(VALUE) \
(uint32_t)(unsigned char)(VALUE) * 0x01010101
void *memset(void *DST, int C, size_t LENGTH)
{
void* DST0 = DST;
unsigned char C_BYTE = C;
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
const char* DST_end = (char*)DST + LENGTH;
while ((char*)DST < DST_end) {
*((char*)DST) = C_BYTE;
DST++;
}
return DST0;
#else /* not PREFER_SIZE_OVER_SPEED */
/* Handle short strings and immediately return. */
if (__builtin_expect(LENGTH < SHORTWORD_SIZE, 1)) {
size_t i = 0;
while (i < LENGTH) {
((char*)DST)[i] = C_BYTE;
i++;
}
return DST;
}
const char* DST_end = (char*)DST + LENGTH;
/* Align DST to SHORTWORD_SIZE. */
while ((uintptr_t)DST % SHORTWORD_SIZE != 0) {
*(char*) (DST++) = C_BYTE;
}
#if WORD_SIZE > SHORTWORD_SIZE
SHORTWORD_TYPE C_SHORTWORD = SHORTWORD_DUPLICATE(C_BYTE);
/* Align DST to WORD_SIZE in steps of SHORTWORD_SIZE. */
if (__builtin_expect(DST_end - (char*)DST >= WORD_SIZE, 0)) {
while ((uintptr_t)DST % WORD_SIZE != 0) {
SHORTWORD_REF(DST, 0) = C_SHORTWORD;
DST += SHORTWORD_SIZE;
}
#endif /* WORD_SIZE > SHORTWORD_SIZE */
WORD_TYPE C_WORD = WORD_DUPLICATE(C_BYTE);
#if defined(__ARM_NEON__)
/* Testing on Cortex-A8 indicates that the following idiom
produces faster assembly code when doing vector copies,
but not when doing regular copies. */
size_t i = 0;
LENGTH = DST_end - (char*)DST;
while (i + WORD_SIZE * 16 <= LENGTH) {
WORD_REF(DST, i) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 1) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 2) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 3) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 4) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 5) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 6) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 7) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 8) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 9) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 10) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 11) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 12) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 13) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 14) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 15) = C_WORD;
i += WORD_SIZE * 16;
}
while (i + WORD_SIZE * 4 <= LENGTH) {
WORD_REF(DST, i) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 1) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 2) = C_WORD;
WORD_REF(DST, i + WORD_SIZE * 3) = C_WORD;
i += WORD_SIZE * 4;
}
while (i + WORD_SIZE <= LENGTH) {
WORD_REF(DST, i) = C_WORD;
i += WORD_SIZE;
}
DST += i;
#else /* not defined(__ARM_NEON__) */
/* Note: 16-times unrolling is about 50% faster than 4-times
unrolling on both ARM Cortex-A8 and Cortex-M3. */
while (DST_end - (char*) DST >= WORD_SIZE * 16) {
WORD_REF(DST, 0) = C_WORD;
WORD_REF(DST, WORD_SIZE * 1) = C_WORD;
WORD_REF(DST, WORD_SIZE * 2) = C_WORD;
WORD_REF(DST, WORD_SIZE * 3) = C_WORD;
WORD_REF(DST, WORD_SIZE * 4) = C_WORD;
WORD_REF(DST, WORD_SIZE * 5) = C_WORD;
WORD_REF(DST, WORD_SIZE * 6) = C_WORD;
WORD_REF(DST, WORD_SIZE * 7) = C_WORD;
WORD_REF(DST, WORD_SIZE * 8) = C_WORD;
WORD_REF(DST, WORD_SIZE * 9) = C_WORD;
WORD_REF(DST, WORD_SIZE * 10) = C_WORD;
WORD_REF(DST, WORD_SIZE * 11) = C_WORD;
WORD_REF(DST, WORD_SIZE * 12) = C_WORD;
WORD_REF(DST, WORD_SIZE * 13) = C_WORD;
WORD_REF(DST, WORD_SIZE * 14) = C_WORD;
WORD_REF(DST, WORD_SIZE * 15) = C_WORD;
DST += WORD_SIZE * 16;
}
while (WORD_SIZE * 4 <= DST_end - (char*) DST) {
WORD_REF(DST, 0) = C_WORD;
WORD_REF(DST, WORD_SIZE * 1) = C_WORD;
WORD_REF(DST, WORD_SIZE * 2) = C_WORD;
WORD_REF(DST, WORD_SIZE * 3) = C_WORD;
DST += WORD_SIZE * 4;
}
while (WORD_SIZE <= DST_end - (char*) DST) {
WORD_REF(DST, 0) = C_WORD;
DST += WORD_SIZE;
}
#endif /* not defined(__ARM_NEON__) */
#if WORD_SIZE > SHORTWORD_SIZE
} /* end if N >= WORD_SIZE */
while (SHORTWORD_SIZE <= DST_end - (char*)DST) {
SHORTWORD_REF(DST, 0) = C_SHORTWORD;
DST += SHORTWORD_SIZE;
}
#endif /* WORD_SIZE > SHORTWORD_SIZE */
while ((char*)DST < DST_end) {
*((char*)DST) = C_BYTE;
DST++;
}
return DST0;
#endif /* not PREFER_SIZE_OVER_SPEED */
}

View file

View file

@ -0,0 +1,45 @@
reference/glibc-c/memchr.o: reference/glibc-c/memchr.c config.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h \
/usr/include/sys/_null.h /usr/include/sys/_types.h \
/usr/include/machine/_types.h /usr/include/x86/_types.h \
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h \
/usr/include/machine/endian.h /usr/include/x86/endian.h \
/usr/include/sys/_pthreadtypes.h /usr/include/sys/_stdint.h \
/usr/include/sys/select.h /usr/include/sys/_sigset.h \
/usr/include/sys/_timeval.h /usr/include/sys/timespec.h \
/usr/include/sys/_timespec.h
config.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/stdlib.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/cdefs.h:
/usr/include/sys/_null.h:
/usr/include/sys/_types.h:
/usr/include/machine/_types.h:
/usr/include/x86/_types.h:
/usr/local/lib/gcc48/gcc/x86_64-portbld-freebsd11.0/4.8.5/include-fixed/sys/types.h:
/usr/include/machine/endian.h:
/usr/include/x86/endian.h:
/usr/include/sys/_pthreadtypes.h:
/usr/include/sys/_stdint.h:
/usr/include/sys/select.h:
/usr/include/sys/_sigset.h:
/usr/include/sys/_timeval.h:
/usr/include/sys/timespec.h:
/usr/include/sys/_timespec.h:

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

@ -0,0 +1 @@
# dummy

View file

204
reference/glibc-c/memchr.c Normal file
View file

@ -0,0 +1,204 @@
/* Copyright (C) 1991,93,96,97,99,2000,2003,2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
commentary by Jim Blandy (jimb@ai.mit.edu);
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
and implemented by Roland McGrath (roland@ai.mit.edu).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#undef __ptr_t
#define __ptr_t void *
#if defined _LIBC
# include <string.h>
# include <memcopy.h>
#endif
#if HAVE_STDLIB_H || defined _LIBC
# include <stdlib.h>
#endif
#if HAVE_LIMITS_H || defined _LIBC
# include <limits.h>
#endif
#define LONG_MAX_32_BITS 2147483647
#ifndef LONG_MAX
#define LONG_MAX LONG_MAX_32_BITS
#endif
#include <sys/types.h>
#if HAVE_BP_SYM_H || defined _LIBC
#include <bp-sym.h>
#else
# define BP_SYM(sym) sym
#endif
#undef memchr
#undef __memchr
/* Search no more than N bytes of S for C. */
__ptr_t
memchr (s, c_in, n)
const __ptr_t s;
int c_in;
size_t n;
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, magic_bits, charmask;
unsigned char c;
c = (unsigned char) c_in;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
for (char_ptr = (const unsigned char *) s;
n > 0 && ((unsigned long int) char_ptr
& (sizeof (longword) - 1)) != 0;
--n, ++char_ptr)
if (*char_ptr == c)
return (__ptr_t) char_ptr;
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
longword_ptr = (unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
each byte, with an extra at the end:
bits: 01111110 11111110 11111110 11111111
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
if (sizeof (longword) != 4 && sizeof (longword) != 8)
abort ();
#if LONG_MAX <= LONG_MAX_32_BITS
magic_bits = 0x7efefeff;
#else
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
#endif
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
#if LONG_MAX > LONG_MAX_32_BITS
charmask |= charmask << 32;
#endif
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
if *any of the four* bytes in the longword in question are zero. */
while (n >= sizeof (longword))
{
/* We tentatively exit the loop if adding MAGIC_BITS to
LONGWORD fails to change any of the hole bits of LONGWORD.
1) Is this safe? Will it catch all the zero bytes?
Suppose there is a byte with all zeros. Any carry bits
propagating from its left will fall into the hole at its
least significant bit and stop. Since there will be no
carry from its most significant bit, the LSB of the
byte to the left will be unchanged, and the zero will be
detected.
2) Is this worthwhile? Will it ignore everything except
zero bytes? Suppose every byte of LONGWORD has a bit set
somewhere. There will be a carry into bit 8. If bit 8
is set, this will carry into bit 16. If bit 8 is clear,
one of bits 9-15 must be set, so there will be a carry
into bit 16. Similarly, there will be a carry into bit
24. If one of bits 24-30 is set, there will be a carry
into bit 31, so all of the hole bits will be changed.
The one misfire occurs when bits 24-30 are clear and bit
31 is set; in this case, the hole at bit 31 is not
changed. If we had access to the processor carry flag,
we could close this loophole by putting the fourth hole
at bit 32!
So it ignores everything except 128's, when they're aligned
properly.
3) But wait! Aren't we looking for C, not zero?
Good point. So what we do is XOR LONGWORD with a longword,
each of whose bytes is C. This turns each byte that is C
into a zero. */
longword = *longword_ptr++ ^ charmask;
/* Add MAGIC_BITS to LONGWORD. */
if ((((longword + magic_bits)
/* Set those bits that were unchanged by the addition. */
^ ~longword)
/* Look at only the hole bits. If any of the hole bits
are unchanged, most likely one of the bytes was a
zero. */
& ~magic_bits) != 0)
{
/* Which of the bytes was C? If none of them were, it was
a misfire; continue the search. */
const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
if (cp[0] == c)
return (__ptr_t) cp;
if (cp[1] == c)
return (__ptr_t) &cp[1];
if (cp[2] == c)
return (__ptr_t) &cp[2];
if (cp[3] == c)
return (__ptr_t) &cp[3];
#if LONG_MAX > 2147483647
if (cp[4] == c)
return (__ptr_t) &cp[4];
if (cp[5] == c)
return (__ptr_t) &cp[5];
if (cp[6] == c)
return (__ptr_t) &cp[6];
if (cp[7] == c)
return (__ptr_t) &cp[7];
#endif
}
n -= sizeof (longword);
}
char_ptr = (const unsigned char *) longword_ptr;
while (n-- > 0)
{
if (*char_ptr == c)
return (__ptr_t) char_ptr;
else
++char_ptr;
}
return 0;
}

369
reference/glibc-c/memcmp.c Normal file
View file

@ -0,0 +1,369 @@
/* Copyright (C) 1991,1993,1995,1997,1998,2003,2004,2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#undef __ptr_t
#define __ptr_t void *
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#endif
#undef memcmp
#ifdef _LIBC
# include <memcopy.h>
# include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN
# define WORDS_BIGENDIAN
# endif
#else /* Not in the GNU C library. */
# include <sys/types.h>
/* Type to use for aligned memory operations.
This should normally be the biggest type supported by a single load
and store. Must be an unsigned type. */
# define op_t unsigned long int
# define OPSIZ (sizeof(op_t))
/* Threshold value for when to enter the unrolled loops. */
# define OP_T_THRES 16
/* Type to use for unaligned operations. */
typedef unsigned char byte;
# ifndef WORDS_BIGENDIAN
# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
# else
# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
# endif
#endif /* In the GNU C library. */
#ifdef WORDS_BIGENDIAN
# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
#else
# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
#endif
/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
/* The strategy of this memcmp is:
1. Compare bytes until one of the block pointers is aligned.
2. Compare using memcmp_common_alignment or
memcmp_not_common_alignment, regarding the alignment of the other
block after the initial byte operations. The maximum number of
full words (of type op_t) are compared in this way.
3. Compare the few remaining bytes. */
#ifndef WORDS_BIGENDIAN
/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
A and B are known to be different.
This is needed only on little-endian machines. */
static int memcmp_bytes (op_t, op_t) __THROW;
# ifdef __GNUC__
__inline
# endif
static int
memcmp_bytes (a, b)
op_t a, b;
{
long int srcp1 = (long int) &a;
long int srcp2 = (long int) &b;
op_t a0, b0;
do
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
}
while (a0 == b0);
return a0 - b0;
}
#endif
static int memcmp_common_alignment (long, long, size_t) __THROW;
/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
memory operations on `op_t's. */
static int
memcmp_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
{
op_t a0, a1;
op_t b0, b1;
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
srcp1 -= 2 * OPSIZ;
srcp2 -= 2 * OPSIZ;
len += 2;
goto do1;
case 3:
a1 = ((op_t *) srcp1)[0];
b1 = ((op_t *) srcp2)[0];
srcp1 -= OPSIZ;
srcp2 -= OPSIZ;
len += 1;
goto do2;
case 0:
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
return 0;
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
goto do3;
case 1:
a1 = ((op_t *) srcp1)[0];
b1 = ((op_t *) srcp2)[0];
srcp1 += OPSIZ;
srcp2 += OPSIZ;
len -= 1;
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
goto do0;
/* Fall through. */
}
do
{
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
do3:
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[1];
if (a0 != b0)
return CMP_LT_OR_GT (a0, b0);
do2:
a0 = ((op_t *) srcp1)[2];
b0 = ((op_t *) srcp2)[2];
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
do1:
a1 = ((op_t *) srcp1)[3];
b1 = ((op_t *) srcp2)[3];
if (a0 != b0)
return CMP_LT_OR_GT (a0, b0);
srcp1 += 4 * OPSIZ;
srcp2 += 4 * OPSIZ;
len -= 4;
}
while (len != 0);
/* This is the right position for do0. Please don't move
it into the loop. */
do0:
if (a1 != b1)
return CMP_LT_OR_GT (a1, b1);
return 0;
}
static int memcmp_not_common_alignment (long, long, size_t) __THROW;
/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
`op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
operations on `op_t', but SRCP1 *should be unaligned*. */
static int
memcmp_not_common_alignment (srcp1, srcp2, len)
long int srcp1;
long int srcp2;
size_t len;
{
op_t a0, a1, a2, a3;
op_t b0, b1, b2, b3;
op_t x;
int shl, shr;
/* Calculate how to shift a word read at the memory operation
aligned srcp1 to make it aligned for comparison. */
shl = 8 * (srcp1 % OPSIZ);
shr = 8 * OPSIZ - shl;
/* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
it points in the middle of. */
srcp1 &= -OPSIZ;
switch (len % 4)
{
default: /* Avoid warning about uninitialized local variables. */
case 2:
a1 = ((op_t *) srcp1)[0];
a2 = ((op_t *) srcp1)[1];
b2 = ((op_t *) srcp2)[0];
srcp1 -= 1 * OPSIZ;
srcp2 -= 2 * OPSIZ;
len += 2;
goto do1;
case 3:
a0 = ((op_t *) srcp1)[0];
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[0];
srcp2 -= 1 * OPSIZ;
len += 1;
goto do2;
case 0:
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
return 0;
a3 = ((op_t *) srcp1)[0];
a0 = ((op_t *) srcp1)[1];
b0 = ((op_t *) srcp2)[0];
srcp1 += 1 * OPSIZ;
goto do3;
case 1:
a2 = ((op_t *) srcp1)[0];
a3 = ((op_t *) srcp1)[1];
b3 = ((op_t *) srcp2)[0];
srcp1 += 2 * OPSIZ;
srcp2 += 1 * OPSIZ;
len -= 1;
if (OP_T_THRES <= 3 * OPSIZ && len == 0)
goto do0;
/* Fall through. */
}
do
{
a0 = ((op_t *) srcp1)[0];
b0 = ((op_t *) srcp2)[0];
x = MERGE(a2, shl, a3, shr);
if (x != b3)
return CMP_LT_OR_GT (x, b3);
do3:
a1 = ((op_t *) srcp1)[1];
b1 = ((op_t *) srcp2)[1];
x = MERGE(a3, shl, a0, shr);
if (x != b0)
return CMP_LT_OR_GT (x, b0);
do2:
a2 = ((op_t *) srcp1)[2];
b2 = ((op_t *) srcp2)[2];
x = MERGE(a0, shl, a1, shr);
if (x != b1)
return CMP_LT_OR_GT (x, b1);
do1:
a3 = ((op_t *) srcp1)[3];
b3 = ((op_t *) srcp2)[3];
x = MERGE(a1, shl, a2, shr);
if (x != b2)
return CMP_LT_OR_GT (x, b2);
srcp1 += 4 * OPSIZ;
srcp2 += 4 * OPSIZ;
len -= 4;
}
while (len != 0);
/* This is the right position for do0. Please don't move
it into the loop. */
do0:
x = MERGE(a2, shl, a3, shr);
if (x != b3)
return CMP_LT_OR_GT (x, b3);
return 0;
}
int
memcmp (s1, s2, len)
const __ptr_t s1;
const __ptr_t s2;
size_t len;
{
op_t a0;
op_t b0;
long int srcp1 = (long int) s1;
long int srcp2 = (long int) s2;
op_t res;
if (len >= OP_T_THRES)
{
/* There are at least some bytes to compare. No need to test
for LEN == 0 in this alignment loop. */
while (srcp2 % OPSIZ != 0)
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
res = a0 - b0;
if (res != 0)
return res;
len -= 1;
}
/* SRCP2 is now aligned for memory operations on `op_t'.
SRCP1 alignment determines if we can do a simple,
aligned compare or need to shuffle bits. */
if (srcp1 % OPSIZ == 0)
res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
else
res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
if (res != 0)
return res;
/* Number of bytes remaining in the interval [0..OPSIZ-1]. */
srcp1 += len & -OPSIZ;
srcp2 += len & -OPSIZ;
len %= OPSIZ;
}
/* There are just a few bytes to compare. Use byte memory operations. */
while (len != 0)
{
a0 = ((byte *) srcp1)[0];
b0 = ((byte *) srcp2)[0];
srcp1 += 1;
srcp2 += 1;
res = a0 - b0;
if (res != 0)
return res;
len -= 1;
}
return 0;
}

146
reference/glibc-c/memcopy.h Normal file
View file

@ -0,0 +1,146 @@
/* memcopy.h -- definitions for memory copy functions. Generic C version.
Copyright (C) 1991, 1992, 1993, 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
/* The strategy of the memory functions is:
1. Copy bytes until the destination pointer is aligned.
2. Copy words in unrolled loops. If the source and destination
are not aligned in the same way, use word memory operations,
but shift and merge two read words before writing.
3. Copy the few remaining bytes.
This is fast on processors that have at least 10 registers for
allocation by GCC, and that can access memory at reg+const in one
instruction.
I made an "exhaustive" test of this memmove when I wrote it,
exhaustive in the sense that I tried all alignment and length
combinations, with and without overlap. */
#include <sys/cdefs.h>
#include <endian.h>
/* The macros defined in this file are:
BYTE_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_to_copy)
BYTE_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_to_copy)
WORD_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_remaining, nbytes_to_copy)
WORD_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_remaining, nbytes_to_copy)
MERGE(old_word, sh_1, new_word, sh_2)
[I fail to understand. I feel stupid. --roland]
*/
/* Type to use for aligned memory operations.
This should normally be the biggest type supported by a single load
and store. */
#define op_t unsigned long int
#define OPSIZ (sizeof(op_t))
/* Type to use for unaligned operations. */
typedef unsigned char byte;
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
#define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
#endif
/* Copy exactly NBYTES bytes from SRC_BP to DST_BP,
without any assumptions about alignment of the pointers. */
#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
do \
{ \
size_t __nbytes = (nbytes); \
while (__nbytes > 0) \
{ \
byte __x = ((byte *) src_bp)[0]; \
src_bp += 1; \
__nbytes -= 1; \
((byte *) dst_bp)[0] = __x; \
dst_bp += 1; \
} \
} while (0)
/* Copy exactly NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
beginning at the bytes right before the pointers and continuing towards
smaller addresses. Don't assume anything about alignment of the
pointers. */
#define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
do \
{ \
size_t __nbytes = (nbytes); \
while (__nbytes > 0) \
{ \
byte __x; \
src_ep -= 1; \
__x = ((byte *) src_ep)[0]; \
dst_ep -= 1; \
__nbytes -= 1; \
((byte *) dst_ep)[0] = __x; \
} \
} while (0)
/* Copy *up to* NBYTES bytes from SRC_BP to DST_BP, with
the assumption that DST_BP is aligned on an OPSIZ multiple. If
not all bytes could be easily copied, store remaining number of bytes
in NBYTES_LEFT, otherwise store 0. */
extern void _wordcopy_fwd_aligned (long int, long int, size_t) __THROW;
extern void _wordcopy_fwd_dest_aligned (long int, long int, size_t) __THROW;
#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
do \
{ \
if (src_bp % OPSIZ == 0) \
_wordcopy_fwd_aligned (dst_bp, src_bp, (nbytes) / OPSIZ); \
else \
_wordcopy_fwd_dest_aligned (dst_bp, src_bp, (nbytes) / OPSIZ); \
src_bp += (nbytes) & -OPSIZ; \
dst_bp += (nbytes) & -OPSIZ; \
(nbytes_left) = (nbytes) % OPSIZ; \
} while (0)
/* Copy *up to* NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
beginning at the words (of type op_t) right before the pointers and
continuing towards smaller addresses. May take advantage of that
DST_END_PTR is aligned on an OPSIZ multiple. If not all bytes could be
easily copied, store remaining number of bytes in NBYTES_REMAINING,
otherwise store 0. */
extern void _wordcopy_bwd_aligned (long int, long int, size_t) __THROW;
extern void _wordcopy_bwd_dest_aligned (long int, long int, size_t) __THROW;
#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
do \
{ \
if (src_ep % OPSIZ == 0) \
_wordcopy_bwd_aligned (dst_ep, src_ep, (nbytes) / OPSIZ); \
else \
_wordcopy_bwd_dest_aligned (dst_ep, src_ep, (nbytes) / OPSIZ); \
src_ep -= (nbytes) & -OPSIZ; \
dst_ep -= (nbytes) & -OPSIZ; \
(nbytes_left) = (nbytes) % OPSIZ; \
} while (0)
/* Threshold value for when to enter the unrolled loops. */
#define OP_T_THRES 16

Some files were not shown because too many files have changed in this diff Show more