llvm.org GIT mirror llvm / b2df01a
Codegen support for arbitrary vector getelementptrs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167830 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 7 years ago
2 changed file(s) with 8 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
31363136 OI != E; ++OI) {
31373137 const Value *Idx = *OI;
31383138 if (StructType *StTy = dyn_cast(Ty)) {
3139 unsigned Field = castInt>(Idx)->getZExtValue();
3139 unsigned Field = cast>(Idx)->getUniqueInteger().getZExtValue();
31403140 if (Field) {
31413141 // N = N + Offset
31423142 uint64_t Offset = TD->getStructLayout(StTy)->getElementOffset(Field);
31433143 N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
3144 DAG.getIntPtrConstant(Offset));
3144 DAG.getConstant(Offset, N.getValueType()));
31453145 }
31463146
31473147 Ty = StTy->getElementType(Field);
31863186 N.getValueType(), IdxN,
31873187 DAG.getConstant(Amt, IdxN.getValueType()));
31883188 } else {
3189 SDValue Scale = DAG.getConstant(ElementSize, TLI.getPointerTy());
3189 SDValue Scale = DAG.getConstant(ElementSize, IdxN.getValueType());
31903190 IdxN = DAG.getNode(ISD::MUL, getCurDebugLoc(),
31913191 N.getValueType(), IdxN, Scale);
31923192 }
151151 store %i4 %R, %i4* %P
152152 ret void
153153 }
154
155 define <2 x i32*> @vector_gep(<2 x [3 x {i32, i32}]*> %a) {
156 %w = getelementptr <2 x [3 x {i32, i32}]*> %a, <2 x i32> , <2 x i32> , <2 x i32>
157 ret <2 x i32*> %w
158 }