diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-10 20:25:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-10 20:25:54 +0000 |
commit | 9ee947c224a157a5fb2c921a0e194fddedef2f9f (patch) | |
tree | 216fdd4c47294d32953b52bd75c44f52e3b68e43 /test/Transforms/InstCombine/cast.ll | |
parent | 859c372e04f053daa85812f8b790d2b0d1645fee (diff) | |
download | llvm-9ee947c224a157a5fb2c921a0e194fddedef2f9f.tar.gz llvm-9ee947c224a157a5fb2c921a0e194fddedef2f9f.tar.bz2 llvm-9ee947c224a157a5fb2c921a0e194fddedef2f9f.tar.xz |
teach zext optimization how to deal with truncs that don't come from
the zext dest type. This allows us to handle test52/53 in cast.ll,
and allows llvm-gcc to generate much better code for PR4216 in -m64
mode:
_test_bitfield: ## @test_bitfield
orl $32962, %edi
movl %edi, %eax
andl $-25350, %eax
ret
This also fixes a bug handling vector extends, ensuring that the
mask produced is a vector constant, not an integer constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/cast.ll')
-rw-r--r-- | test/Transforms/InstCombine/cast.ll | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 4f0475ac59..8424967e11 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -496,6 +496,30 @@ define i64 @test51(i64 %A, i1 %cond) { ; CHECK-NEXT: %sext = shl i64 %E, 32 ; CHECK-NEXT: %F = ashr i64 %sext, 32 ; CHECK-NEXT: ret i64 %F - } +define i32 @test52(i64 %A) { + %B = trunc i64 %A to i16 + %C = or i16 %B, -32574 + %D = and i16 %C, -25350 + %E = zext i16 %D to i32 + ret i32 %E +; CHECK: @test52 +; CHECK-NEXT: %B = trunc i64 %A to i32 +; CHECK-NEXT: %C = or i32 %B, 32962 +; CHECK-NEXT: %D = and i32 %C, 40186 +; CHECK-NEXT: ret i32 %D +} + +define i64 @test53(i32 %A) { + %B = trunc i32 %A to i16 + %C = or i16 %B, -32574 + %D = and i16 %C, -25350 + %E = zext i16 %D to i64 + ret i64 %E +; CHECK: @test53 +; CHECK-NEXT: %B = zext i32 %A to i64 +; CHECK-NEXT: %C = or i64 %B, 32962 +; CHECK-NEXT: %D = and i64 %C, 40186 +; CHECK-NEXT: ret i64 %D +} |