[InstCombine] narrow lshr with constant
authorSanjay Patel <spatel@rotateright.com>
Fri, 4 Aug 2017 15:42:47 +0000 (15:42 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 4 Aug 2017 15:42:47 +0000 (15:42 +0000)
commit79e7f6b3e394ad2f3b58581085847b4bb11fdc75
tree9473613f14dc301e4685f83eaf774190908ba3f9
parent4b11a78a6e34eee30b41e7edec47d9af5c400ed6
[InstCombine] narrow lshr with constant

Name: narrow_shift
Pre: C1 < 8
%zx = zext i8 %x to i32
%l = lshr i32 %zx, C1
  =>
%narrowC = trunc i32 C1 to i8
%ns = lshr i8 %x, %narrowC
%l = zext i8 %ns to i32

http://rise4fun.com/Alive/jIV

This isn't directly applicable to PR34046 as written, but we
need to have more narrowing folds like this to be sure that
rotate patterns are recognized.

llvm-svn: 310060
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/cast.ll
llvm/test/Transforms/InstCombine/lshr.ll
llvm/test/Transforms/InstCombine/select-with-bitwise-ops.ll
llvm/test/Transforms/InstCombine/trunc.ll