This is an archive of the discontinued LLVM Phabricator instance.

[X86][AVX512] Lowering _mm512_[max|min]_p[s|d] to native IR
AbandonedPublic

Authored by GBuella on Jun 22 2018, 8:08 AM.

Diff Detail

Event Timeline

GBuella created this revision.Jun 22 2018, 8:08 AM

I haven't used the AVX512 versions, but I do know plenty of cases that rely on the 'use the second op if there is a NAN or both zeros' special cases in the SSE version of these FMIN/FMAX intrinsics.

The Intel docs state:

If the values being compared are both 0.0s (of either sign), the value in the second operand (source operand) is returned. If a value in the second operand is an SNaN, then SNaN is forwarded unchanged to the destination (that is, a QNaN version of the SNaN is not returned).

If only one value is a NaN (SNaN or QNaN) for this instruction, the second operand (source operand), either a NaN or a valid floating-point value, is written to the result. If instead of this behavior, it is required that the NaN source operand (from either the first or second operand) be returned, the action of MAXPS can be emulated using a sequence of instructions, such as, a comparison followed by AND, ANDN and OR.

I haven't used the AVX512 versions, but I do know plenty of cases that rely on the 'use the second op if there is a NAN or both zeros' special cases in the SSE version of these FMIN/FMAX intrinsics.

Yes, this behavior is important for AVX512 as well. Any lowering must preserve the full semantics of the intrinsics.

GBuella abandoned this revision.Jul 5 2018, 2:50 PM