[PATCH] D72262: AMDGPU/GlobalISel: Handle s64->s64 G_FPTOSI/G_FPTOUI

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 01:35:57 PST 2020


nhaehnle added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:1500-1511
+  auto Trunc = B.buildIntrinsicTrunc(S64, Src, Flags);
+  auto K0 = B.buildFConstant(S64, BitsToDouble(UINT64_C(0x3df0000000000000)));
+  auto K1 = B.buildFConstant(S64, BitsToDouble(UINT64_C(0xc1f0000000000000)));
+
+  auto Mul = B.buildFMul(S64, Trunc, K0, Flags);
+  auto FloorMul = B.buildFFloor(S64, Mul, Flags);
+  auto Fma = B.buildFMA(S64, FloorMul, K1, Trunc, Flags);
----------------
Could you please add the intended high-level logic here in a comment?

I admittedly haven't thought this through fully, but I find this code suspicious: doubles have more than twice the mantissa bits of floats, so I don't think two single-precision fptouis can be sufficient to capture all the precision that is there.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72262/new/

https://reviews.llvm.org/D72262





More information about the llvm-commits mailing list