[PATCH] [ARM] generate VMAXNM/VMINNM for a compare followed by a select (in safe math mode too)

Renato Golin renato.golin at linaro.org
Tue May 5 11:10:13 PDT 2015


On 30 April 2015 at 10:56, Artyom Skrobov <Artyom.Skrobov at arm.com> wrote:
> // FIXME: There are more cases that can be transformed even with NaNs,
> // signed zeroes and safe math.  E.g. in the following, the result will be
> // FalseVal if a is a NaN or -0./0. and that's what vmaxnm will give, too.
> //   c = fcmp ogt, a, 0. ; select c, a, 0. => vmaxnm a, 0.

Artyom,

In your comment, you say:

+        // Note: If one of the elements in a pair is a number and the other
+        // element is NaN, the corresponding result element is the number.

But my ARM ARM (v7A & v8), in VMAX/VMIN says:

Floating-point maximum and minimum
• max(+0.0, –0.0) = +0.0
• min(+0.0, –0.0) = –0.0
• If any input is a NaN, the corresponding result element is the default NaN.

These two statements seem to be disagreeing. Am I missing something?

Also, your patch is quite dense, as there's a lot of switch
fall-throughs and flag switching. Have you tested the edge cases of
the transformation, or at least built a table with the possibilities
for the branch combinations?

cheers,
--renato




More information about the llvm-commits mailing list