cranelift: Add fadd/fsub/fmul/fdiv to interpreter#4446
Conversation
jameysharp
left a comment
There was a problem hiding this comment.
I'm still learning the details of the WebAssembly spec so I have a couple questions, but overall I think this looks good.
I expected to see fdiv tests for the case of a non-zero value divided by zero, which I assumed would return NaN, but I didn't see such tests in that section. Did I miss something?
In the implementation of the interpreter, would it make sense to have all integer values be represented using std::num::Wrapping? Then I think all the uses of binary_match! that you updated here could just use e.g. +(self, other) for both integer and floating point types, and you wouldn't need an is_float function.
You're absolutely right, we are missing those cases. Ill add them. However those cases return +/-Inf and not NaN. Looking at the WASM spec for fdiv I think there might be some other corner cases that I also missed in these tests.
That sounds like a good idea for the interpreter. However I'm willing to try and make that change if you think its worth it. |
|
I'm interested in finding out if using Let me know when you're done with the fdiv tests and I'm happy to merge this! |
e3921de to
ca9a7b1
Compare
|
I think we have them all now. Thanks for reviewing this! |
|
You're welcome! Code review is good for me, I learn things. 😆 Did you mean to comment out |
Fuzzgen found these as soon as I added float support
ca9a7b1 to
b21038a
Compare
|
Oops, should be fixed now. |
👋 Hey,
Fuzzgen found that we were missing these as soon as I added float support