[PATCH] D136916: [LoongArch] Fix codegen for [su]itofp instructions

wanglei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 20:16:16 PDT 2022


wangleiat added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchFloat32InstrInfo.td:290
+// uint -> f32
+def : Pat<(f32 (uint_to_fp (i64 (sexti32 (i64 GPR:$src))))),
+          (FFINT_S_W (MOVGR2FR_W GPR:$src))>;
----------------
wangleiat wrote:
> xen0n wrote:
> > `sexti32` for `uint`? (I might be sleepy so this might not be wrong after all.) The codegen in the touched test cases look good though, this is a bit weird.
> > `sexti32` for `uint`? (I might be sleepy so this might not be wrong after all.) The codegen in the touched test cases look good though, this is a bit weird.
> 
> `sexti32` means, can we treat the current node as a signed number.
> > `sexti32` for `uint`? (I might be sleepy so this might not be wrong after all.) The codegen in the touched test cases look good though, this is a bit weird.
> 
> `sexti32` means, can we treat the current node as a signed number.

In fact, this matching rule only appears when `loongarch64 +f -d`, but I don't want to add the corresponding `hasNoBasicD()` feature, and the corresponding legality judgment has been made in the lowering stage. (In theory, this constraint can be removed.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136916



More information about the llvm-commits mailing list