[PATCH] D14748: bmiintrin.h: Allow using the tzcnt intrinsics for non-BMI targets

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 17 11:41:05 PST 2015


On Tue, Nov 17, 2015 at 11:32 AM, Craig Topper <craig.topper at gmail.com>
wrote:

> craig.topper added a subscriber: craig.topper.
> craig.topper added a comment.
>
> The summary of why this is ok is slightly misleading.


I read this as reason why programs might try to use this, not why this
change here is correct. (This change is ok as it has an explicit 0 check as
you say, so it'll only be efficient once you target machines with BMI)


> The backend won't try to encode the TZCNT instruction when the BMI feature
> is not enabled. Notice this just maps the to the generic non-x86 specific
> __builtin_ctz. The backend will emit a regular BSF instruction if BMI is
> not supported. There will be a zero check around it unless the backend can
> prove that the input is not 0.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D14748
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151117/278c017f/attachment.html>


More information about the cfe-commits mailing list