Skip to content

Instantly share code, notes, and snippets.

@jbush001
Last active May 28, 2017
Embed
What would you like to do?
Generating floating point test cases with Berkeley testfloat
git clone https://github.com/ucb-bar/berkeley-testfloat-3.git
git clone https://github.com/ucb-bar/berkeley-softfloat-3.git
cd berkeley-softfloat-3/build/Linux-386-GCC/
make
cd ../../../berkeley-testfloat-3/build/Linux-386-GCC/
make
./testfloat_gen -precision32 f32 2 f32_add | awk '{ print "{ FADD, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' > test_cases.inc
./testfloat_gen -precision32 f32 2 f32_sub | awk '{ print "{ FSUB, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' >> test_cases.inc
./testfloat_gen -precision32 f32 2 f32_mul | awk '{ print "{ FMUL, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' >> test_cases.inc
./testfloat_gen -precision32 f32 f32_to_i32 | awk '{ print "{ ITOF, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' >> test_cases.inc
./testfloat_gen -precision32 i32 i32_to_f32 | awk '{ print "{ FTOI, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' >> test_cases.inc
./testfloat_gen -precision32 f32 f32_le | awk '{ print "{ FCMPLT, 0x" $1 ", 0x" $2 ", 0x" $3 " }," }' >> test_cases.inc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment