public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Implement a build-in function with floating point exceptions.
       [not found] <SG2PR06MB2697E3105BBA8B4DF5558647C8129@SG2PR06MB2697.apcprd06.prod.outlook.com>
@ 2022-11-29 14:19 ` Xi Ruoyao
  0 siblings, 0 replies; only message in thread
From: Xi Ruoyao @ 2022-11-29 14:19 UTC (permalink / raw)
  To: 陈 小龙, gcc-patches; +Cc: i, xuchenghua, chenglulu

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 <xry111@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 <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-29 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <SG2PR06MB2697E3105BBA8B4DF5558647C8129@SG2PR06MB2697.apcprd06.prod.outlook.com>
2022-11-29 14:19 ` Implement a build-in function with floating point exceptions Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).