[llvm-commits] [llvm] r40987 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/insertelement-copytoregs.ll
Dan Gohman
djg at cray.com
Fri Aug 10 07:59:38 PDT 2007
Author: djg
Date: Fri Aug 10 09:59:38 2007
New Revision: 40987
URL: http://llvm.org/viewvc/llvm-project?rev=40987&view=rev
Log:
Fix EXTRACT_ELEMENT, EXTRACT_SUBVECTOR, and EXTRACT_VECTOR_ELT to
use an intptr ValueType instead of i32 for the index operand in
getCopyToParts.
Added:
llvm/trunk/test/CodeGen/X86/insertelement-copytoregs.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=40987&r1=40986&r2=40987&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Aug 10 09:59:38 2007
@@ -718,6 +718,8 @@
SDOperand *Parts,
unsigned NumParts,
MVT::ValueType PartVT) {
+ TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ MVT::ValueType PtrVT = TLI.getPointerTy();
MVT::ValueType ValueVT = Val.getValueType();
if (!MVT::isVector(ValueVT) || NumParts == 1) {
@@ -725,7 +727,7 @@
if (NumParts > 1) {
for (unsigned i = 0; i != NumParts; ++i)
Parts[i] = DAG.getNode(ISD::EXTRACT_ELEMENT, PartVT, Val,
- DAG.getConstant(i, MVT::i32));
+ DAG.getConstant(i, PtrVT));
if (!DAG.getTargetLoweringInfo().isLittleEndian())
std::reverse(Parts, Parts + NumParts);
return;
@@ -776,11 +778,11 @@
Ops[i] = DAG.getNode(ISD::EXTRACT_SUBVECTOR,
IntermediateVT, Val,
DAG.getConstant(i * (NumElements / NumIntermediates),
- MVT::i32));
+ PtrVT));
else
Ops[i] = DAG.getNode(ISD::EXTRACT_VECTOR_ELT,
IntermediateVT, Val,
- DAG.getConstant(i, MVT::i32));
+ DAG.getConstant(i, PtrVT));
// Split the intermediate operands into legal parts.
if (NumParts == NumIntermediates) {
Added: llvm/trunk/test/CodeGen/X86/insertelement-copytoregs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/insertelement-copytoregs.ll?rev=40987&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/insertelement-copytoregs.ll (added)
+++ llvm/trunk/test/CodeGen/X86/insertelement-copytoregs.ll Fri Aug 10 09:59:38 2007
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep -v IMPLICIT_DEF
+
+define void @foo(<2 x float>* %p) {
+ %t = insertelement <2 x float> undef, float 0.0, i32 0
+ %v = insertelement <2 x float> %t, float 0.0, i32 1
+ br label %bb8
+
+bb8:
+ store <2 x float> %v, <2 x float>* %p
+ ret void
+}
More information about the llvm-commits
mailing list