[llvm-commits] Bug fix in double-to-int conversions codegen in AVX: please review

Umansky, Victor victor.umansky at intel.com
Wed Jan 25 02:19:33 PST 2012


Hi

The attached patch file includes a fix for the following bug in AVX codegen for double-to-int conversions:
*       "fptosi" and "fptoui" IR instructions are defined with round-to-zero rounding mode.
*       Currently for AVX mode for <4xdouble> and <8xdouble>  the "VCVTPD2DQ.128" and "VCVTPD2DQ.256" instructions are selected (for "fp_to_sint" DAG node operation ) by AVX codegen. However they use round-to-nearest-even rounding mode.
*       Consequently, the conversion produces incorrect numbers.

The fix is to replace selection of VCVTPD2DQ instructions with VCVTTPD2DQ instructions. The latter use truncate (i.e. round-to-zero) rounding mode.
As "fp_to_sint" DAG node operation is used only for lowering of  "fptosi" and "fptoui" IR instructions, the fix in X86InstrSSE.td definition file doesn't have an impact on other LLVM flows.

The patch includes changes in the .td file, LIT test for the changes and a fix in a legacy LIT test (which produced asm code conflicting with LLVN IR spec).

I'd like to commit the fix to the LLVM trunk, and your feedback will be mostly appreciated.


Thanks,
    Victor


---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120125/bb1ca7fc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fp_to_int.patch
Type: application/octet-stream
Size: 1933 bytes
Desc: fp_to_int.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120125/bb1ca7fc/attachment.obj>


More information about the llvm-commits mailing list