On Wed, Jun 26, 2019 at 05:45:48PM +0100, Richard Sandiford wrote:
> "Obviously" correct seems a stretch :-)  We can only fold:
> 
>   (subreg:V2DF (foo:V2DI X) 0)
> 
> to:
> 
>   (foo:V2DF X)
> 
> for certain operations.
> 
> E.g. it'd be wrong to do it for foo=plus.

You would need to change X then, sure, so you cannot get that by doing a
simple substitution.  But this is lt, and it makes (structurally) perfect
sense here, the mode of lt does not depend on the mode of its args.  The
target should refuse it if it doesn't like it.  Simply by not having too
lenient patterns in the machine descriptions, probably.

> IMO it's wrong for comparisons too.  A comparison between integers
> that produces a floating-point result makes no sense, whatever the
> target thinks about it.

Then the target should not say it makes sense?

> >> Is the above folding correct, since lt has V2DF mode,
> >> and casting -1 (literally) to DFmode would result in -NaN ?
> >
> > Combine does not introduce any of that, it was there already.
> 
> The original insns had an lt:V2DI between V2DI inputs and a V2DF
> subreg of the result.  It's combine that turns that into a lt:V2DF
> between V2DI inputs.

Combine did only simple substitution as far as I can see.


Segher

Reply via email to