From 05eb438d90d8741f7a3d2d0f1e4fb01e784eee94 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Wed, 24 Feb 2016 16:07:52 +0100 Subject: [PATCH] MSVC: add non-GNU-asm variant of BSF masked gather Signed-off-by: Matthias Kretz --- common/gatherimplementation.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/gatherimplementation.h b/common/gatherimplementation.h index aac2de8b9..3e71b8475 100644 --- a/common/gatherimplementation.h +++ b/common/gatherimplementation.h @@ -82,6 +82,7 @@ Vc_ALWAYS_INLINE void executeGather(BitScanLoopT, const IT &indexes, typename V::MaskArgument mask) { +#ifdef Vc_GNU_ASM size_t bits = mask.toInt(); while (Vc_IS_LIKELY(bits > 0)) { size_t i, j; @@ -93,15 +94,15 @@ Vc_ALWAYS_INLINE void executeGather(BitScanLoopT, v[i] = mem[indexes[i]]; v[j] = mem[indexes[j]]; } - - /* Alternative from Vc::SSE (0.7) +#else + // Alternative from Vc::SSE (0.7) int bits = mask.toInt(); while (bits) { const int i = _bit_scan_forward(bits); - bits &= ~(1 << i); // btr? - d.set(i, ith_value(i)); + bits &= bits - 1; + v[i] = mem[indexes[i]]; } - */ +#endif // Vc_GNU_ASM } template