diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-01-09 21:00:19 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-01-09 21:00:19 +0000 |
commit | 96b1b6c1356a70f99e133331c470ba7caf48de21 (patch) | |
tree | c49c78b439ae4d9644b8cedf294035522f66b368 /lib/Target/README.txt | |
parent | 43a566519b85ddffa482695d6a5a3dc4a02e267f (diff) | |
download | llvm-96b1b6c1356a70f99e133331c470ba7caf48de21.tar.gz llvm-96b1b6c1356a70f99e133331c470ba7caf48de21.tar.bz2 llvm-96b1b6c1356a70f99e133331c470ba7caf48de21.tar.xz |
Add a note about a missed FP optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r-- | lib/Target/README.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt index 9ecd2ffc19..a9afffd95a 100644 --- a/lib/Target/README.txt +++ b/lib/Target/README.txt @@ -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. + +//===---------------------------------------------------------------------===// |