Richard Biener <rguent...@suse.de> writes:
> On Mon, 11 May 2020, Alexander Monakov wrote:
>
>> On Mon, 11 May 2020, Richard Sandiford wrote:
>> 
>> > Like you say, the idea is that since the operation is commutative and
>> > is the same in both vector and scalar form, there's no reason to require
>> > any -ffast-math flags.
>> 
>> Note that PR88540 that Richard is referencing uses open-coded x < y ? x : y
>> (non-commutative) and we want to use SSE minpd even without -ffast-math, as
>> SSE min/max insns match semantics of open-coded ternary operators.
>> 
>> (unlike Arm SIMD, SSE does not have a way to compute fmin/fmax with a
>> single instruction in presence of NaNs)
>
> Indeed.  So it looks like for SSE we eventually want phiopt to generate
> a COND_EXPR here and a new optabs cond_fmin cond_fmax that could be
> used to vectorize this?  cond_fmin and cond_fmax can neither be
> treated as MIN_EXPR or MAX_EXPR nor fmin/fmax since it is not
> commutative.

I know I'm taking the name too literally, but: "cond_foo" in the sense
of "IFN_COND_FOO (cond, ..., fallback)" is always supposed to be the
equivalent of:

  cond ? IFN_FOO (...) : fallback

So cond_fmin would be the conditional form of fmin.

Thanks,
Richard

Reply via email to