add COMPILE_LTO to test link time optimization
the library performs best with lto since many small functions can be inlined across objects.
This commit is contained in:
parent
c893d217aa
commit
e8e65119d1
@ -163,6 +163,10 @@ matrix:
|
|||||||
packages:
|
packages:
|
||||||
- clang-4.0
|
- clang-4.0
|
||||||
|
|
||||||
|
# Link time optimization
|
||||||
|
- env: SANITIZER=1 COMPILE_LTO=1 BUILDOPTIONS='--with-cc=gcc-5 --with-m64 --with-travis-valgrind'
|
||||||
|
- env: SANITIZER=1 COMPILE_LTO=1 BUILDOPTIONS='--with-cc=clang-7 --with-m64 --with-travis-valgrind'
|
||||||
|
|
||||||
# GCC for the x86-64 architecture with restricted limb sizes
|
# GCC for the x86-64 architecture with restricted limb sizes
|
||||||
# formerly started with the option "--with-low-mp" to testme.sh
|
# formerly started with the option "--with-low-mp" to testme.sh
|
||||||
# but testing all three in one run took to long and timed out.
|
# but testing all three in one run took to long and timed out.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
void ndraw(const mp_int *a, const char *name)
|
void ndraw(const mp_int *a, const char *name)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t size;
|
size_t size = 0;
|
||||||
mp_err err;
|
mp_err err;
|
||||||
|
|
||||||
if ((err = mp_radix_size(a, 10, &size)) != MP_OKAY) {
|
if ((err = mp_radix_size(a, 10, &size)) != MP_OKAY) {
|
||||||
|
2
makefile
2
makefile
@ -77,7 +77,7 @@ profiled_single: pre_gen
|
|||||||
rm -f *.o timing
|
rm -f *.o timing
|
||||||
$(CC) $(LTM_CFLAGS) -fbranch-probabilities -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o
|
$(CC) $(LTM_CFLAGS) -fbranch-probabilities -c pre_gen/tommath_amalgam.c -o tommath_amalgam.o
|
||||||
$(AR) $(ARFLAGS) $(LIBNAME) tommath_amalgam.o
|
$(AR) $(ARFLAGS) $(LIBNAME) tommath_amalgam.o
|
||||||
ranlib $(LIBNAME)
|
$(RANLIB) $(LIBNAME)
|
||||||
|
|
||||||
install: $(LIBNAME)
|
install: $(LIBNAME)
|
||||||
install -d $(DESTDIR)$(LIBPATH)
|
install -d $(DESTDIR)$(LIBPATH)
|
||||||
|
@ -86,6 +86,12 @@ LTM_CFLAGS += -O3 -funroll-loops
|
|||||||
LTM_CFLAGS += -fomit-frame-pointer
|
LTM_CFLAGS += -fomit-frame-pointer
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef COMPILE_LTO
|
||||||
|
LTM_CFLAGS += -flto
|
||||||
|
AR = $(subst clang,llvm-ar,$(subst gcc,gcc-ar,$(CC)))
|
||||||
|
RANLIB = $(subst clang,llvm-ranlib,$(subst gcc,gcc-ranlib,$(CC)))
|
||||||
|
endif
|
||||||
|
|
||||||
endif # COMPILE_SIZE
|
endif # COMPILE_SIZE
|
||||||
|
|
||||||
ifneq ($(findstring clang,$(CC)),)
|
ifneq ($(findstring clang,$(CC)),)
|
||||||
|
16
testme.sh
16
testme.sh
@ -107,7 +107,7 @@ _make()
|
|||||||
{
|
{
|
||||||
echo -ne " Compile $1 $2"
|
echo -ne " Compile $1 $2"
|
||||||
suffix=$(echo ${1}${2} | tr ' ' '_')
|
suffix=$(echo ${1}${2} | tr ' ' '_')
|
||||||
CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log
|
CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS 2>gcc_errors_${suffix}.log
|
||||||
errcnt=$(wc -l < gcc_errors_${suffix}.log)
|
errcnt=$(wc -l < gcc_errors_${suffix}.log)
|
||||||
if [[ ${errcnt} -gt 1 ]]; then
|
if [[ ${errcnt} -gt 1 ]]; then
|
||||||
echo " failed"
|
echo " failed"
|
||||||
@ -354,7 +354,7 @@ _banner
|
|||||||
if [[ "$TEST_VS_MTEST" != "" ]]
|
if [[ "$TEST_VS_MTEST" != "" ]]
|
||||||
then
|
then
|
||||||
make clean > /dev/null
|
make clean > /dev/null
|
||||||
_make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "mtest_opponent"
|
_make "${compilers[0]}" "${archflags[0]} $CFLAGS" "mtest_opponent"
|
||||||
echo
|
echo
|
||||||
_make "gcc" "$MTEST_RAND" "mtest"
|
_make "gcc" "$MTEST_RAND" "mtest"
|
||||||
echo
|
echo
|
||||||
@ -394,15 +394,15 @@ do
|
|||||||
fi
|
fi
|
||||||
if [[ "$VALGRIND_BIN" != "" ]]
|
if [[ "$VALGRIND_BIN" != "" ]]
|
||||||
then
|
then
|
||||||
_runvalgrind "$i $a" "$CFLAGS"
|
_runvalgrind "$i" "$a $CFLAGS"
|
||||||
[ "$WITH_LOW_MP" != "1" ] && continue
|
[ "$WITH_LOW_MP" != "1" ] && continue
|
||||||
_runvalgrind "$i $a" "-DMP_16BIT $CFLAGS"
|
_runvalgrind "$i" "$a -DMP_16BIT $CFLAGS"
|
||||||
_runvalgrind "$i $a" "-DMP_32BIT $CFLAGS"
|
_runvalgrind "$i" "$a -DMP_32BIT $CFLAGS"
|
||||||
else
|
else
|
||||||
_runtest "$i $a" "$CFLAGS"
|
_runtest "$i" "$a $CFLAGS"
|
||||||
[ "$WITH_LOW_MP" != "1" ] && continue
|
[ "$WITH_LOW_MP" != "1" ] && continue
|
||||||
_runtest "$i $a" "-DMP_16BIT $CFLAGS"
|
_runtest "$i" "$a -DMP_16BIT $CFLAGS"
|
||||||
_runtest "$i $a" "-DMP_32BIT $CFLAGS"
|
_runtest "$i" "$a -DMP_32BIT $CFLAGS"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user