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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 05:50:04 PST 2020


arsenm marked an inline comment as done.
arsenm 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);
----------------
nhaehnle wrote:
> 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.
That would require me to have any idea what the high level logic is here. This is just copied from the existing legalization, which has no comments


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

https://reviews.llvm.org/D72262





More information about the llvm-commits mailing list