aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-11-27 22:12:22 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-11-27 22:12:22 +0000
commitdf563ca1f33a47b6e51f72c9bff2a88f27aa7c8a (patch)
treebff73e717abe24589815c6aba28dd97888b6c7ab
parent895f085385ab94876a6ebe34909a3f6ecad384aa (diff)
Add a synthetic missed optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60186 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/README.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index c4161c36c3..f6f24eb676 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -984,3 +984,27 @@ define i1 @test(i8 %x) {
}
//===---------------------------------------------------------------------===//
+
+These three functions all perform the same computation, but produce different
+assembly. On x86, they are sorted from slowest to fastest.
+
+define i8 @udiv(i8 %x) readnone nounwind {
+ %A = udiv i8 %x, 250
+ ret i8 %A
+}
+
+define i8 @select(i8 %x) readnone nounwind {
+ %A = icmp ult i8 %x, 250
+ %B = select i1 %A, i8 0, i8 1
+ ret i8 %B
+}
+
+define i8 @addshr(i8 %x) readnone nounwind {
+ %A = zext i8 %x to i9
+ %B = add i9 %A, 6 ;; 256 - 250 == 6
+ %C = lshr i9 %B, 8
+ %D = trunc i9 %C to i8
+ ret i8 %D
+}
+
+//===---------------------------------------------------------------------===//