[PATCH] D128898: [LoongArch] Add codegen support for handling floating point immediates

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 05:35:51 PDT 2022


xen0n accepted this revision.
xen0n added inline comments.


================
Comment at: llvm/test/CodeGen/LoongArch/double-imm.ll:86
+; LA64-NEXT:    movgr2fr.d $fa0, $a0
+; LA64-NEXT:    ffint.d.l $fa0, $fa0
+; LA64-NEXT:    jirl $zero, $ra, 0
----------------
xry111 wrote:
> I'd suggest:
> 
> ```
> lu52i.d $a0, $zero, 0x3ff
> movgr2fr.d $fa0, $a0
> ```
> 
> to reduce one instruction.  The combination of lu52i.d and movgr2fr.d can always load $2^k$ as a f64 for all integral k in $[0, 1023]$.
> 
> But as it's already approved it can be done in a later revision.
Wow that's some serious simplification. I don't think I've seen anything like this recently. Agreed this optimization is better done in a new patch, as it's more of a peephole kind, not deeply related to the generic handling done here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128898



More information about the llvm-commits mailing list