diff options
| author | Evgeny Stupachenko <evstupac@gmail.com> | 2017-05-15 19:08:56 +0000 |
|---|---|---|
| committer | Evgeny Stupachenko <evstupac@gmail.com> | 2017-05-15 19:08:56 +0000 |
| commit | 2fecd38ab8c0a39514acdb35a482cb2e7a9eae99 (patch) | |
| tree | a3c17cfec6ea84bfc81ee1ef5f0e1b5f3bd1eddf /compiler-rt/lib | |
| parent | 586849918b24e69cb158b06481ed7cd7028c22e2 (diff) | |
| download | bcm5719-llvm-2fecd38ab8c0a39514acdb35a482cb2e7a9eae99.tar.gz bcm5719-llvm-2fecd38ab8c0a39514acdb35a482cb2e7a9eae99.zip | |
The patch adds CTLZ idiom recognition.
Summary:
The following loops should be recognized:
i = 0;
while (n) {
n = n >> 1;
i++;
body();
}
use(i);
And replaced with builtin_ctlz(n) if body() is empty or
for CPUs that have CTLZ instruction converted to countable:
for (j = 0; j < builtin_ctlz(n); j++) {
n = n >> 1;
i++;
body();
}
use(builtin_ctlz(n));
Reviewers: rengolin, joerg
Differential Revision: http://reviews.llvm.org/D32605
From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 303102
Diffstat (limited to 'compiler-rt/lib')
0 files changed, 0 insertions, 0 deletions

