[PATCH] D120452: [AArch64] Use simd mov to initialise big const float immediate

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 11:02:40 PST 2022


dmgreen added a comment.

Using the MOVI to materialize fp constants sounds like a good idea.

But I don't think this should be starting from a CopyToReg. CopyToReg usually means we are copying the result into the return value of a function (or into a call argument). Copying into s0 for example. CopyFromReg is used to get the value from input physical registers from arguments.

An example like this, with fadd, would preferably use the movi lowering too: https://godbolt.org/z/bc99E85qz

If the FPConstant is still in the DAG at the point that we run instruction selection (I think it should be but it may be dependant on what AArch64TargetLowering::isFPImmLegal returns), then it may be best to add a tablegen pattern for cases that we can materialize with the integer movi instruction. >From here: https://github.com/llvm/llvm-project/blob/ecff9b65b54c7a4bd79ca2af157c81595678f0ee/llvm/lib/Target/AArch64/AArch64InstrInfo.td#L1545, with a different fpimm to limit it to cases where the MOVi can be generated, and an EXTRACT_SUBREG to get the s reg.  If that doesn't work (the custom ImmLeaf's might be a bit much) then perhaps something in AArch64ISelDAGToDAG.cpp?


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

https://reviews.llvm.org/D120452



More information about the llvm-commits mailing list