[PATCH] [AArch64 NEON] Get instruction BSL be matched to VSELECT. -Clang

Tim Northover t.p.northover at gmail.com
Mon Dec 9 04:53:53 PST 2013

  Hi Kevin,

  I think this may have been a little over-enthusiastic:

Comment at: lib/CodeGen/CGBuiltin.cpp:2707-2709
@@ +2706,5 @@
+      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]);
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 mailing list