diff options
author | David Majnemer <david.majnemer@gmail.com> | 2017-01-04 02:21:34 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2017-01-04 02:21:34 +0000 |
commit | cb892e9066e53e794ff07247d43e588bfb65d520 (patch) | |
tree | 00f2be1b12781bb4f228799b0ea263e2117fb689 /llvm/test/Transforms/InstCombine/shift.ll | |
parent | 022d2a563bf81be5c0629ebc9193bcb51b88d0a4 (diff) | |
download | bcm5719-llvm-cb892e9066e53e794ff07247d43e588bfb65d520.tar.gz bcm5719-llvm-cb892e9066e53e794ff07247d43e588bfb65d520.zip |
[InstCombine] Move casts around shift operations
It is possible to perform a left shift before zero extending if the
shift would only shift out zeros.
llvm-svn: 290928
Diffstat (limited to 'llvm/test/Transforms/InstCombine/shift.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/shift.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll index dab212dc583..c046a72110c 100644 --- a/llvm/test/Transforms/InstCombine/shift.ll +++ b/llvm/test/Transforms/InstCombine/shift.ll @@ -1049,3 +1049,15 @@ define <2 x i65> @test_63(<2 x i64> %t) { %b = ashr <2 x i65> %sext, <i65 33, i65 33> ret <2 x i65> %b } + +define i64 @test_64(i32 %t) { +; CHECK-LABEL: @test_64( +; CHECK-NEXT: [[SHL:%.*]] = shl i32 %t, 8 +; CHECK-NEXT: [[EXT:%.*]] = zext i32 [[SHL]] to i64 +; CHECK-NEXT: ret i64 [[EXT]] + + %and = and i32 %t, 16777215 + %ext = zext i32 %and to i64 + %shl = shl i64 %ext, 8 + ret i64 %shl +} |