public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Raoni Fassina Firmino <raoni@linux.ibm.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Bill Schmidt <wschmidt@linux.ibm.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	rguenther@suse.de, law@redhat.com, gcc-patches@gcc.gnu.org,
	joseph@codesourcery.com
Subject: Re: [PATCH v9] rtl: builtins: (not just) rs6000: Add builtins for fegetround, feclearexcept and feraiseexcept [PR94193]
Date: Tue, 25 Jan 2022 13:28:29 -0300	[thread overview]
Message-ID: <20220125162829.htswbt4eqiffcwqz@workbox> (raw)
In-Reply-To: <20220124223547.GC2646553@tucnak>

On Mon, Jan 24, 2022 at 11:35:47PM +0100, AL gcc-patches wrote:
> On Mon, Jan 24, 2022 at 06:24:11PM -0300, Raoni Fassina Firmino wrote:
> > On Mon, Jan 24, 2022 at 02:29:39PM -0600, Bill Schmidt wrote:
> > > Adding the patch author for his information.
> > 
> > Thanks Bill.
> > 
> > > On 1/24/22 2:26 PM, Jakub Jelinek via Gcc-patches wrote:
> > > > expand_builtin_feclear_feraise_except doesn't check if op0 matches
> > > > the predicate of operands[1], the backend requires const_int_operand,

Below is a patch to do just that. In preliminary tests it seems to work.
What do you think aboud it Jakub?

> > > > but because the call isn't done with a constant integer:
> > > > feraiseexcept (t == LLONG_MIN ? FE_INEXACT : FE_INVALID);
> > > > op0 is a REG.
> > > > If CONST_INT is what is expected on all targets, then it should punt if
> > > > op0 isn't one, otherwise it should the predicate.
> > 
> > My expectation was for backend expanders to be free to choose when they
> > expand, to be able to fail and cleanly fallback to libc call, and not
> > enforce one specific constrains to all targets.
> > 
> > I will look into it ASAP and see what can be done.
> > Thanks for the feedback.
> 
> These days the usual way of doing this is through
> maybe_expand_insn and create_{output,input}_operand before that.

I looked into maybe_expand_insn, if I undestood correctly in my reading
of maybe_expand_insn I could remove mostly if not all code in
expand_builtin_feclear_feraise_except with it, even the validate_arglist
part in the beginning?

o/
Raoni

---
 gcc/builtins.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index e84208035dab..88e689993563 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -2598,6 +2598,9 @@ expand_builtin_feclear_feraise_except (tree exp, rtx target,
   if (icode == CODE_FOR_nothing)
     return NULL_RTX;
 
+  if (!(*insn_data[icode].operand[1].predicate) (op0, GET_MODE(op0)))
+    return NULL_RTX;
+
   if (target == 0
       || GET_MODE (target) != target_mode
       || !(*insn_data[icode].operand[0].predicate) (target, target_mode))
-- 
2.34.1


  reply	other threads:[~2022-01-25 16:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 17:08 Raoni Fassina Firmino
2022-01-24 14:55 ` Segher Boessenkool
2022-01-24 20:26   ` Jakub Jelinek
2022-01-24 20:29     ` Bill Schmidt
2022-01-24 21:24       ` Raoni Fassina Firmino
2022-01-24 22:35         ` Jakub Jelinek
2022-01-25 16:28           ` Raoni Fassina Firmino [this message]
2022-01-25 18:52             ` Jakub Jelinek

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=20220125162829.htswbt4eqiffcwqz@workbox \
    --to=raoni@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=law@redhat.com \
    --cc=rguenther@suse.de \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.com \
    /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).