OSDN Git Service

[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)
commit4e29225d159ad62fed5f0b7f8e11843b53e573fd
tree9711ea2c0341a1326fe69f8f9f48b064c8932c84
parent13725274b0728bc34917dcfa76d2026bb4d5f52d
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310060 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineShifts.cpp
test/Transforms/InstCombine/cast.ll
test/Transforms/InstCombine/lshr.ll
test/Transforms/InstCombine/select-with-bitwise-ops.ll
test/Transforms/InstCombine/trunc.ll