diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-12-20 01:37:09 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-12-20 01:37:09 +0000 |
| commit | 5c00d41688aabf6c1c9a6bc4f008019d8301fe1f (patch) | |
| tree | 10edac18ae27cf142dc0a12a816b7a9663fab81f /llvm/test/CodeGen | |
| parent | fc0c6b1ea9841341d159f9a7ef62c5047c91c2cc (diff) | |
| download | bcm5719-llvm-5c00d41688aabf6c1c9a6bc4f008019d8301fe1f.tar.gz bcm5719-llvm-5c00d41688aabf6c1c9a6bc4f008019d8301fe1f.zip | |
now that addc/adde are gone, "ADDC" in the X86 backend uses EFLAGS results,
the same as setcc. Optimize ADDC(0,0,FLAGS) -> SET_CARRY(FLAGS). This is
a step towards finishing off PR5443. In the testcase in that bug we now get:
movq %rdi, %rax
addq %rsi, %rax
sbbq %rcx, %rcx
testb $1, %cl
setne %dl
ret
instead of:
movq %rdi, %rax
addq %rsi, %rax
movl $0, %ecx
adcq $0, %rcx
testq %rcx, %rcx
setne %dl
ret
llvm-svn: 122219
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/X86/add.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/add.ll b/llvm/test/CodeGen/X86/add.ll index 1201c06fcce..d6e99ee1a7e 100644 --- a/llvm/test/CodeGen/X86/add.ll +++ b/llvm/test/CodeGen/X86/add.ll @@ -101,3 +101,22 @@ define {i32, i1} @test7(i32 %v1, i32 %v2) nounwind { ; X64: addl %esi, %eax ; X64-NEXT: setb %dl ; X64-NEXT: ret + +; PR5443 +define {i64, i1} @test8(i64 %left, i64 %right) nounwind { +entry: + %extleft = zext i64 %left to i65 + %extright = zext i64 %right to i65 + %sum = add i65 %extleft, %extright + %res.0 = trunc i65 %sum to i64 + %overflow = and i65 %sum, -18446744073709551616 + %res.1 = icmp ne i65 %overflow, 0 + %final0 = insertvalue {i64, i1} undef, i64 %res.0, 0 + %final1 = insertvalue {i64, i1} %final0, i1 %res.1, 1 + ret {i64, i1} %final1 +} + +; X64: test8: +; X64: addq +; X64-NEXT: sbbq +; X64-NEXT: testb |

