[PATCH] [AArch64 NEON] Get instruction BSL be matched to VSELECT. -Clang
t.p.northover at gmail.com
Mon Dec 9 04:53:53 PST 2013
I think this may have been a little over-enthusiastic:
Comment at: lib/CodeGen/CGBuiltin.cpp:2707-2709
@@ +2706,5 @@
+ llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGF.CGM.getLLVMContext());
+ llvm::VectorType *CondTy = llvm::VectorType::get(Int1Ty, Lane);
+ Value *Cond = CGF.Builder.CreateTrunc(Ops, CondTy);
+ return CGF.Builder.CreateSelect(Cond, Ops, Ops);
I don't think this is correct. A vbsl intrinsic depends on all bits of its input, not just the low one, but this is discarding most of them.
I think you either need to keep the IR-level intrinsic or implement vbsl in terms of the AND/OR masking described in the ARM ARM. The latter is probably preferable longer-term, but doesn't necessarily have to happen now.
More information about the llvm-commits