On Mon, Oct 27, 2014 at 9:16 PM, Robinson, Paul <
[email protected]> wrote:

> I can't find any documentation *at all* for lzcntintrin.h, so I can find
> no suggestion that its __lzcnt* functions would have defined behavior on an
> input of 0.
>
>
>
> I think it's not the exact header so much as the functions themselves that
> we should care about.
>
>
>
> Intel documents _lzcnt_u32/64 as returning operand size for 0 input. Ditto
> tzcnt.  Here's the lzcnt reference:
>
>
> https://software.intel.com/sites/products/documentation/doclib/iss/2013/compiler/cpp-lin/GUID-67C6440B-D49E-4D7C-98A2-667E47ED63CC.htm
>
>
These seem reasonable to support when compiling and targeting a microarch
with support for the instructions.


>
>
> Microsoft documentation claims that __lzcnt* returns the operand size for
> 0 input, while noting "If you run code that uses this intrinsic on hardware
> that does not support the lzcnt instruction, the results are unpredictable."
>
> http://msdn.microsoft.com/en-us/library/vstudio/bb384809(v=vs.100).aspx
>

While if we absolutely must due to compatibility, I would push hard to not
support these functions unless targeting such hardware.

I find this particularly important because in the grander scheme of things
*very little* x86 hardware in the world has lzcnt, and even less tzcnt. =[
Weak APIs like this seem really problematic there.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to