[PATCH] D26335: [ms] Reinstate https://reviews.llvm.org/D14748 after https://reviews.llvm.org/D20291

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 13:18:58 PST 2016


hans added inline comments.


================
Comment at: lib/Headers/x86intrin.h:49
+static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
+__tzcnt_u32(unsigned int __X) { return __X ? __builtin_ctz(__X) : 32; }
+#ifdef __x86_64__
----------------
probinson wrote:
> hans wrote:
> > I'm worried about the conditional here. IIRC, ffmpeg uses TZCNT just as a faster encoding for BSF, but now we're putting a conditional in the way, so this will be slower actually. On the other hand, the alternative is weird too :-/
> I thought there was a peephole to notice a guard like this and do the right thing? In which case having the guard is fine.
But for non-BMI targets it won't be able to remove the guard (unless it can prove the argument is zero).

MSVC will just emit the raw 'tzcnt' instruction here, and that's what ffmpeg wants.


https://reviews.llvm.org/D26335





More information about the cfe-commits mailing list