[llvm-commits] [llvm] r123126 - /llvm/trunk/lib/Target/README.txt

Chandler Carruth chandlerc at gmail.com
Sun Jan 9 13:00:19 PST 2011


Author: chandlerc
Date: Sun Jan  9 15:00:19 2011
New Revision: 123126

URL: http://llvm.org/viewvc/llvm-project?rev=123126&view=rev
Log:
Add a note about a missed FP 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=123126&r1=123125&r2=123126&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Sun Jan  9 15:00:19 2011
@@ -2249,3 +2249,27 @@
 a memset.
 
 //===---------------------------------------------------------------------===//
+
+clang -O3 currently compiles this code:
+
+extern const int magic;
+double f() { return 0.0 * magic; }
+
+into
+
+ at magic = external constant i32
+
+define double @_Z1fv() nounwind readnone {
+entry:
+  %tmp = load i32* @magic, align 4, !tbaa !0
+  %conv = sitofp i32 %tmp to double
+  %mul = fmul double %conv, 0.000000e+00
+  ret double %mul
+}
+
+We should be able to fold away this fmul to a constant, there is no 32-bit
+integer which after sitofp will generate a NaN, inf, or -0.0. We should fold
+this whenever the floating point type has enough exponent bits to represent
+the largest integer value as < inf.
+
+//===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list