Lowers (s|u)itofp and fpto(s|u)i instructions for vectors. The fp to
int conversions produce poison values if their arguments are out of
the convertible range, so a future CL will have to add an LLVM
intrinsic to make the saturating behavior of this conversion usable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
The actual naming of these instructions is blocked on the bikeshedding discussion at https://github.com/WebAssembly/nontrapping-float-to-int-conversions/issues/4. For the time being, the instructions here have been renamed to avoid colons and slashes have been replaced with question marks to satisfy the lexer (lib/MC/MCParser/AsmLexer.cpp).
- Is it correct to translate those llvm instructions to saturating versions of wasm instructions? For example, for scalars, we had a patch that implemented the saturating behavior. Don't we need a similar thing for vectors too?
- Is this behavior also dependent on [[ https://github.com/llvm-mirror/llvm/blob/59895038204bec7cb4f924acf25b91f3056ea492/lib/Target/WebAssembly/WebAssembly.td#L30-L33 | nontrapping-fptoint ]] feature, as the scalar instructions?
No: the extra lowering code in that patch is needed when using the trapping forms (which is what MVP wasm has). When -mnontrapping-fptoint is specified, the non-trapping forms are used, which don't need extra lowering code. For SIMD the plan is that we'll only have the saturating forms, so it doesn't need the extra lowering code.
- Is this behavior also dependent on [[ https://github.com/llvm-mirror/llvm/blob/59895038204bec7cb4f924acf25b91f3056ea492/lib/Target/WebAssembly/WebAssembly.td#L30-L33 | nontrapping-fptoint ]] feature, as the scalar instructions?
No, I don't think we need to do that. We need a flag for scalar because wasm MVP only has the trapping forms, but for SIMD, the plan is to only have the saturating ones, so I think it's safe to assume that if the subtarget has SIMD, it includes those.