summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-06-12 05:54:27 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-06-12 05:54:27 +0000
commit8c47d3b73f43edcbca7434772d18b10079cc3810 (patch)
tree33bbba0a95391871a4d8af287c252f2ee0594df0 /lib/Target/README.txt
parent2dcf6d60196701be044299baf58727d2c33d95b8 (diff)
downloadllvm-8c47d3b73f43edcbca7434772d18b10079cc3810.tar.gz
llvm-8c47d3b73f43edcbca7434772d18b10079cc3810.tar.bz2
llvm-8c47d3b73f43edcbca7434772d18b10079cc3810.tar.xz
Add README entry; based on testcase from Bill Hart.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 7fa73edaef..f4f767aa4d 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -1863,3 +1863,47 @@ LLVM prefers comparisons with zero over non-zero in general, but in this
case it choses instead to keep the max operation obvious.
//===---------------------------------------------------------------------===//
+
+Take the following testcase on x86-64 (similar testcases exist for all targets
+with addc/adde):
+
+define void @a(i64* nocapture %s, i64* nocapture %t, i64 %a, i64 %b,
+i64 %c) nounwind {
+entry:
+ %0 = zext i64 %a to i128 ; <i128> [#uses=1]
+ %1 = zext i64 %b to i128 ; <i128> [#uses=1]
+ %2 = add i128 %1, %0 ; <i128> [#uses=2]
+ %3 = zext i64 %c to i128 ; <i128> [#uses=1]
+ %4 = shl i128 %3, 64 ; <i128> [#uses=1]
+ %5 = add i128 %4, %2 ; <i128> [#uses=1]
+ %6 = lshr i128 %5, 64 ; <i128> [#uses=1]
+ %7 = trunc i128 %6 to i64 ; <i64> [#uses=1]
+ store i64 %7, i64* %s, align 8
+ %8 = trunc i128 %2 to i64 ; <i64> [#uses=1]
+ store i64 %8, i64* %t, align 8
+ ret void
+}
+
+Generated code:
+ addq %rcx, %rdx
+ movl $0, %eax
+ adcq $0, %rax
+ addq %r8, %rax
+ movq %rax, (%rdi)
+ movq %rdx, (%rsi)
+ ret
+
+Expected code:
+ addq %rcx, %rdx
+ adcq $0, %r8
+ movq %r8, (%rdi)
+ movq %rdx, (%rsi)
+ ret
+
+The generated SelectionDAG has an ADD of an ADDE, where both operands of the
+ADDE are zero. Replacing one of the operands of the ADDE with the other operand
+of the ADD, and replacing the ADD with the ADDE, should give the desired result.
+
+(That said, we are doing a lot better than gcc on this testcase. :) )
+
+//===---------------------------------------------------------------------===//