Add a note about a missed FP optimization.
authorChandler Carruth <chandlerc@gmail.com>
Sun, 9 Jan 2011 21:00:19 +0000 (21:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 9 Jan 2011 21:00:19 +0000 (21:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123126 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/README.txt

index 9ecd2ffc199c2fa4b93cdcb601d9433e17c2a35e..a9afffd95aead58365e92204e4fa31a8ff821457 100644 (file)
@@ -2249,3 +2249,27 @@ S is only 6 bytes, but each element is 8 byte-aligned. We generate a loop and
 a memset.
 
 //===---------------------------------------------------------------------===//
+
+clang -O3 currently compiles this code:
+
+extern const int magic;
+double f() { return 0.0 * magic; }
+
+into
+
+@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.
+
+//===---------------------------------------------------------------------===//