[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp

Nate Begeman natebegeman at mac.com
Sat Aug 13 21:37:02 PDT 2005



Changes in directory llvm/lib/Target/X86:

X86ISelPattern.cpp updated: 1.166 -> 1.167
---
Log message:

Fix FP_TO_UINT with Scalar SSE2 now that the legalizer can handle it.  We
now generate the relatively good code sequences:
unsigned short foo(float a) { return a; }
_foo:
        movss 4(%esp), %xmm0
        cvttss2si %xmm0, %eax
        movzwl %ax, %eax
        ret

and
unsigned bar(float a) { return a; }
_bar:
        movss .CPI_bar_0, %xmm0
        movss 4(%esp), %xmm1
        movapd %xmm1, %xmm2
        subss %xmm0, %xmm2
        cvttss2si %xmm2, %eax
        xorl $-2147483648, %eax
        cvttss2si %xmm1, %ecx
        ucomiss %xmm0, %xmm1
        cmovb %ecx, %eax
        ret


---
Diffs of the changes:  (+9 -1)

 X86ISelPattern.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.166 llvm/lib/Target/X86/X86ISelPattern.cpp:1.167
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.166	Tue Aug  9 15:21:10 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp	Sat Aug 13 23:36:51 2005
@@ -141,12 +141,20 @@
       setOperationAction(ISD::FP_TO_UINT       , MVT::i1   , Promote);
       setOperationAction(ISD::FP_TO_UINT       , MVT::i8   , Promote);
       setOperationAction(ISD::FP_TO_UINT       , MVT::i16  , Promote);
-      setOperationAction(ISD::FP_TO_UINT       , MVT::i32  , Promote);
+
+      if (!X86ScalarSSE)
+        setOperationAction(ISD::FP_TO_UINT     , MVT::i32  , Promote);
 
       // Promote i1/i8 FP_TO_SINT to larger FP_TO_SINTS's, as X86 doesn't have
       // this operation.
       setOperationAction(ISD::FP_TO_SINT       , MVT::i1   , Promote);
       setOperationAction(ISD::FP_TO_SINT       , MVT::i8   , Promote);
+      setOperationAction(ISD::FP_TO_SINT       , MVT::i16  , Promote);
+
+      // Expand FP_TO_UINT into a select.
+      // FIXME: We would like to use a Custom expander here eventually to do
+      // the optimal thing for SSE vs. the default expansion in the legalizer.
+      setOperationAction(ISD::FP_TO_UINT       , MVT::i32  , Expand);
 
       setOperationAction(ISD::BRCONDTWOWAY     , MVT::Other, Expand);
       setOperationAction(ISD::MEMMOVE          , MVT::Other, Expand);






More information about the llvm-commits mailing list