Skip to content

Instantly share code, notes, and snippets.

@jbush001
Last active May 28, 2017 22:55
Show Gist options
  • Save jbush001/9266b04e40963f5647a7759d4cc4e313 to your computer and use it in GitHub Desktop.
Save jbush001/9266b04e40963f5647a7759d4cc4e313 to your computer and use it in GitHub Desktop.
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