Cranelift: apply NaN canonicalization to libcalls#12963
Cranelift: apply NaN canonicalization to libcalls#12963tschneidereit wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
This probably doesn't matter much in the real world, since the libcalls are only emitted on pre-SSE4.1 x64, and hence on CPUs released before 2007 (Intel) and 2011 (AMD). It does trip up the fuzzer though, since the libcalls are interpreted differently between Pulley and Cranelift. Alternatively, we could make SSE4.1 a requirement and remove the libcalls entirely: they're unused on all other platforms.
dd20eaf to
c8f15a7
Compare
alexcrichton
left a comment
There was a problem hiding this comment.
Thanks! Would it be possible to add some tests for this as well?
Additionally, I think it's ok to exempt CallIndirect and instead match on the call target of Call to ensure that this is only applied to libcalls as opposed to all functions in general.
This has definitely crossed my mind at several points in the past too (it's very annoying to have to polyfill things) but FWIW, we made a somewhat explicit decision a few years ago to try to support everything on x86-64 all the way back to the first x86-64 (so, just SSE2) -- and actually Alex did most of the SIMD work for that -- so we would have the strongest possible "we support x86" story :-) At some point it may become so unimportant that we can drop it but for now at least it feels nice to keep if we can (so, thanks for the work to include libcalls here!). |
This probably doesn't matter much in the real world, since the libcalls are only emitted on pre-SSE4.1 x64, and hence on CPUs released before 2007 (Intel) and 2011 (AMD). It does trip up the
cranelift-fuzzgenfuzzer though, since the libcalls are interpreted differently between Pulley and Cranelift. In a local (Aarch64, which I think matters) run of maybe an hour, I got 30 artifacts based on this, inhibiting other explorations.Alternatively, we could make SSE4.1 a requirement and remove the libcalls entirely: they're unused on all other platforms.