vdup_lane was missing

<rdar://problem/8278732>

llvm-svn: 110420
This commit is contained in:
Nate Begeman 2010-08-06 01:24:57 +00:00
parent a59132e329
commit ad5dd42817
3 changed files with 13 additions and 2 deletions

View File

@ -64,6 +64,7 @@ class WInst<string p, string t> : Inst<p, t, OP_NONE> {}
// u: unsigned integer (int/float args)
// f: float (int args)
// d: default
// g: default, ignore 'Q' size modifier.
// w: double width elements, same num elts
// n: double width elements, half num elts
// h: half width elements, double num elts
@ -239,6 +240,7 @@ def VCREATE: Inst<"dl", "csihfUcUsUiUlPcPsl", OP_CAST>;
// E.3.19 Set all lanes to same value
def VDUP_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>;
def VMOV_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>;
def VDUP_LANE : WInst<"dgi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">;
////////////////////////////////////////////////////////////////////////////////
// E.3.20 Combining vectors

View File

@ -1012,8 +1012,10 @@ const llvm::VectorType *GetNeonType(LLVMContext &C, unsigned type, bool q) {
return 0;
}
Value *CodeGenFunction::EmitNeonSplat(Value *V, Constant *C) {
Value *CodeGenFunction::EmitNeonSplat(Value *V, Constant *C, bool widen) {
unsigned nElts = cast<llvm::VectorType>(V->getType())->getNumElements();
if (widen)
nElts <<= 1;
SmallVector<Constant*, 16> Indices(nElts, C);
Value* SV = llvm::ConstantVector::get(Indices.begin(), Indices.size());
return Builder.CreateShuffleVector(V, V, SV, "lane");
@ -1201,6 +1203,12 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
Function *F = CGM.getIntrinsic(Int, Tys, 2);
return EmitNeonCall(F, Ops, "vcvt_n");
}
case ARM::BI__builtin_neon_vdup_lane_v:
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
return EmitNeonSplat(Ops[0], cast<Constant>(Ops[1]));
case ARM::BI__builtin_neon_vdupq_lane_v:
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
return EmitNeonSplat(Ops[0], cast<Constant>(Ops[1]), true);
case ARM::BI__builtin_neon_vext_v:
case ARM::BI__builtin_neon_vextq_v: {
ConstantInt *C = dyn_cast<ConstantInt>(Ops[2]);

View File

@ -1437,7 +1437,8 @@ public:
llvm::SmallVectorImpl<llvm::Value*> &O,
const char *name, bool splat = false,
unsigned shift = 0, bool rightshift = false);
llvm::Value *EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx);
llvm::Value *EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx,
bool widen = false);
llvm::Value *EmitNeonShiftVector(llvm::Value *V, const llvm::Type *Ty,
bool negateForRightShift);