[PATCH] D59346: [X86] Add gcc rotate intrinsics to ia32intrin.h

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 22:12:12 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: rnk, jyknight, RKSimon, spatel, erichkeane.
Herald added a subscriber: jdoerfert.
Herald added a project: clang.
craig.topper updated this revision to Diff 190567.
craig.topper added a comment.

Add the test file


This is another attempt at what Erich Keane tried to do in r355322.a

This adds __rolb, __rolw, __rold, __rolq and their ror equivalent as always_inline wrappers around __builtin_rotate* which will lower to funnel shift intrinsics in IR.

Additionally, when _MSC_VER is not defined we will define _rotl, _lrotl, _rotr, _lrotr as macros to one of the always_inline intrinsics mentioned above. Making sure that _lrotl/_lrotr use either 32 or 64 bit based on the size of long. These need to be macros because we have builtins with the same name for MS compatibility, but _MSC_VER isn't always defined when those builtins are enabled.

We also define _rotwl and _rotwr as macros aliasing to __rolw/__rorw just like gcc to complete the set. These don't need to be gated with _MSC_VER because these aren't MS builtins.

I've added tests both for non-MS and -ms-extensions with and without _MSC_VER being defined.


Repository:
  rC Clang

https://reviews.llvm.org/D59346

Files:
  lib/Headers/ia32intrin.h
  test/CodeGen/rot-intrinsics.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59346.190567.patch
Type: text/x-patch
Size: 7417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190314/b6a28398/attachment.bin>


More information about the cfe-commits mailing list