[llvm] [LoongArch] Fix fp_to_uint/fp_to_sint conversion errors for lasx (PR #137129)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 01:08:14 PDT 2025
================
@@ -31,9 +31,9 @@ define void @fptosi_v4f64_v4i32(ptr %res, ptr %in){
; CHECK-LABEL: fptosi_v4f64_v4i32:
; CHECK: # %bb.0:
; CHECK-NEXT: xvld $xr0, $a1, 0
+; CHECK-NEXT: xvftintrz.l.d $xr0, $xr0
; CHECK-NEXT: xvpermi.d $xr1, $xr0, 238
-; CHECK-NEXT: xvfcvt.s.d $xr0, $xr1, $xr0
-; CHECK-NEXT: xvftintrz.w.s $xr0, $xr0
+; CHECK-NEXT: xvpickev.w $xr0, $xr1, $xr0
; CHECK-NEXT: vst $vr0, $a0, 0
----------------
heiher wrote:
Just to correct my earlier comment - it was inaccurate and has been deleted. :P
According to the LLVM IR [`fptosi`](https://llvm.org/docs/LangRef.html#id275) spec:
> If the value cannot fit in ty2, the result is a poison value.
So unless overflow/invalid recording is required, using `xvftintrz.l.d + xvpickev.w` is also valid, and this sequence may offer better throughput.
https://github.com/llvm/llvm-project/pull/137129
More information about the llvm-commits
mailing list