[PATCH] D33715: [PPC] exploit rotate-left-then-mask-insert instructions for bitfield insert
Hiroshi Inoue via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 02:07:02 PDT 2017
inouehrs created this revision.
We can use rotate-left-then-mask-insert instructions (rlwimi and rldimi) for efficient implementation of bitfield insert (and similar code sequences generated by SROA etc). However, the current LLVM generates inefficient code sequence for this purpose. For example of `bitfieldinsert64` in the added unit test, it generates four instructions instead of just one rldimi instruction.
We already have a method to generate rotate-left-then-mask-insert for 32-bit integer (`tryBitfieldInsert`) in PPCDAGToDAGISel, but it is not executed for most of the simple bitfield insert since `tryBitPermutation` is executed before `tryBitfieldInsert` and it generates suboptimal code.
This patch makes `tryBitfieldInsert` executed before `tryBitPermutation` with the limited targets of the simplest cases. This patch also adds a 64-bit version of `tryBitfieldInsert` to generated rldimi instruction.
https://reviews.llvm.org/D33715
Files:
lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
test/CodeGen/PowerPC/addi-offset-fold.ll
test/CodeGen/PowerPC/bitfieldinsert.ll
test/CodeGen/PowerPC/bperm.ll
test/CodeGen/PowerPC/ppc64le-aggregates.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33715.100834.patch
Type: text/x-patch
Size: 15802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170531/25018f1f/attachment.bin>
More information about the llvm-commits
mailing list