[PATCH] D50924: [CodeGen] add rotate builtins
Sanjay Patel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 17 14:01:36 PDT 2018
spatel created this revision.
spatel added reviewers: fabiang, craig.topper, rnk, thakis.
Herald added a subscriber: mcrosier.
This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang (when both halves of a funnel shift are the same value, it's a rotate).
I think we're free to name these as we want because we're not copying gcc, but if there's some other existing art that we want to replicate, let me know.
The funnel shift intrinsics were added here:
https://reviews.llvm.org/D49242
With improved codegen in:
https://reviews.llvm.org/rL337966
https://reviews.llvm.org/rL339359
And basic IR optimization added in:
https://reviews.llvm.org/rL338218
https://reviews.llvm.org/rL340022
...so I think these should produce asm output that's equal or better to the multi-instruction alternatives using primitive C/IR ops.
In the motivating loop example from PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387#c7
...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source.
https://reviews.llvm.org/D50924
Files:
docs/LanguageExtensions.rst
include/clang/Basic/Builtins.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtin-rotate.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50924.161318.patch
Type: text/x-patch
Size: 6445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180817/ab7633cb/attachment.bin>
More information about the cfe-commits
mailing list