[llvm-commits] [llvm] r123135 - /llvm/trunk/lib/Target/README.txt

Chris Lattner clattner at apple.com
Sun Jan 9 16:39:21 PST 2011


On Jan 9, 2011, at 2:36 PM, Chandler Carruth wrote:

> Author: chandlerc
> Date: Sun Jan  9 16:36:18 2011
> New Revision: 123135
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=123135&view=rev
> Log:
> Add a note about the inability to model FP -> int conversions which
> perform rounding other than truncation in the IR. Common C code for this
> turns into really an LLVM intrinsic call that blocks a lot of further
> optimizations.

Chandler, I don't see what the issue is here.  While it "would be nice" to have generic rounding mode support in the IR, there is no problem with having an intrinsic here.  llvm.x86.sse2.cvtsd2si is a readnone function, so it should be optimized just about as well as fptosi.  What specifically are we missing?

If you're concerned about the extraneous mov + xor in:
+        xorps   %xmm1, %xmm1
+        movsd   %xmm0, %xmm1
+        cvtsd2sil       %xmm1, %eax

The the right fix is to teach SimplifyDemandedVectorElts that llvm.x86.sse2.cvtsd2si does not demand a top element.  This will allow the ir to be optimized to remove the insertion of the 0.0.

-Chris 



More information about the llvm-commits mailing list