[PATCH] D88539: [PowerPC] Handle the constant with many trailing ones.
EsmeYi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 01:25:33 PDT 2020
Esme created this revision.
Esme added reviewers: jsji, nemanjai, steven.zhang, lkail, shchenz, qiucf, PowerPC.
Herald added subscribers: llvm-commits, kbarton, hiraditya.
Herald added a project: LLVM.
Esme requested review of this revision.
We have handled the constants with many trailing zeros like `i64 5228199936` ( 0b100110111101000000000000000000000) , which can be materialized by 2 instructions:
li 3, 2493
sldi 3, 3, 21
Inspired by this, we considered another case where the constant has many trailing ones. We can take advantage of li/lis's sign-extension to generate leading ones, and then mask extra bits off after rotation.
For example, without such ISEL pattern we need 4 instructions to materialize `i64 10460594175` (0b1001101111011111111111111111111111)
li 3, 2
sldi 3, 3, 32
oris 3, 3, 28543
ori 3, 3, 65535
Now we only need 2 instructions after this patch:
li 3, -31522
rldicl 3, 3, 23, 30
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88539
Files:
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/test/CodeGen/PowerPC/combine_ext_trunc.ll
llvm/test/CodeGen/PowerPC/constants-i64.ll
llvm/test/CodeGen/PowerPC/negctr.ll
llvm/test/CodeGen/PowerPC/ori_imm64.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88539.295198.patch
Type: text/x-patch
Size: 7092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200930/b875e53d/attachment.bin>
More information about the llvm-commits
mailing list