From: Sudakshina Das <Sudi.Das@arm.com>
To: "sgk@troutmask.apl.washington.edu"
<sgk@troutmask.apl.washington.edu>,
Joseph Myers <joseph@codesourcery.com>
Cc: Janne Blomqvist <blomqvist.janne@gmail.com>,
Fortran List <fortran@gcc.gnu.org>,
GCC Patches <gcc-patches@gcc.gnu.org>, nd <nd@arm.com>
Subject: Re: [PATCH] fortran/69121 -- Make IEEE_SCALB generic
Date: Mon, 24 Dec 2018 14:14:00 -0000 [thread overview]
Message-ID: <afced6e6-76ce-6aa2-b741-96a8249e51fb@arm.com> (raw)
In-Reply-To: <20181221200115.GA16212@troutmask.apl.washington.edu>
Hi Steve
On 21/12/18 8:01 PM, Steve Kargl wrote:
> On Fri, Dec 21, 2018 at 07:39:45PM +0000, Joseph Myers wrote:
>> On Fri, 21 Dec 2018, Steve Kargl wrote:
>>
>>> scalbln(double x, long n)
>>> {
>>>
>>> return (scalbn(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
>>> }
>>>
>>> A search for glibc's libm locateshttps://tinyurl.com/ybcy8w4t
>>> which is a bit-twiddling routine. Not sure it's worth the
>>> effort. Joseph Myers might have an opinion.
>> Such comparisons are needed in the scalbn / scalbln implementations anyway
>> to deal with large exponents. I suppose where there's a suitable scalbln
>> implementation, and you don't know if the arguments are within the range
>> of int, calling scalbln at least saves code size in the caller and avoids
>> duplicating those range checks.
>>
> I was thinking along the lines of -ffast-math and whether
> __builtin_scalbn and __builtin_scalbln are then inlined.
> The comparisons may inhibit inlining __builtin_scalbn;
> while, if gfortran used __builtin_scalbln, inlining would
> occur.
>
> As it is, for
>
> function foo(x,i)
> use ieee_arithmetic
> real(8) foo, c
> integer(8) i
> foo = ieee_scalb(c, i)
> end function foo
>
> the options -ffast-math -O3 -fdump-tree-optimized give
>
> <bb 2> [local count: 1073741824]:
> _gfortran_ieee_procedure_entry (&fpstate.0);
> _8 = *i_7(D);
> _1 = MIN_EXPR <_8, 2147483647>;
> _2 = MAX_EXPR <_1, -2147483647>;
> _3 = (integer(kind=4)) _2;
> _4 = __builtin_scalbn (c_9(D), _3);
> _gfortran_ieee_procedure_exit (&fpstate.0);
> fpstate.0 ={v} {CLOBBER};
> return _4;
>
> It seems this could be
>
> <bb 2> [local count: 1073741824]:
> _gfortran_ieee_procedure_entry (&fpstate.0);
> _3 = (integer(kind=4)) *i_7(D);
> _4 = __builtin_scalbn (c_9(D), _3
> _gfortran_ieee_procedure_exit (&fpstate.0);
> fpstate.0 ={v} {CLOBBER};
>
I am observing your new test pr88328.f90 failing on
arm-none-linux-gnueabihf:
Excess errors:
/build/src/gcc/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90:20:36: Error:
Invalid kind for REAL at (1)
/build/src/gcc/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90:35:36: Error:
Invalid kind for REAL at (1)
/build/src/gcc/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90:50:36: Error:
Invalid kind for REAL at (1)
/build/src/gcc/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90:65:36: Error:
Invalid kind for REAL at (1)
next prev parent reply other threads:[~2018-12-24 12:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-20 21:53 Steve Kargl
2018-12-21 6:46 ` Steve Kargl
2018-12-21 9:08 ` Janne Blomqvist
2018-12-21 15:55 ` Steve Kargl
2018-12-21 17:35 ` Thomas Koenig
2018-12-21 18:57 ` Steve Kargl
2018-12-21 17:59 ` Steve Kargl
2018-12-21 19:11 ` Janne Blomqvist
2018-12-21 19:33 ` Steve Kargl
2018-12-21 20:01 ` Joseph Myers
2018-12-21 20:29 ` Steve Kargl
2018-12-24 14:14 ` Sudakshina Das [this message]
2018-12-24 18:05 ` Steve Kargl
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=afced6e6-76ce-6aa2-b741-96a8249e51fb@arm.com \
--to=sudi.das@arm.com \
--cc=blomqvist.janne@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.com \
--cc=nd@arm.com \
--cc=sgk@troutmask.apl.washington.edu \
/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).