[PATCH] [AArch64 NEON] Get instruction BSL be matched to VSELECT. -Clang
Kevin Qin
kevinqindev at gmail.com
Mon Dec 9 01:05:31 PST 2013
Hi t.p.northover,
Hi Tim,
This is small changes in Clang to replace IR intrinsic with vselect.
http://llvm-reviews.chandlerc.com/D2360
Files:
lib/CodeGen/CGBuiltin.cpp
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -2700,6 +2700,16 @@
return CGF.EmitNeonCall(TblF, TblOps, Name);
}
+static Value *EmitAArch64BslBuiltinExpr(CodeGenFunction &CGF,
+ SmallVector<Value *, 4> &Ops) {
+ unsigned Lane =
+ dyn_cast<llvm::VectorType>(Ops[0]->getType())->getVectorNumElements();
+ llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGF.CGM.getLLVMContext());
+ llvm::VectorType *CondTy = llvm::VectorType::get(Int1Ty, Lane);
+ Value *Cond = CGF.Builder.CreateTrunc(Ops[0], CondTy);
+ return CGF.Builder.CreateSelect(Cond, Ops[1], Ops[2]);
+}
+
static Value *EmitAArch64TblBuiltinExpr(CodeGenFunction &CGF,
unsigned BuiltinID,
const CallExpr *E) {
@@ -2810,8 +2820,7 @@
BslOps.push_back(CmpRes);
BslOps.push_back(Ops[0]);
BslOps.push_back(TblRes);
- Function *BslF = CGF.CGM.getIntrinsic(Intrinsic::arm_neon_vbsl, Ty);
- return CGF.EmitNeonCall(BslF, BslOps, "vbsl");
+ return EmitAArch64BslBuiltinExpr(CGF, BslOps);
}
case AArch64::BI__builtin_neon_vtbx2_v: {
TblOps.push_back(Ops[1]);
@@ -2836,8 +2845,7 @@
BslOps.push_back(CmpRes);
BslOps.push_back(Ops[0]);
BslOps.push_back(TblRes);
- Function *BslF = CGF.CGM.getIntrinsic(Intrinsic::arm_neon_vbsl, Ty);
- return CGF.EmitNeonCall(BslF, BslOps, "vbsl");
+ return EmitAArch64BslBuiltinExpr(CGF, BslOps);
}
case AArch64::BI__builtin_neon_vtbx4_v: {
TblOps.push_back(Ops[1]);
@@ -3012,9 +3020,8 @@
case AArch64::BI__builtin_neon_vfmaq_v:
return EmitARMBuiltinExpr(ARM::BI__builtin_neon_vfmaq_v, E);
case AArch64::BI__builtin_neon_vbsl_v:
- return EmitARMBuiltinExpr(ARM::BI__builtin_neon_vbsl_v, E);
case AArch64::BI__builtin_neon_vbslq_v:
- return EmitARMBuiltinExpr(ARM::BI__builtin_neon_vbslq_v, E);
+ return EmitAArch64BslBuiltinExpr(*this, Ops);
case AArch64::BI__builtin_neon_vrsqrts_v:
return EmitARMBuiltinExpr(ARM::BI__builtin_neon_vrsqrts_v, E);
case AArch64::BI__builtin_neon_vrsqrtsq_v:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2360.1.patch
Type: text/x-patch
Size: 2222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131209/8b791a62/attachment.bin>
More information about the cfe-commits
mailing list