[PATCH] D33616: [MS] Fix _bittest* intrinsics for values bigger than 31

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 17:27:34 PDT 2017


rsmith added a comment.

In https://reviews.llvm.org/D33616#768287, @hans wrote:

> From looking in the Intel manual (Table 3-2, in 3.1.1.9 about Bit(BitBase,BitOffset)) it does sound like the bit offset can be negative *shudder*, so I suppose this is necessary and explains why the type is signed in the first place? Hopefully most of these will be inlined into a context where BitPos is constant or unsigned.


OK, but this code will produce the wrong answer in cases where `_BitPos` is negative, because signed division rounds towards zero rather than rounding down.


https://reviews.llvm.org/D33616





More information about the cfe-commits mailing list