[PATCH] D22106: [X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 16:07:51 PDT 2016

RKSimon 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.



More information about the llvm-commits mailing list