Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/hotspot/cpu/aarch64/aarch64_neon.ad
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,23 @@ instruct vcvt4Bto4I(vecX dst, vecD src)
ins_pipe(pipe_class_default);
%}

instruct vcvt2Lto2F(vecD dst, vecX src)
instruct vcvt2Lto2F(vecD dst, vecX src, vRegF tmp)
%{
predicate(n->as_Vector()->length() == 2 && n->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (VectorCastL2X src));
format %{ "scvtfv T2D, $dst, $src\n\t"
"fcvtn $dst, T2S, $dst, T2D\t# convert 2L to 2F vector"
effect(TEMP_DEF dst, TEMP tmp);
format %{ "umov rscratch1, $src, D, 0\n\t"
"scvtfs $dst, rscratch1\n\t"
"umov rscratch1, $src, D, 1\n\t"
"scvtfs $tmp, rscratch1\n\t"
"ins $dst, S, $tmp, 1, 0\t# convert 2L to 2F vector"
%}
ins_encode %{
__ scvtfv(__ T2D, as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg));
__ fcvtn(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($dst$$reg), __ T2D);
__ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 0);
__ scvtfs(as_FloatRegister($dst$$reg), rscratch1);
__ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 1);
__ scvtfs(as_FloatRegister($tmp$$reg), rscratch1);
__ ins(as_FloatRegister($dst$$reg), __ S, as_FloatRegister($tmp$$reg), 1, 0);
%}
ins_pipe(pipe_slow);
%}
Expand Down
17 changes: 12 additions & 5 deletions src/hotspot/cpu/aarch64/aarch64_neon_ad.m4
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,23 @@ VECTOR_CAST_I2I_L(4, I, B, D, X, xtn, 4S, 4H, 8H, 8B)
VECTOR_CAST_I2I_L(4, B, I, X, D, sxtl, 8B, 8H, 4H, 4S)
dnl

instruct vcvt2Lto2F(vecD dst, vecX src)
instruct vcvt2Lto2F(vecD dst, vecX src, vRegF tmp)
%{
predicate(n->as_Vector()->length() == 2 && n->bottom_type()->is_vect()->element_basic_type() == T_FLOAT);
match(Set dst (VectorCastL2X src));
format %{ "scvtfv T2D, $dst, $src\n\t"
"fcvtn $dst, T2S, $dst, T2D\t# convert 2L to 2F vector"
effect(TEMP_DEF dst, TEMP tmp);
format %{ "umov rscratch1, $src, D, 0\n\t"
"scvtfs $dst, rscratch1\n\t"
"umov rscratch1, $src, D, 1\n\t"
"scvtfs $tmp, rscratch1\n\t"
"ins $dst, S, $tmp, 1, 0\t# convert 2L to 2F vector"
%}
ins_encode %{
__ scvtfv(__ T2D, as_FloatRegister($dst$$reg), as_FloatRegister($src$$reg));
__ fcvtn(as_FloatRegister($dst$$reg), __ T2S, as_FloatRegister($dst$$reg), __ T2D);
__ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 0);
__ scvtfs(as_FloatRegister($dst$$reg), rscratch1);
__ umov(rscratch1, as_FloatRegister($src$$reg), __ D, 1);
__ scvtfs(as_FloatRegister($tmp$$reg), rscratch1);
__ ins(as_FloatRegister($dst$$reg), __ S, as_FloatRegister($tmp$$reg), 1, 0);
%}
ins_pipe(pipe_slow);
%}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Arm Limited. All rights reserved.
* Copyright (c) 2021, 2022, Arm Limited. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -114,6 +114,9 @@ public class VectorCastShape128Test {
0,
Long.MAX_VALUE,
Long.MIN_VALUE,
// A special value to make sure correct rounding of
// conversion from long to float. See: JDK-8282764.
0x561a524000000001L,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment would be useful as to why this constant is important

};


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on avx1.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on avx2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on avx512.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8278623
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on avx512bw.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on avx512dq.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on neon.
Expand All @@ -42,7 +43,7 @@ public static void main(String[] args) {
VectorReshapeHelper.runMainHelper(
TestVectorCast.class,
TestCastMethods.NEON_CAST_TESTS.stream(),
"-XX:+UseNeon");
"-XX:UseSVE=0");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -30,6 +30,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector cast intrinsics work as intended on sve.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,6 +35,7 @@
/*
* @test
* @bug 8259610
* @key randomness
* @modules jdk.incubator.vector
* @modules java.base/jdk.internal.misc
* @summary Test that vector reinterpret intrinsics work as intended.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,6 +37,7 @@
import java.util.stream.Stream;
import jdk.incubator.vector.*;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;

public class VectorReshapeHelper {
public static final int INVOCATIONS = 10_000;
Expand Down Expand Up @@ -105,7 +106,7 @@ public static <T, U> void vectorCast(VectorOperators.Conversion<T, U> cop,

public static <T, U> void runCastHelper(VectorOperators.Conversion<T, U> castOp,
VectorSpecies<T> isp, VectorSpecies<U> osp) throws Throwable {
var random = RandomGenerator.getDefault();
var random = Utils.getRandomInstance();
boolean isUnsignedCast = castOp.name().startsWith("ZERO");
String testMethodName = VectorSpeciesPair.makePair(isp, osp, isUnsignedCast).format();
var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
Expand Down Expand Up @@ -219,7 +220,7 @@ public static void vectorExpandShrink(VectorSpecies<Byte> isp, VectorSpecies<Byt
}

public static void runExpandShrinkHelper(VectorSpecies<Byte> isp, VectorSpecies<Byte> osp) throws Throwable {
var random = RandomGenerator.getDefault();
var random = Utils.getRandomInstance();
String testMethodName = VectorSpeciesPair.makePair(isp, osp).format();
var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
var testMethod = MethodHandles.lookup().findStatic(caller,
Expand Down Expand Up @@ -249,7 +250,7 @@ public static void vectorDoubleExpandShrink(VectorSpecies<Byte> isp, VectorSpeci
}

public static void runDoubleExpandShrinkHelper(VectorSpecies<Byte> isp, VectorSpecies<Byte> osp) throws Throwable {
var random = RandomGenerator.getDefault();
var random = Utils.getRandomInstance();
String testMethodName = VectorSpeciesPair.makePair(isp, osp).format();
var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
var testMethod = MethodHandles.lookup().findStatic(caller,
Expand Down Expand Up @@ -278,7 +279,7 @@ public static <T, U> void vectorRebracket(VectorSpecies<T> isp, VectorSpecies<U>
}

public static <T, U> void runRebracketHelper(VectorSpecies<T> isp, VectorSpecies<U> osp) throws Throwable {
var random = RandomGenerator.getDefault();
var random = Utils.getRandomInstance();
String testMethodName = VectorSpeciesPair.makePair(isp, osp).format();
var caller = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
var testMethod = MethodHandles.lookup().findStatic(caller,
Expand Down