[PATCH] D108871: [AArch64] Implement target hook function to decide folding (mul (add x, c1), c2)

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 02:23:22 PDT 2021


benshi001 added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:12152
+// Return true if Imm can be composed by a single MOVZ instruction.
+static inline bool isMOVZImm(uint64_t Imm, unsigned Sz) {
+  assert((Sz == 64) || (Sz == 32) && "invalid immediate size");
----------------
benshi001 wrote:
> dmgreen wrote:
> > Can this use AArch64TTIImpl::getIntImmCost in some way?
> I think it is hard. Since the  API
> 
> ```
> TargetTransformInfo
> AArch64TargetMachine::getTargetTransformInfo(const Function &F) {
>   return TargetTransformInfo(AArch64TTIImpl(this, F));
> }
> ```
> 
> requires a `Function` object, but the target hook has only two `SDValue` parameters.
> 
> So the cheapest way is implementing a new but short `isMOVZImm` helper function.
I have simplified it to one additional helper function.


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

https://reviews.llvm.org/D108871



More information about the llvm-commits mailing list