On Mon, Jun 29, 2020 at 02:29:54PM -0700, Carl Love wrote: > Segher: > > On Thu, 2020-06-25 at 17:39 -0500, Segher Boessenkool wrote: > > > +;; Return 1 if op is a constant 32-bit floating point value > > > +(define_predicate "f32bit_const_operand" > > > + (match_code "const_double") > > > +{ > > > + if (GET_MODE (op) == SFmode) > > > + return 1; > > > + > > > + else if ((GET_MODE (op) == DFmode) && ((UINTVAL (op) >> 32) == > > > 0)) > > > + { > > > + /* Value fits in 32-bits */ > > > + return 1; > > > + } > > > + else > > > + /* Not the expected mode. */ > > > + return 0; > > > +}) > > > > I don't think this is the correct test. What you want to see is if > > the > > number in "op" can be converted to an IEEE single-precision number, > > and > > back again, losslessly. (And subnormal SP numbers aren't allowed > > either, but NaNs and infinities are). > > The predicate is used with the xxsplitw_v4sf define_expand. The "user" > claims the given immediate bit pattern is the bit pattern for a single > precision floating point number. The immediate value is not converted > to a float. Rather we are splatting a bit pattern that the "user" > already claims represents a 32-bit floating point value. I just need > to make sure the immediate value actually fits into 32-bits. > > I don't see that I need to check that the value can be converted to > IEEE float and back.
Ah, okay. Can you please put that in the function comment then? Right now it says ;; Return 1 if op is a constant 32-bit floating point value and that is quite misleading. Segher