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 | 0c68a668fa932bba86acef929c6b388bca239a4b (patch) | |
tree | 127d24eb5d150cc971359a1004526bd6d1053059 /llvm/lib/Target/README.txt | |
parent | 8145f85633f963078af2424c7aa5deaca53f7430 (diff) | |
download | bcm5719-llvm-0c68a668fa932bba86acef929c6b388bca239a4b.tar.gz bcm5719-llvm-0c68a668fa932bba86acef929c6b388bca239a4b.zip |
Add a note about a missed FP optimization.
llvm-svn: 123126
Diffstat (limited to 'llvm/lib/Target/README.txt')
-rw-r--r-- | llvm/lib/Target/README.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt index 9ecd2ffc199..a9afffd95ae 100644 --- a/llvm/lib/Target/README.txt +++ b/llvm/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. + +//===---------------------------------------------------------------------===// |