VectorAPI min and max intrinsics
Rukmannagari, Shravya
shravya.rukmannagari at intel.com
Wed Apr 18 18:55:46 UTC 2018
Sorry, the table got messed up. Please find the table attached
Thanks,
Shravya.
-----Original Message-----
From: panama-dev [mailto:panama-dev-bounces at openjdk.java.net] On Behalf Of Rukmannagari, Shravya
Sent: Wednesday, April 18, 2018 11:50 AM
To: Paul Sandoz <paul.sandoz at oracle.com>
Cc: panama-dev at openjdk.java.net
Subject: RE: VectorAPI min and max intrinsics
Hi Paul,
Please find the table below which shows the results of min/max operations using the intel instructions, Math.min/Math.max and the Java comparator </>.
Input
Min
Max
Java Comp(<)
Math.min
Intel inst(minps)
Java Comp(>)
Math.max
Intel inst(maxps)
NaN
1
false => 1
NaN
1
false => 1
NaN
1
1
NaN
false => NaN
NaN
NaN
false => NaN
NaN
NaN
+0.0
-0.0
false => -0.0
-0.0
-0.0
false => -0.0
+0.0
-0.0
-0.0
+0.0
false => +0.0
-0.0
+0.0
false => +0.0
+0.0
+0.0
NaN
NaN
false => NaN
NaN
NaN
false => NaN
NaN
NaN
Thanks,
Shravya.
-----Original Message-----
From: Rukmannagari, Shravya
Sent: Tuesday, April 17, 2018 10:35 AM
To: Paul Sandoz <paul.sandoz at oracle.com>
Cc: panama-dev at openjdk.java.net
Subject: RE: VectorAPI min and max intrinsics
Hi Paul,
The float(minps, maxps) and double(minpd, maxpd) instructions would match the "<" and ">" from the Java language specification. As per the documentation of the instructions (minps, maxps),
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 MINPS can be emulated using a sequence of instructions, such as, a comparison followed by AND, ANDN and OR.
As per the Java lang specification, comparison is:
- If either operand is NaN, then the result is false.
- All values other than NaN are ordered, with negative infinity less than all finite values, and positive infinity greater than all finite values.
- Positive zero and negative zero are considered equal.
Thanks,
Shravya.
-----Original Message-----
From: Paul Sandoz [mailto:paul.sandoz at oracle.com]
Sent: Monday, April 16, 2018 5:55 PM
To: Rukmannagari, Shravya <shravya.rukmannagari at intel.com<mailto:shravya.rukmannagari at intel.com>>
Cc: panama-dev at openjdk.java.net<mailto:panama-dev at openjdk.java.net>
Subject: Re: VectorAPI min and max intrinsics
Hi,
I notice you have adjusted the the Vector Java implementations to differ from the the java.lang.Math.min/max implementations (<= to < etc) (for the floating point types i intended to adjust to call Math.min/max).
Ideally it would be best to align with Math.min/max behaviour if at all possible at least for the integral types. For the FP types i am unsure about how the instructions deal with NaNs and -0.0 and +0.0.
Can you describe the semantics of the vector instructions so i can compare with Math.min/max?
Thanks,
Paul.
> On Apr 16, 2018, at 4:28 PM, Rukmannagari, Shravya <shravya.rukmannagari at intel.com<mailto:shravya.rukmannagari at intel.com>> wrote:
>
> Hi All,
>
>
>
> I would like to contribute a patch adding support for vector Intrinsics for Vector API min and max functions for all the datatypes.
>
> Could you please review the patch here: http://cr.openjdk.java.net/~srukmannagar/VectorAPI_minMax/webrev.01/
>
>
>
> Regards,
>
> Shravya.
>
More information about the panama-dev
mailing list