OSDN Git Service

[PowerPC] Collapse RLDICL/RLDICR into RLDIC when possible
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Wed, 5 Jun 2019 02:36:40 +0000 (02:36 +0000)
committerNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Wed, 5 Jun 2019 02:36:40 +0000 (02:36 +0000)
commit062cf6681d28b647e634556896627fb1b29606ab
tree2040740201f54fd8579cfa44bb952c973c6a05e8
parentea21d58a1862ce93866e07f736452170a4ed89d6
[PowerPC] Collapse RLDICL/RLDICR into RLDIC when possible

Generally speaking, we lower to an optimal rotate sequence for nodes visible in
the SDAG. However, there are instances where the two rotates are not visible at
ISEL time - most notably those in a very common sequence when lowering switch
statements to jump tables.

A common situation is a switch on a 32-bit integer. This value has to have the
upper 32 bits cleared and because jump table offsets are word offsets, the value
needs to be shifted left by 2 bits. We currently emit the clear and the left
shift as two separate instructions, but this is not needed as we can lower it to
a single RLDIC.

This patch just cleans that up.

Differential revision: https://reviews.llvm.org/D60402

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362576 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCMIPeephole.cpp
test/CodeGen/PowerPC/collapse-rotates.mir [new file with mode: 0644]
test/CodeGen/PowerPC/jump-tables-collapse-rotate.ll [new file with mode: 0644]