Peter Collingbourne
2010-Jun-28 21:44 UTC
[LLVMdev] Proposal for adding rounding variant of fpto?i instructions
Hi, I would appreciate comments/feedback on this proposal to extend the fpto?i instructions to support rounding. This is my first proposed significant extension to LLVM so I'd like to know if I'm completely off base here. First of all, I noticed the convert* intrinsics corresponding to the CONVERT_RNDSAT InstructionDAG. I propose not to build my work on top of these as they seem to be temporary. Dan Gohman on IRC let me know these are used by a closed source OpenCL backend, and I imagine that at some stage the OpenCL backend could migrate to the standard conversion instructions. This is what I propose: Add a "round" flag to FPToUIInst and FPToSIInst. The absence of this flag means truncation is needed whereas presence indicates rounding. The SelectionDAG for FP_TO_UINT and FP_TO_SINT are extended to add an immediate that indicates whether rounding is needed. To legalise a rounding FP_TO_UINT or FP_TO_SINT we use the technique described in [1] to convert the operation into an add/bitcast. Please let me know what you think. Thanks, -- Peter [1] http://www.d6.com/users/checker/pdfs/gdmfp.pdf
Maybe Matching Threads
- [LLVMdev] Proposal for adding rounding variant of fpto?i instructions
- [LLVMdev] Proposal for adding rounding variant of fpto?i instructions
- [LLVMdev] getConvertAction/setConvertAction
- [LLVMdev] [PATCH] Add new phase to legalization to handle vector operations
- [LLVMdev] getConvertAction/setConvertAction