[llvm-commits] [dragonegg] r141363 - in /dragonegg/trunk/src/x86: Target.cpp x86_builtins
Duncan Sands
baldrick at free.fr
Fri Oct 7 05:45:22 PDT 2011
Author: baldrick
Date: Fri Oct 7 07:45:22 2011
New Revision: 141363
URL: http://llvm.org/viewvc/llvm-project?rev=141363&view=rev
Log:
Turn __builtin_ia32_vec_perm_v2df and friends into shufflevector
instructions, fixing PR10890.
Modified:
dragonegg/trunk/src/x86/Target.cpp
dragonegg/trunk/src/x86/x86_builtins
Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=141363&r1=141362&r2=141363&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Fri Oct 7 07:45:22 2011
@@ -829,6 +829,36 @@
Result = Builder.CreateCall(sqrtps, Ops[0]);
return true;
}
+ case vec_perm_v16qi:
+ case vec_perm_v16qi_u:
+ case vec_perm_v2df:
+ case vec_perm_v2di:
+ case vec_perm_v2di_u:
+ case vec_perm_v4df:
+ case vec_perm_v4sf:
+ case vec_perm_v4si:
+ case vec_perm_v4si_u:
+ case vec_perm_v8hi:
+ case vec_perm_v8hi_u:
+ case vec_perm_v8sf: {
+ VectorType *VecTy = dyn_cast<VectorType>(Ops[0]->getType());
+ if (Ops[1]->getType() != VecTy)
+ return false;
+ unsigned NElts = VecTy->getNumElements();
+ Constant *Mask = dyn_cast<Constant>(Ops[2]);
+ if (!Mask)
+ return false;
+ VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
+ if (!MaskTy || MaskTy->getNumElements() != NElts ||
+ !MaskTy->getElementType()->isIntegerTy())
+ return false;
+ if (!MaskTy->getElementType()->isIntegerTy(32))
+ Mask = ConstantExpr::getIntegerCast(Mask,
+ VectorType::get(Builder.getInt32Ty(),
+ NElts), false);
+ Result = Builder.CreateShuffleVector(Ops[0], Ops[1], Mask);
+ return true;
+ }
}
DieAbjectly("Builtin not implemented!", stmt);
return false;
Modified: dragonegg/trunk/src/x86/x86_builtins
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/x86_builtins?rev=141363&r1=141362&r2=141363&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/x86_builtins (original)
+++ dragonegg/trunk/src/x86/x86_builtins Fri Oct 7 07:45:22 2011
@@ -806,18 +806,18 @@
DEFINE_BUILTIN(vec_init_v4hi),
DEFINE_BUILTIN(vec_init_v8qi),
//DEFINE_BUILTIN(vec_pack_sfix),
-//DEFINE_BUILTIN(vec_perm_v16qi),
-//DEFINE_BUILTIN(vec_perm_v16qi_u),
-//DEFINE_BUILTIN(vec_perm_v2df),
-//DEFINE_BUILTIN(vec_perm_v2di),
-//DEFINE_BUILTIN(vec_perm_v2di_u),
-//DEFINE_BUILTIN(vec_perm_v4df),
-//DEFINE_BUILTIN(vec_perm_v4sf),
-//DEFINE_BUILTIN(vec_perm_v4si),
-//DEFINE_BUILTIN(vec_perm_v4si_u),
-//DEFINE_BUILTIN(vec_perm_v8hi),
-//DEFINE_BUILTIN(vec_perm_v8hi_u),
-//DEFINE_BUILTIN(vec_perm_v8sf),
+DEFINE_BUILTIN(vec_perm_v16qi),
+DEFINE_BUILTIN(vec_perm_v16qi_u),
+DEFINE_BUILTIN(vec_perm_v2df),
+DEFINE_BUILTIN(vec_perm_v2di),
+DEFINE_BUILTIN(vec_perm_v2di_u),
+DEFINE_BUILTIN(vec_perm_v4df),
+DEFINE_BUILTIN(vec_perm_v4sf),
+DEFINE_BUILTIN(vec_perm_v4si),
+DEFINE_BUILTIN(vec_perm_v4si_u),
+DEFINE_BUILTIN(vec_perm_v8hi),
+DEFINE_BUILTIN(vec_perm_v8hi_u),
+DEFINE_BUILTIN(vec_perm_v8sf),
DEFINE_BUILTIN(vec_set_v16qi),
DEFINE_BUILTIN(vec_set_v2di),
DEFINE_BUILTIN(vec_set_v4hi),
More information about the llvm-commits
mailing list