diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-11 06:55:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-11 06:55:24 +0000 |
commit | 8e76764de86d7906db5123626b65f593e159d9f3 (patch) | |
tree | 2ceb1b4cbdd050c6c96bdb99bf354ca4bff32a09 /test/Transforms | |
parent | 7acc4b12813117774deefb54c5febb49a215aa70 (diff) | |
download | external_llvm-8e76764de86d7906db5123626b65f593e159d9f3.zip external_llvm-8e76764de86d7906db5123626b65f593e159d9f3.tar.gz external_llvm-8e76764de86d7906db5123626b65f593e159d9f3.tar.bz2 |
add one more bitfield optimization, allowing clang to generate
good code on PR4216:
_test_bitfield: ## @test_bitfield
orl $32962, %edi
movl $4294941946, %eax
andq %rdi, %rax
ret
instead of:
_test_bitfield:
movl $4294941696, %ecx
movl %edi, %eax
orl $194, %edi
orl $32768, %eax
andq $250, %rdi
andq %rax, %rcx
movq %rdi, %rax
orq %rcx, %rax
ret
Evan is looking into the remaining andq+imm -> andl optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/or.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll index 822dfb3..2040f3d 100644 --- a/test/Transforms/InstCombine/or.ll +++ b/test/Transforms/InstCombine/or.ll @@ -320,3 +320,19 @@ entry: ; CHECK: %E = and i32 %B, -25350 ; CHECK: ret i32 %E } + +; PR4216 +define i64 @test31(i64 %A) nounwind readnone ssp noredzone { + %B = or i64 %A, 194 + %D = and i64 %B, 250 + + %C = or i64 %A, 32768 + %E = and i64 %C, 4294941696 + + %F = or i64 %D, %E + ret i64 %F +; CHECK: @test31 +; CHECK-NEXT: %bitfield = or i64 %A, 32962 +; CHECK-NEXT: %F = and i64 %bitfield, 4294941946 +; CHECK-NEXT: ret i64 %F +} |