[llvm-branch-commits] [llvm-branch] r104358 - in /llvm/branches/Apple/whitney: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h test/CodeGen/X86/2010-05-16-nosseconversion.ll
Daniel Dunbar
daniel at zuster.org
Fri May 21 12:06:54 PDT 2010
Author: ddunbar
Date: Fri May 21 14:06:54 2010
New Revision: 104358
URL: http://llvm.org/viewvc/llvm-project?rev=104358&view=rev
Log:
Fix i64->f64 conversion, x86-64, -no-sse. A bit tricky since there's a 3rd 64-bit type, MMX vectors. PR 7135.
Added:
llvm/branches/Apple/whitney/test/CodeGen/X86/2010-05-16-nosseconversion.ll
Modified:
llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.cpp
llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.h
Modified: llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.cpp?rev=104358&r1=104357&r2=104358&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.cpp Fri May 21 14:06:54 2010
@@ -217,6 +217,11 @@
if (!X86ScalarSSEf64) {
setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand);
setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand);
+ if (Subtarget->is64Bit() && Subtarget->hasMMX() && !DisableMMX) {
+ // Without SSE, i64->f64 goes through memory; i64->MMX is legal.
+ setOperationAction(ISD::BIT_CONVERT , MVT::i64 , Custom);
+ setOperationAction(ISD::BIT_CONVERT , MVT::f64 , Expand);
+ }
}
// Scalar integer divide and remainder are lowered to use operations that
@@ -678,6 +683,14 @@
setOperationAction(ISD::VSETCC, MVT::v8i8, Custom);
setOperationAction(ISD::VSETCC, MVT::v4i16, Custom);
setOperationAction(ISD::VSETCC, MVT::v2i32, Custom);
+
+ if (!X86ScalarSSEf64 && Subtarget->is64Bit()) {
+ setOperationAction(ISD::BIT_CONVERT, MVT::v8i8, Custom);
+ setOperationAction(ISD::BIT_CONVERT, MVT::v4i16, Custom);
+ setOperationAction(ISD::BIT_CONVERT, MVT::v2i32, Custom);
+ setOperationAction(ISD::BIT_CONVERT, MVT::v2f32, Custom);
+ setOperationAction(ISD::BIT_CONVERT, MVT::v1i64, Custom);
+ }
}
if (!UseSoftFloat && Subtarget->hasSSE1()) {
@@ -7458,6 +7471,24 @@
return DAG.getMergeValues(Ops, 2, dl);
}
+SDValue X86TargetLowering::LowerBIT_CONVERT(SDValue Op,
+ SelectionDAG &DAG) const {
+ EVT SrcVT = Op.getOperand(0).getValueType();
+ EVT DstVT = Op.getValueType();
+ assert((Subtarget->is64Bit() && !Subtarget->hasSSE2() &&
+ Subtarget->hasMMX() && !DisableMMX) &&
+ "Unexpected custom BIT_CONVERT");
+ assert((DstVT == MVT::i64 ||
+ (DstVT.isVector() && DstVT.getSizeInBits()==64)) &&
+ "Unexpected custom BIT_CONVERT");
+ // i64 <=> MMX conversions are Legal.
+ if (SrcVT==MVT::i64 && DstVT.isVector())
+ return Op;
+ if (DstVT==MVT::i64 && SrcVT.isVector())
+ return Op;
+ // All other conversions need to be expanded.
+ return SDValue();
+}
SDValue X86TargetLowering::LowerLOAD_SUB(SDValue Op, SelectionDAG &DAG) const {
SDNode *Node = Op.getNode();
DebugLoc dl = Node->getDebugLoc();
@@ -7527,6 +7558,7 @@
case ISD::SMULO:
case ISD::UMULO: return LowerXALUO(Op, DAG);
case ISD::READCYCLECOUNTER: return LowerREADCYCLECOUNTER(Op, DAG);
+ case ISD::BIT_CONVERT: return LowerBIT_CONVERT(Op, DAG);
}
}
Modified: llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.h?rev=104358&r1=104357&r2=104358&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/branches/Apple/whitney/lib/Target/X86/X86ISelLowering.h Fri May 21 14:06:54 2010
@@ -677,6 +677,7 @@
SDValue LowerShift(SDValue Op, SelectionDAG &DAG) const;
SDValue BuildFILD(SDValue Op, EVT SrcVT, SDValue Chain, SDValue StackSlot,
SelectionDAG &DAG) const;
+ SDValue LowerBIT_CONVERT(SDValue op, SelectionDAG &DAG) const;
SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerUINT_TO_FP_i64(SDValue Op, SelectionDAG &DAG) const;
Added: llvm/branches/Apple/whitney/test/CodeGen/X86/2010-05-16-nosseconversion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/test/CodeGen/X86/2010-05-16-nosseconversion.ll?rev=104358&view=auto
==============================================================================
--- llvm/branches/Apple/whitney/test/CodeGen/X86/2010-05-16-nosseconversion.ll (added)
+++ llvm/branches/Apple/whitney/test/CodeGen/X86/2010-05-16-nosseconversion.ll Fri May 21 14:06:54 2010
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=x86_64-apple-darwin -mattr=-sse < %s
+; PR 7135
+
+ at x = common global i64 0 ; <i64*> [#uses=1]
+
+define i32 @foo() nounwind readonly ssp {
+entry:
+ %0 = load i64* @x, align 8 ; <i64> [#uses=1]
+ %1 = uitofp i64 %0 to double ; <double> [#uses=1]
+ %2 = fptosi double %1 to i32 ; <i32> [#uses=1]
+ ret i32 %2
+}
More information about the llvm-branch-commits
mailing list