[PATCH] D76180: AMDGPU/GlobalISel: Legalize 64-bit G_UDIV/G_UREM

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 02:39:01 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2535-2536
+// Return lo, hi
+static std::pair<Register, Register> emitReciprocalU64(MachineIRBuilder &B,
+                                                       Register Val) {
+  const LLT S32 = LLT::scalar(32);
----------------
Can we have some more comments, or one big comment at the top, showing the calculation that this function builds?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2548
+  auto Mul1 =
+      B.buildFMul(S32, Rcp, B.buildFConstant(S32, BitsToFloat(0x5f7ffffc)));
+
----------------
What is this constant?


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2555
+
+  // -(2**32)
+  auto Mad2 = B.buildFMAD(S32, Trunc,
----------------
No, it's -(2**-32).


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

https://reviews.llvm.org/D76180





More information about the llvm-commits mailing list