public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: "陈 小龙" <chenxl04200420@outlook.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "i@xen0n.name" <i@xen0n.name>,
	"xuchenghua@loongson.cn" <xuchenghua@loongson.cn>,
	"chenglulu@loongson.cn" <chenglulu@loongson.cn>
Subject: Re: Implement a build-in function with floating point exceptions.
Date: Tue, 29 Nov 2022 22:19:45 +0800	[thread overview]
Message-ID: <f957dbf6f94cd553478baaa1ad6066b67c71c7a6.camel@xry111.site> (raw)
In-Reply-To: <SG2PR06MB2697E3105BBA8B4DF5558647C8129@SG2PR06MB2697.apcprd06.prod.outlook.com>

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

           reply	other threads:[~2022-11-29 14:20 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <SG2PR06MB2697E3105BBA8B4DF5558647C8129@SG2PR06MB2697.apcprd06.prod.outlook.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f957dbf6f94cd553478baaa1ad6066b67c71c7a6.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenglulu@loongson.cn \
    --cc=chenxl04200420@outlook.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=i@xen0n.name \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).