[PowerPC] Materialize i64 constants using rotation
authorHal Finkel <hfinkel@anl.gov>
Sun, 4 Jan 2015 15:43:55 +0000 (15:43 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sun, 4 Jan 2015 15:43:55 +0000 (15:43 +0000)
commit2ac0826af33c886f9d4552cf784f188d524e465e
treec7518a6ed7a510a0278a70f98561ad61236f7d81
parent736231912066c95f033ad46db3232a7880df51ca
[PowerPC] Materialize i64 constants using rotation

Materializing full 64-bit constants on PPC64 can be expensive, requiring up to
5 instructions depending on the locations of the non-zero bits. Sometimes
materializing a rotated constant, and then applying the inverse rotation, requires
fewer instructions than the direct method. If so, do that instead.

In r225132, I added support for forming constants using bit inversion. In
effect, this reverts that commit and replaces it with rotation support. The bit
inversion is useful for turning constants that are mostly ones into ones that
are mostly zeros (thus enabling a more-efficient shift-based materialization),
but the same effect can be obtained by using negative constants and a rotate,
and that is at least as efficient, if not more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225135 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
lib/Target/PowerPC/README.txt
test/CodeGen/PowerPC/constants-i64.ll