public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Tejas Joshi <tejasjoshi9673@gmail.com>
Cc: <gcc@gcc.gnu.org>, Martin Jambor <mjambor@suse.cz>, <hubicka@ucw.cz>
Subject: Re: [GSoC-19] Expanding fromfp variants on AArch64
Date: Mon, 19 Aug 2019 14:43:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.21.1908191430540.23785@digraph.polyomino.org.uk> (raw)
In-Reply-To: <CACMrGjBWoU3Ao8sTCiBpNQqGNSO5c6Ezq7goqsGXu-EXiySZzw@mail.gmail.com>

On Mon, 19 Aug 2019, Tejas Joshi wrote:

> How can I add a target hook to specify the FP_INT_* values from libm ?

See target.def.

You'll need a GCC-specific enum (GCC_FP_INT_*, say) that GCC uses 
internally, and a hook that maps between that and FP_INT_*.  I'm guessing 
that for the likely uses, maybe the hook should map from FP_INT_* to 
GCC_FP_INT_* (so it gets used on constant arguments to the built-in 
function to say which rounding direction they are in GCC's internal enum).  
It will need to be able to return that a constant doesn't map to a known 
rounding mode (not an error, just means that call can't be expanded inline 
or optimized to a constant).

Then the relevant macro giving the default for glibc systems should be 
defined in config/gnu-user.h (see how it defines e.g. 
TARGET_LIBC_HAS_FUNCTION).

> Also as this includes rounding to integers, does it involve any RTL
> related complications that we have encountered in FADD ?

The new RTL would effectively be variants of the fix_trunc and 
fixuns_trunc patterns, which can use (fix) and (unsigned_fix) RTL; the new 
variants would take an argument in a floating-point mode, returning one in 
an integer mode - but with extra information involved about the number of 
bits, rounding direction, handling of "inexact".

fix_trunc and fixuns_trunc / (fix) and (unsigned_fix) always use 
FP_INT_TOWARDZERO, always use the width of the mode and have unspecified 
"inexact" handling for non-integer in-range values (they correspond to C 
casts) so are not themselves suitable for implementing the new built-in 
functions (but the particular instructions those patterns expand to are 
likely to be suitable for certain arguments to certain of the new built-in 
functions).

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2019-08-19 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 11:01 Tejas Joshi
2019-08-19 14:43 ` Joseph Myers [this message]

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=alpine.DEB.2.21.1908191430540.23785@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mjambor@suse.cz \
    --cc=tejasjoshi9673@gmail.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).