diff --git a/tests/fp/vectors/Makefile b/tests/fp/vectors/Makefile index 6a20ec813..7f464f2e6 100755 --- a/tests/fp/vectors/Makefile +++ b/tests/fp/vectors/Makefile @@ -2,7 +2,7 @@ SHELL := /bin/bash TESTFLOAT_DIR := ${WALLY}/addins/TestFloat-3e/build/Linux-x86_64-GCC -TESTFLOAT_GEN_CMD := ${TESTFLOAT_DIR}/testfloat_gen -tininessafter -level +TESTFLOAT_GEN_CMD := ${TESTFLOAT_DIR}/testfloat_gen -tininessafter # List of testvectors to generate. Each rounding mode will be generated for each test. cvtint := ui32_to_f16 ui32_to_f32 ui32_to_f64 ui32_to_f128 \ @@ -29,9 +29,21 @@ mulAdd := f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd tests := $(cvtfp) $(cvtint) $(add) $(sub) $(mul) $(div) $(sqrt) $(eq) $(le) $(lt) $(mulAdd) +# Set rounding modes and extensions +rne: ROUND_MODE := rnear_even +rne: ROUND_EXT := rne +rz: ROUND_MODE := rminMag +rz: ROUND_EXT := rz +ru: ROUND_MODE := rmax +ru: ROUND_EXT := ru +rd: ROUND_MODE := rmin +rd: ROUND_EXT := rd +rnm: ROUND_MODE := rnear_maxMag +rnm: ROUND_EXT := rnm .PHONY: all rne rz ru rd rnm clean +# Generate all test vectors all: rne rz ru rd rnm # Generate test vectors for each rounding mode @@ -41,40 +53,12 @@ ru: $(addsuffix _ru.tv, $(tests)) rd: $(addsuffix _rd.tv, $(tests)) rnm: $(addsuffix _rnm.tv, $(tests)) -# Rules to generate individual test vectors, broken up by rounding mode -%_rne.tv: ${TESTFLOAT_GEN} - @echo Creating $*_rne.tv vectors +# Rule to generate individual test vectors +%.tv: ${TESTFLOAT_GEN} + @echo Creating $@ vectors @if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \ if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \ - ${TESTFLOAT_GEN_CMD} $$level $$exact -rnear_even $* > $@ - @sed -i 's/ /_/g' $@ - -%_rz.tv: ${TESTFLOAT_GEN} - @echo Creating $*_rz.tv vectors - @if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \ - if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \ - ${TESTFLOAT_GEN_CMD} $$level $$exact -rminMag $* > $@ - @sed -i 's/ /_/g' $@ - -%_ru.tv: ${TESTFLOAT_GEN} - @echo Creating $*_ru.tv vectors - @if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \ - if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \ - ${TESTFLOAT_GEN_CMD} $$level $$exact -rmax $* > $@ - @sed -i 's/ /_/g' $@ - -%_rd.tv: ${TESTFLOAT_GEN} - @echo Creating $*_rd.tv vectors - @if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \ - if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \ - ${TESTFLOAT_GEN_CMD} $$level $$exact -rmin $* > $@ - @sed -i 's/ /_/g' $@ - -%_rnm.tv: ${TESTFLOAT_GEN} - @echo Creating $*_rnm.tv vectors - @if [[ "$*" =~ "to" ]] || [[ "$*" =~ "sqrt" ]] ; then level=2 ; else level=1 ; fi ; \ - if [[ "$*" =~ "to_i" ]] || [[ "$*" =~ "to_u" ]] ; then exact="-exact" ; else exact="" ; fi ; \ - ${TESTFLOAT_GEN_CMD} $$level $$exact -rnear_maxMag $* > $@ + ${TESTFLOAT_GEN_CMD} -level $$level $$exact -$(ROUND_MODE) $(patsubst %_$(ROUND_EXT).tv, %, $@) > $@ @sed -i 's/ /_/g' $@ # Generate TestFloat first if necessary