diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-08-15 18:25:52 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-08-15 18:25:52 +0000 |
commit | d9d323f05677ccd05e8881df26ac0da6b3cf4ade (patch) | |
tree | 43ec4a2ecca62b044430af57dbbdf40bb9e8b740 /examples | |
parent | c0f00a95161ed64a875fff62716aec60d2631ce8 (diff) |
[InstCombine] sink sext after ashr
Narrow ops are better for bit-tracking, and in the case of vectors,
may enable better codegen.
As the trunc test shows, this can allow follow-on simplifications.
There's a block of code in visitTrunc that deals with shifted ops
with FIXME comments. It may be possible to remove some of that now,
but I want to make sure there are no problems with this step first.
http://rise4fun.com/Alive/Y3a
Name: hoist_ashr_ahead_of_sext_1
%s = sext i8 %x to i32
%r = ashr i32 %s, 3 ; shift value is < than source bit width
=>
%a = ashr i8 %x, 3
%r = sext i8 %a to i32
Name: hoist_ashr_ahead_of_sext_2
%s = sext i8 %x to i32
%r = ashr i32 %s, 8 ; shift value is >= than source bit width
=>
%a = ashr i8 %x, 7 ; so clamp this shift value
%r = sext i8 %a to i32
Name: junc_the_trunc
%a = sext i16 %v to i32
%s = ashr i32 %a, 18
%t = trunc i32 %s to i16
=>
%t = ashr i16 %v, 15
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions