From 52672b813e0e1741855c5692a84be5bc9ef5869f Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 22 Jul 2008 18:39:19 +0000 Subject: [PATCH] Fix PR2574: implement v2f32 scalar_to_vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53927 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 7 +++++++ test/CodeGen/X86/mmx-s2v.ll | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/CodeGen/X86/mmx-s2v.ll diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index e5c8cb8140f..fb4f005c9bd 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -601,6 +601,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2i32, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v1i64, Custom); + setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v2f32, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v8i8, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v4i16, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v1i64, Custom); @@ -4135,6 +4136,12 @@ X86TargetLowering::LowerINSERT_VECTOR_ELT(SDOperand Op, SelectionDAG &DAG) { SDOperand X86TargetLowering::LowerSCALAR_TO_VECTOR(SDOperand Op, SelectionDAG &DAG) { + if (Op.getValueType() == MVT::v2f32) + return DAG.getNode(ISD::BIT_CONVERT, MVT::v2f32, + DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2i32, + DAG.getNode(ISD::BIT_CONVERT, MVT::i32, + Op.getOperand(0)))); + SDOperand AnyExt = DAG.getNode(ISD::ANY_EXTEND, MVT::i32, Op.getOperand(0)); MVT VT = MVT::v2i32; switch (Op.getValueType().getSimpleVT()) { diff --git a/test/CodeGen/X86/mmx-s2v.ll b/test/CodeGen/X86/mmx-s2v.ll new file mode 100644 index 00000000000..4ec2403e341 --- /dev/null +++ b/test/CodeGen/X86/mmx-s2v.ll @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx +; PR2574 + +define void @entry(i32 %m_task_id, i32 %start_x, i32 %end_x) {;