[PATCH] D22106: [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 16:40:12 PDT 2016
eli.friedman added inline comments.
Comment at: lib/Analysis/ConstantFolding.cpp:1429
@@ -1428,3 @@
- if (status != APFloat::opOK && status != APFloat::opInexact)
- return nullptr;
- return ConstantInt::get(Ty, UIntVal, /*isSigned=*/true);
> eli.friedman wrote:
> > This is supposed to give up if it finds an out-of-range float; does that not work correctly?
> I was being possibly over thorough - there is scope for some very careful constant folding.
> The cvt versions rely on the runtime rounding mode, so constant folding may not match the same result (we could maybe just permit exact conversions?).
> The cvtt versions should work but its not what I saw in some basic tests on godbolt with large values such as FLT_MAX. I'll see if we can improve the existing tests to see what is going on and make a decision on what we can safely support.
Hmm... for the rounding mode, I think we generally take the position that we don't support changing it. I mean, if we did allow that, we couldn't implement addps on top of the LLVM IR fadd. (We might have to revisit this once LLVM gets proper support for rounding modes.)
Exact conversions should be safe either way.
More information about the llvm-commits