This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |

Other format: | [Raw text] |

*From*: Richard Sandiford <richard dot sandiford at arm dot com>*To*: Tejas Joshi <tejasjoshi9673 at gmail dot com>*Cc*: gcc at gcc dot gnu dot org, Martin Jambor <mjambor at suse dot cz>, hubicka at ucw dot cz, segher at kernel dot crashing dot org, joseph at codesourcery dot com*Date*: Sat, 17 Aug 2019 09:21:00 +0100*Subject*: Re: Expansion of narrowing math built-ins into power instructions*References*: <alpine.DEB.2.21.1908122118140.18203@digraph.polyomino.org.uk> <20190812215224.GC31406@gate.crashing.org> <CACMrGjDbF8qyaF8_p5ofOT7gFRqMyOTtzxsKRM3r2aXX+8KS+A@mail.gmail.com> <20190814072127.GE31406@gate.crashing.org> <alpine.DEB.2.21.1908141608430.14831@digraph.polyomino.org.uk> <20190814202102.GI31406@gate.crashing.org> <alpine.DEB.2.21.1908142022330.24610@digraph.polyomino.org.uk> <20190814210015.GJ31406@gate.crashing.org> <CACMrGjCcY_b4zDb2MprOCJa1Z3H-_1SdP+2XkCsf0ckeyY5A9w@mail.gmail.com> <mpta7cah9xo.fsf@arm.com> <20190815184450.GO31406@gate.crashing.org> <mpto90pfly0.fsf@arm.com> <CACMrGjAaLkVuH-exAhoByRUCjGjTtRFDB5EyC-HiphfVWEaYCw@mail.gmail.com>

Tejas Joshi <tejasjoshi9673@gmail.com> writes: > Hi, > >> It's just a different name, nothing more, nothing less. Because it is >> a different name it can not be accidentally generated from actual >> truncations. > > I have introduced float_narrow but I could not find appropriate places > to generate it for a call to fadd instead it to generate a CALL. I > used GDB to set breakpoints which hit fold_rtx and cse_insn but I got > confused with the rtx codes and passes which generate respective RTL. > It should not be similar to FLOAT_TRUNCATE if we want to avoid it > generating for actual truncations? Please don't do it this way. The whole point of the work is that this is a single operation that cannot be modelled as a post-processing of a normal double addition result. It's a single operation at the source level, a single IFN, a single optab, and a single instruction. Splitting it apart into two operations for rtl only, and making it look in rtl terms like a post-processing of a normal addition result, seems like it's going to come back to bite us. In lisp terms we're saying that the operand to the float_narrow is implicitly quoted: (float_narrow:m '(plus:n a b)) so that when float_narrow is evaluated, the argument is the unevaluated rtl expression "(plus a b)" rather than the evaluated result a + b. float_narrow then does its own evaluation of a and b and performs a fused addition and narrowing on the result. No other rtx rvalue works like this. rtx nappings like simplification or evaluation are normally depth-first, so that the mapping is applied to the operands first, and then the root is mapped/simplified/evaluated with the results. Adding implicit lisp quoting would require special cases in these routines for float_narrow. The only current analogue I can think of for this is the handling of zero_extend on const_ints. Because const_ints are modeless, we have to avoid cases in which the recursion produces things like: (zero_extend:m (const_int -1)) because it's no longer clear what mode the zero_extend is extending from. But I think that's seen as a wart of having modeless const_ints. I don't think it's something we should actively embrace by adding float_narrow. Using float_narrow would also be inconsistent with the way we handle saturating arithmetic. There we use US_PLUS and SS_PLUS rtx codes for unsigned and signed saturating plus respectively, rather than: (unsigned_sat '(plus a b)) (signed_sat '(plus a b)) Using dedicated codes might seem clunky. But it's simple, safe, and fits the existing model without special cases. :-) Thanks, Richard > > Thanks, > Tejas > > > On Fri, 16 Aug 2019 at 15:53, Richard Sandiford > <richard.sandiford@arm.com> wrote: >> >> Segher Boessenkool <segher@kernel.crashing.org> writes: >> > On Thu, Aug 15, 2019 at 01:47:47PM +0100, Richard Sandiford wrote: >> >> Tejas Joshi <tejasjoshi9673@gmail.com> writes: >> >> > Hello. >> >> > I just wanted to make sure that I am looking at the correct code here. >> >> > Except for rtl.def where I should be introducing something like >> >> > float_contract (or float_narrow?) and also simplify-rtx.c, breakpoints >> > >> > I like that "float_narrow" name :-) >> > >> >> > set on functions around expr.c, cfgexpand.c where I grep for >> >> > float_truncate/FLOAT_TRUNCATE did not hit. >> >> > Also, in what manner should float_contract/narrow be different from >> >> > float_truncate as both are trying to do similar things? (truncation >> >> > from DF to SF) >> >> >> >> I think the code should instead be a fused addition and truncation, >> >> a bit like FMA is a fused addition and multiplication. Describing it as >> >> a DFmode addition followed by some conversion to SF would still involve >> >> double rounding. >> > >> > How so? It would *mean* there is only single rounding, even! That's >> > the whole point of it. >> >> But a PLUS should behave as a PLUS in any context. Making its >> behaviour dependent on the containing rtxes (if any) would be a >> can of worms. >> >> Richard

**Follow-Ups**:**Re: Expansion of narrowing math built-ins into power instructions***From:*Tejas Joshi

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**References**:**Re: Expansion of narrowing math built-ins into power instructions***From:*Joseph Myers

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**Re: Expansion of narrowing math built-ins into power instructions***From:*Tejas Joshi

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**Re: Expansion of narrowing math built-ins into power instructions***From:*Joseph Myers

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**Re: Expansion of narrowing math built-ins into power instructions***From:*Joseph Myers

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**Re: Expansion of narrowing math built-ins into power instructions***From:*Tejas Joshi

**Re: Expansion of narrowing math built-ins into power instructions***From:*Richard Sandiford

**Re: Expansion of narrowing math built-ins into power instructions***From:*Segher Boessenkool

**Re: Expansion of narrowing math built-ins into power instructions***From:*Richard Sandiford

**Re: Expansion of narrowing math built-ins into power instructions***From:*Tejas Joshi

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |