SSE min/max take2 - documentation
Geert Bosch
bosch@gnat.com
Sun Feb 25 08:56:00 GMT 2001
On 25-Feb-2001, Jan Hubicka <jh@suse.cz> wrote:
| @itemx (smax:@var{m} @var{x} @var{y})
| Represents the smaller (for @code{smin}) or larger (for @code{smax}) of
| @var{x} and @var{y}, interpreted as signed integers in mode @var{m}.
| + The code can be also used to for floating point values. In that case
| + result on two zeros or operands where one is NaN is undefined.
On Sun, 25 Feb 2001, Fergus Henderson replied:
|The wording there is somewhat misleading;
|saying that the result for two zeros is undefined
|implies that returning any random number, e.g. 1.23, is OK.
|But I'm pretty sure that you only want it to be unspecified which of
|the two zeros is returned (in case their sign differs).
I'm still not clear on the intended use of the min/max codes
for floating point values.
It would seem that we'd like these to be usable to translate the
following to min/max if the target has such an instruction:
float x = -0.0;
float y = +0.0;
float p, q, r, s;
p = (x > y) ? x : y; /* +0.0 */
q = (x >= y) ? x : y; /* -0.0 */
r = (x < y) ? x : y; /* +0.0 */
s = (x <= y) ? x : y; /* -0.0 */
In case either x or y is a NaN, the value of y should be returned.
Since the SSE instructions have been defined in a way that allow
them to be used for the above expressions, would think GCC should
use this definition. For targets that have min/max instructions that
do not preserve these properties, these sequence should only be
enabled if strict IEEE compliance is not required.
-Geert
More information about the Gcc-patches
mailing list