This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add _Float<N>/_Float<N>X rounding built-ins & improve gimple optimization of _Float<N>/_Float<N>X built-in functions
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Thu, 21 Dec 2017 13:03:26 -0600
- Subject: Re: [PATCH] Add _Float<N>/_Float<N>X rounding built-ins & improve gimple optimization of _Float<N>/_Float<N>X built-in functions
- Authentication-results: sourceware.org; auth=none
- References: <20171117050445.GA13927@ibm-tiger.the-meissners.org> <20171117140608.GV10515@gate.crashing.org> <20171118003505.GA20542@ibm-tiger.the-meissners.org> <alpine.DEB.2.20.1712211803350.16276@digraph.polyomino.org.uk>
On Thu, Dec 21, 2017 at 06:16:16PM +0000, Joseph Myers wrote:
> On Fri, 17 Nov 2017, Michael Meissner wrote:
> The architecture-independent changes are OK. However, I have a comment on
> the target parts:
>
> > +(define_insn "round<mode>2"
> > + [(set (match_operand:IEEE128 0 "altivec_register_operand" "=v")
> > + (unspec:IEEE128
> > + [(match_operand:IEEE128 1 "altivec_register_operand" "v")]
> > + UNSPEC_FRIN))]
> > + "TARGET_FLOAT128_HW && FLOAT128_IEEE_P (<MODE>mode)"
> > + "xsrqpi 0,%0,%1,3"
> > + [(set_attr "type" "vecfloat")
> > + (set_attr "size" "128")])
>
> My reading of Power ISA 3.0B documentation is that 0,%0,%1,3 means round
> in the mode specified by FPSCR and you need 0,%0,%1,0 for
> round-to-nearest-away semantics which are what the round<mode>2
> instruction has (i.e., what you've written here is actually correct for
> nearbyint<mode>2, and would be rint<mode>2 if xsrqpix were used instead).
Ah yes, the roundM2 insn is round-away-from-zero, so you are right.
Tricky, from the name I assumed it would be "current rounding mode" :-/
Not that "frin" would make sense if that were true.
Thanks! And thanks for all the reviews in general.
Segher