[llvm-commits] [llvm] r60186 - /llvm/trunk/lib/Target/README.txt
Nick Lewycky
nicholas at mxc.ca
Thu Nov 27 14:12:22 PST 2008
Author: nicholas
Date: Thu Nov 27 16:12:22 2008
New Revision: 60186
URL: http://llvm.org/viewvc/llvm-project?rev=60186&view=rev
Log:
Add a synthetic missed optimization.
Modified:
llvm/trunk/lib/Target/README.txt
Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=60186&r1=60185&r2=60186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Thu Nov 27 16:12:22 2008
@@ -984,3 +984,27 @@
}
//===---------------------------------------------------------------------===//
+
+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
+}
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list