[PATCH] D12271: [X86] Expose the various _rot intrinsics on non-MS platforms

Michael Kuperstein via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 23 06:38:24 PDT 2015


mkuper created this revision.
mkuper added reviewers: majnemer, rnk.
mkuper added a subscriber: cfe-commits.

_rotl, _rotwl and _lrotl (and their right-shift counterparts) are official x86 intrinsics, and should be supported regardless of environment.
This is in contrast to _rotl8, _rotl16, and _rotl64 which are MS-specific.

Note that the MS documentation for _lrotl is different from the Intel documentation. Intel explicitly documents it as a 64-bit rotate, while for MS, since sizeof(unsigned long) for MSVC is 4, a 32-bit rotate is clearly implied.
Compare:
https://msdn.microsoft.com/en-us/library/a0w705h5.aspx
vs.
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=rot&techs=Other&expand=3193

Note that this doesn't change the implementations of these intrinsics, which are currently pretty awful.
We only manage to match the 32-bit versions to a rotate, and even then, still have the "and" and the control flow in place. That should be dealt with separately.

http://reviews.llvm.org/D12271

Files:
  lib/Headers/Intrin.h
  lib/Headers/immintrin.h
  test/CodeGen/x86-rot-intrinsics.c
  test\CodeGen\x86-rot-intrinsics.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12271.32925.patch
Type: text/x-patch
Size: 5898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150823/fcdafcc2/attachment.bin>


More information about the cfe-commits mailing list