8251525: AARCH64: Faster Math.signum(fp)

Reviewed-by: aph, vlivanov, adinn
This commit is contained in:
Dmitry Chuyko 2020-09-03 14:54:43 +03:00
parent a951a15379
commit 35ea00085f
15 changed files with 349 additions and 3 deletions

View file

@ -1977,6 +1977,7 @@ public final class Math {
* @author Joseph D. Darcy
* @since 1.5
*/
@HotSpotIntrinsicCandidate
public static double signum(double d) {
return (d == 0.0 || Double.isNaN(d))?d:copySign(1.0, d);
}
@ -1998,6 +1999,7 @@ public final class Math {
* @author Joseph D. Darcy
* @since 1.5
*/
@HotSpotIntrinsicCandidate
public static float signum(float f) {
return (f == 0.0f || Float.isNaN(f))?f:copySign(1.0f, f);
}
@ -2218,6 +2220,7 @@ public final class Math {
* and the sign of {@code sign}.
* @since 1.6
*/
@HotSpotIntrinsicCandidate
public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
@ -2241,6 +2244,7 @@ public final class Math {
* and the sign of {@code sign}.
* @since 1.6
*/
@HotSpotIntrinsicCandidate
public static float copySign(float magnitude, float sign) {
return Float.intBitsToFloat((Float.floatToRawIntBits(sign) &
(FloatConsts.SIGN_BIT_MASK)) |