[PATCH] D31182: [InstCombine] fadd double (sitofp x), y check that the promotion is valid

Steve Canon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 09:31:31 PDT 2017


scanon added a comment.

> The assumption is that an integer add is more canonical and/or cheaper than an FP add. Is that universally true?

No. There exist GPU architectures where a 32b integer addition is a more expensive operation than a 32b FP add.



================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1401
+    // integer addition? semanticsPrecision returns the number of mantissa
+    // bits plus one for the sign bit.
+    unsigned MaxRepresentableBits
----------------
s/mantissa/significand/ (https://en.wikipedia.org/wiki/Significand#Use_of_.22mantissa.22)

Also, `semanticsPrecision` returns the number of bits in the significand (which includes the implicit "integral" bit when present). There's no "plus one for the sign bit".


https://reviews.llvm.org/D31182





More information about the llvm-commits mailing list