[InstCombine] fold funnel shift amount based on demanded bits
authorSanjay Patel <spatel@rotateright.com>
Tue, 13 Nov 2018 23:27:23 +0000 (23:27 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 13 Nov 2018 23:27:23 +0000 (23:27 +0000)
commita139564896f2d0d4dc4dc491c4b17c9f01975a26
tree2a2f2ba388d4044d1e62ab0c1f77bcd238b09e5c
parente0c00718ec2312ce55c79340a2c986a99e279cf9
[InstCombine] fold funnel shift amount based on demanded bits

The shift amount of a funnel shift is modulo the scalar bitwidth:
http://llvm.org/docs/LangRef.html#llvm-fshl-intrinsic
...so we can use demanded bits analysis on that operand to simplify it
when we have a power-of-2 bitwidth.

This is another step towards canonicalizing {shift/shift/or} to the
intrinsics in IR.

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

llvm-svn: 346814
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/fsh.ll