diff --git a/lib/Target/CellSPU/SPUISelDAGToDAG.cpp b/lib/Target/CellSPU/SPUISelDAGToDAG.cpp index 9b8c2ddd063..e42417c64c6 100644 --- a/lib/Target/CellSPU/SPUISelDAGToDAG.cpp +++ b/lib/Target/CellSPU/SPUISelDAGToDAG.cpp @@ -607,7 +607,8 @@ SPUDAGToDAGISel::DFormAddressPredicate(SDNode *Op, SDValue N, SDValue &Base, return true; } else if (Opc == ISD::Register ||Opc == ISD::CopyFromReg - ||Opc == ISD::UNDEF) { + ||Opc == ISD::UNDEF + ||Opc == ISD::Constant) { unsigned OpOpc = Op->getOpcode(); if (OpOpc == ISD::STORE || OpOpc == ISD::LOAD) { diff --git a/lib/Target/CellSPU/SPUISelLowering.cpp b/lib/Target/CellSPU/SPUISelLowering.cpp index 3a945ceedbf..7a6bb0f6efe 100644 --- a/lib/Target/CellSPU/SPUISelLowering.cpp +++ b/lib/Target/CellSPU/SPUISelLowering.cpp @@ -2102,7 +2102,10 @@ static SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) { SDValue Pointer = DAG.getNode(SPUISD::IndirectAddr, dl, PtrVT, DAG.getRegister(SPU::R1, PtrVT), DAG.getConstant(Idx, PtrVT)); - SDValue ShufMask = DAG.getNode(SPUISD::SHUFFLE_MASK, dl, VT, Pointer); + // widen the mask when dealing with half vectors + EVT maskVT = EVT::getVectorVT(*(DAG.getContext()), VT.getVectorElementType(), + 128/ VT.getVectorElementType().getSizeInBits()); + SDValue ShufMask = DAG.getNode(SPUISD::SHUFFLE_MASK, dl, maskVT, Pointer); SDValue result = DAG.getNode(SPUISD::SHUFB, dl, VT, diff --git a/lib/Target/CellSPU/SPUInstrInfo.td b/lib/Target/CellSPU/SPUInstrInfo.td index 803ce567dc4..f1d08867180 100644 --- a/lib/Target/CellSPU/SPUInstrInfo.td +++ b/lib/Target/CellSPU/SPUInstrInfo.td @@ -63,6 +63,7 @@ let canFoldAsLoad = 1 in { def v2f64: LoadDFormVec; def v2i32: LoadDFormVec; + def v2f32: LoadDFormVec; def r128: LoadDForm; def r64: LoadDForm; @@ -97,6 +98,7 @@ let canFoldAsLoad = 1 in { def v2f64: LoadAFormVec; def v2i32: LoadAFormVec; + def v2f32: LoadAFormVec; def r128: LoadAForm; def r64: LoadAForm; @@ -131,6 +133,7 @@ let canFoldAsLoad = 1 in { def v2f64: LoadXFormVec; def v2i32: LoadXFormVec; + def v2f32: LoadXFormVec; def r128: LoadXForm; def r64: LoadXForm; @@ -181,6 +184,7 @@ multiclass StoreDForms def v2f64: StoreDFormVec; def v2i32: StoreDFormVec; + def v2f32: StoreDFormVec; def r128: StoreDForm; def r64: StoreDForm; @@ -213,6 +217,7 @@ multiclass StoreAForms def v2f64: StoreAFormVec; def v2i32: StoreAFormVec; + def v2f32: StoreAFormVec; def r128: StoreAForm; def r64: StoreAForm; @@ -247,6 +252,7 @@ multiclass StoreXForms def v2f64: StoreXFormVec; def v2i32: StoreXFormVec; + def v2f32: StoreXFormVec; def r128: StoreXForm; def r64: StoreXForm; diff --git a/test/CodeGen/CellSPU/v2f32.ll b/test/CodeGen/CellSPU/v2f32.ll index 004463a86d3..b32c23b4280 100644 --- a/test/CodeGen/CellSPU/v2f32.ll +++ b/test/CodeGen/CellSPU/v2f32.ll @@ -42,4 +42,22 @@ define %vec @test_splat(float %param ) { ret %vec %rv } +define void @test_store(%vec %val, %vec* %ptr){ + +;CHECK: stqd + store %vec undef, %vec* null + +;CHECK: stqd $3, 0($4) +;CHECK: bi $lr + store %vec %val, %vec* %ptr + ret void +} + +define %vec @test_insert(){ +;CHECK: cwd +;CHECK: shufb $3 + %rv = insertelement %vec undef, float 0.0e+00, i32 undef +;CHECK: bi $lr + ret %vec %rv +} diff --git a/test/CodeGen/CellSPU/v2i32.ll b/test/CodeGen/CellSPU/v2i32.ll index be3822a8d0c..ca8af6ae742 100644 --- a/test/CodeGen/CellSPU/v2i32.ll +++ b/test/CodeGen/CellSPU/v2i32.ll @@ -55,3 +55,10 @@ define i32 @test_extract() { ret i32 %rv } +define void @test_store( %vec %val, %vec* %ptr) +{ +;CHECK: stqd $3, 0($4) +;CHECK: bi $lr + store %vec %val, %vec* %ptr + ret void +}