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

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 05:51:53 PDT 2022


SixWeining 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
----------------
xen0n wrote:
> 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.
Quite nice. Thanks for the suggestion. Let’s implement it in later patch. :)


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