[PATCH] D58460: [AArch64] Optimize floating point materialization

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 26 10:52:40 PST 2019


zatrazz added inline comments.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:5394
+  unsigned LZ = countLeadingZeros((uint64_t)Val);
+  return (RegSize - LZ + 15) / 16;
+}
----------------
efriedma wrote:
> Please don't copy-paste code.  And this is a very inaccurate approximation for the logic in AArch64ExpandPseudo::expandMOVImm.
Ack, I changed it on next revision to use the same ideas AArch64ExpandPseudo::expandMOVIm. It required to consolidate some common code.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:5400
+// pressure. The timings are still the same if you consider movw+movk+fmov
+// vs. adrp+ldr (it's one instruction longer, but the movw+movk is fused).
 bool AArch64TargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT) const {
----------------
efriedma wrote:
> Not sure this comment should be here; should be next to the code that actually makes this decision.
Ack, I moved to the code that actually uses it.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:5424
+    // at maximum of 2 moves to match and adrl+ldr cost.
+    IsLegal = getIntImmCost(ImmInt.getZExtValue(), VT.getSizeInBits()) <= 2;
 
----------------
efriedma wrote:
> Does it matter whether we're optimizing for size?
I intend to send another patch to add the optimization for size information on isFPImmLegal, since it requires some refactoring in various backends.


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

https://reviews.llvm.org/D58460





More information about the llvm-commits mailing list