]> granicus.if.org Git - llvm/commit
[DAGCombiner] improve throughput of shift+logic+shift
authorSanjay Patel <spatel@rotateright.com>
Sun, 1 Sep 2019 18:38:15 +0000 (18:38 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 1 Sep 2019 18:38:15 +0000 (18:38 +0000)
commitff59b5d0fd6acadfe1e09c0331e3ed6fb76429fc
treeba6919fe310ccb979b0bcbef574570a2950f7c87
parent01a17792001bab5c4e343b753a58fb3c47bc1ce1
[DAGCombiner] improve throughput of shift+logic+shift

The motivating case for this is a long way from here:
https://bugs.llvm.org/show_bug.cgi?id=43146
...but I think this is where we have to start.

We need to canonicalize/optimize sequences of shift and logic to ease
pattern matching for things like bswap and improve perf in general.
But without the artificial limit of '!LegalTypes' (early combining),
there are a lot of test diffs, and not all are good.

In the minimal tests added for this proposal, x86 should have better
throughput in all cases. AArch64 is neutral for scalar tests because
it can fold shifts into bitwise logic ops.

There are 3 shift opcodes and 3 logic opcodes for a total of 9 possible patterns:
https://rise4fun.com/Alive/VlI
https://rise4fun.com/Alive/n1m
https://rise4fun.com/Alive/1Vn

Differential Revision: https://reviews.llvm.org/D67021

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370617 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/bitfield-insert.ll
test/CodeGen/AArch64/shift-logic.ll
test/CodeGen/Thumb2/2010-03-15-AsmCCClobber.ll
test/CodeGen/X86/shift-logic.ll