[cfe-commits] r110420 - in /cfe/trunk: include/clang/Basic/arm_neon.td lib/CodeGen/CGBuiltin.cpp lib/CodeGen/CodeGenFunction.h

Nate Begeman natebegeman at mac.com
Thu Aug 5 18:24:57 PDT 2010


Author: sampo
Date: Thu Aug  5 20:24:57 2010
New Revision: 110420

URL: http://llvm.org/viewvc/llvm-project?rev=110420&view=rev
Log:
vdup_lane was missing
<rdar://problem/8278732>

Modified:
    cfe/trunk/include/clang/Basic/arm_neon.td
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/include/clang/Basic/arm_neon.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/arm_neon.td?rev=110420&r1=110419&r2=110420&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/arm_neon.td (original)
+++ cfe/trunk/include/clang/Basic/arm_neon.td Thu Aug  5 20:24:57 2010
@@ -64,6 +64,7 @@
 // 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 @@
 // 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

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=110420&r1=110419&r2=110420&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu Aug  5 20:24:57 2010
@@ -1012,8 +1012,10 @@
   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 @@
     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]);

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=110420&r1=110419&r2=110420&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Thu Aug  5 20:24:57 2010
@@ -1437,7 +1437,8 @@
                             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);
   





More information about the cfe-commits mailing list