[PATCH] D107187: [amdgpu] Add an enhanced conversion from i64 to f32.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 11:37:16 PDT 2021


hliao added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp:2530
+    // Count the leading zeros.
+    ShAmt = DAG.getNode(ISD::CTLZ_ZERO_UNDEF, SL, MVT::i32, Hi);
+    ShAmt = DAG.getSelect(SL, MVT::i32,
----------------
arsenm wrote:
> Why is zero undef OK? The high half could be all zeroes
For the all 0 case, the following 'select' will return 32, so that all hi bits are shifted out. In that case, only the low 32 bits need converting.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp:2118-2119
+  auto Scale = B.buildSub(S32, B.buildConstant(S32, 32), ShAmt);
+  SmallVector<Register, 1> Results;
+  Results.push_back(Dst);
+  B.buildIntrinsic(Intrinsic::amdgcn_ldexp, Results, /*HasSideEffects=*/false)
----------------
arsenm wrote:
> You can just do {Dst} directly to the buildInstr call
I remembered I tried that but still cannot compile it. Let me try again


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107187



More information about the llvm-commits mailing list