On Tue, 2022-11-29 at 09:52 +0000, 陈 小龙 wrote:
> +(define_insn "<float_pattern><mode>2"
> +  [(set (match_operand:ANYF 0 "register_operand" "=f")
> +     (unspec:ANYF[(match_operand:ANYF 1 "register_operand" "f")]
> +             FLOAT))]
> +      "TARGET_HARD_FLOAT&&(flag_fp_int_builtin_inexact ||
> !flag_trapping_math)"
> +     
> "ftint<float_submenmonic>.<wl>.<fmt>\t%0,%1\n\tffint.<fmt>.<wl>\t%0,%0

It's wrong.  For example, consider ceil(0x1.0p+100).  0x1.0p+100 cannot
be represented by any 64-bit integer, so ftintrp.l.d will raise an
overflow exception and provide "some value" as the output.  Then ffint
can't produce the correct result.

Nacked-by: Xi Ruoyao <xry...@xry111.site>

I'd suggest to add frint.{w,l}.{s,d}.{rm,rp,rz} etc. (BTW, also the
variants without raising inexact exceptions) into a future LoongArch ISA
version for this.

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to