diff options
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/sitofp.ll | 21 | 
2 files changed, 24 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 9ca25657270..1e6fb923fea 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -216,6 +216,8 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,      // We have an algorithm for SSE2, and we turn this into a 64-bit      // FILD or VCVTUSI2SS/SD for other targets.      setOperationAction(ISD::UINT_TO_FP     , MVT::i32  , Custom); +  } else { +    setOperationAction(ISD::UINT_TO_FP     , MVT::i32  , Expand);    }    // Promote i1/i8 SINT_TO_FP to larger SINT_TO_FP's, as X86 doesn't have @@ -235,7 +237,7 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,      }    } else {      setOperationAction(ISD::SINT_TO_FP     , MVT::i16  , Promote); -    setOperationAction(ISD::SINT_TO_FP     , MVT::i32  , Promote); +    setOperationAction(ISD::SINT_TO_FP     , MVT::i32  , Expand);    }    // Promote i1/i8 FP_TO_SINT to larger FP_TO_SINTS's, as X86 doesn't have diff --git a/llvm/test/CodeGen/X86/sitofp.ll b/llvm/test/CodeGen/X86/sitofp.ll new file mode 100644 index 00000000000..bad771cb333 --- /dev/null +++ b/llvm/test/CodeGen/X86/sitofp.ll @@ -0,0 +1,21 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s | FileCheck %s + +target triple = "i386-unknown-linux-gnu" + +define double @foo(i16 %a) #0 { +; CHECK-LABEL: foo: +; CHECK:       # %bb.0: +; CHECK-NEXT:    subl $12, %esp +; CHECK-NEXT:    .cfi_def_cfa_offset 16 +; CHECK-NEXT:    movzwl {{[0-9]+}}(%esp), %eax +; CHECK-NEXT:    movl %eax, (%esp) +; CHECK-NEXT:    calll __floatsidf +; CHECK-NEXT:    addl $12, %esp +; CHECK-NEXT:    retl +  %conv = zext i16 %a to i32 +  %conv1 = sitofp i32 %conv to double +  ret double %conv1 +} + +attributes #0 = { "use-soft-float"="true" }  | 

