sunflower-embedded-system-emulator icon indicating copy to clipboard operation
sunflower-embedded-system-emulator copied to clipboard

rv32d_fclass_d and rv32d_fclass_s contain non-portable code and might misbehave in default case of switch(class)

Open phillipstanleymarbell opened this issue 6 years ago • 2 comments

rv32d_fclass_d() and rv32d_fclass_s() contain non-portable code and might misbehave in default case of switch(class). @harrysarson, @rjlv2, or @SamuelmsWong, are you interested in looking at this after #132 has merged?

phillipstanleymarbell avatar Nov 30 '19 23:11 phillipstanleymarbell

Code is: https://github.com/physical-computation/sunflower-simulator/blob/master/sim/op-riscv.c#L2222-L2270 and https://github.com/physical-computation/sunflower-simulator/blob/master/sim/op-riscv.c#L1628-L1677

And the spec says: image

harrysarson avatar Dec 03 '19 09:12 harrysarson

Can we rely on c using IEEE 754? The spec says it does not have to but in practice all architectures do.

If we can rely on an IEEE 754 encoding we can use https://www.doc.ic.ac.uk/~eedwards/compsys/float/nan.html

harrysarson avatar Dec 03 '19 10:12 harrysarson