Skip to content
Permalink
Browse files
8256995: [vector] Improve broadcast operations
Co-authored-by: Paul Sandoz <psandoz@openjdk.org>
Co-authored-by: Sandhya Viswanathan <sviswanathan@openjdk.org>
Reviewed-by: kvn, vlivanov
  • Loading branch information
Paul Sandoz and Sandhya Viswanathan committed Nov 30, 2020
1 parent 6eb25d7 commit 89690699b2fa55343fc2ca4517240c6856614c48
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
@@ -3726,6 +3726,10 @@ instruct ReplB_reg(vec dst, rRegI src) %{
assert(VM_Version::supports_avx512bw(), "required"); // 512-bit byte vectors assume AVX512BW
int vlen_enc = vector_length_encoding(this);
__ evpbroadcastb($dst$$XMMRegister, $src$$Register, vlen_enc);
} else if (VM_Version::supports_avx2()) {
int vlen_enc = vector_length_encoding(this);
__ movdl($dst$$XMMRegister, $src$$Register);
__ vpbroadcastb($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc);
} else {
__ movdl($dst$$XMMRegister, $src$$Register);
__ punpcklbw($dst$$XMMRegister, $dst$$XMMRegister);
@@ -3805,6 +3809,10 @@ instruct ReplS_reg(vec dst, rRegI src) %{
assert(VM_Version::supports_avx512bw(), "required"); // 512-bit short vectors assume AVX512BW
int vlen_enc = vector_length_encoding(this);
__ evpbroadcastw($dst$$XMMRegister, $src$$Register, vlen_enc);
} else if (VM_Version::supports_avx2()) {
int vlen_enc = vector_length_encoding(this);
__ movdl($dst$$XMMRegister, $src$$Register);
__ vpbroadcastw($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc);
} else {
__ movdl($dst$$XMMRegister, $src$$Register);
__ pshuflw($dst$$XMMRegister, $dst$$XMMRegister, 0x00);
@@ -3880,6 +3888,10 @@ instruct ReplI_reg(vec dst, rRegI src) %{
if (vlen == 16 || VM_Version::supports_avx512vl()) { // AVX512VL for <512bit operands
int vlen_enc = vector_length_encoding(this);
__ evpbroadcastd($dst$$XMMRegister, $src$$Register, vlen_enc);
} else if (VM_Version::supports_avx2()) {
int vlen_enc = vector_length_encoding(this);
__ movdl($dst$$XMMRegister, $src$$Register);
__ vpbroadcastd($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc);
} else {
__ movdl($dst$$XMMRegister, $src$$Register);
__ pshufd($dst$$XMMRegister, $dst$$XMMRegister, 0x00);
@@ -3975,6 +3987,11 @@ instruct ReplL_reg(vec dst, rRegL src) %{
} else if (vlen == 8 || VM_Version::supports_avx512vl()) { // AVX512VL for <512bit operands
int vlen_enc = vector_length_encoding(this);
__ evpbroadcastq($dst$$XMMRegister, $src$$Register, vlen_enc);
} else if (VM_Version::supports_avx2()) {
assert(vlen == 4, "sanity");
int vlen_enc = vector_length_encoding(this);
__ movdq($dst$$XMMRegister, $src$$Register);
__ vpbroadcastq($dst$$XMMRegister, $dst$$XMMRegister, vlen_enc);
} else {
assert(vlen == 4, "sanity");
__ movdq($dst$$XMMRegister, $src$$Register);
@@ -400,7 +400,7 @@ static boolean doBinTest(int cond, double a, double b) {
/*package-private*/
@ForceInline
static long toBits(double e) {
return Double.doubleToLongBits(e);
return Double.doubleToRawLongBits(e);
}

/*package-private*/
@@ -400,7 +400,7 @@ static boolean doBinTest(int cond, float a, float b) {
/*package-private*/
@ForceInline
static long toBits(float e) {
return Float.floatToIntBits(e);
return Float.floatToRawIntBits(e);
}

/*package-private*/
@@ -404,7 +404,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
/*package-private*/
@ForceInline
static long toBits($type$ e) {
return {#if[FP]? $Type$.$type$To$Bitstype$Bits(e): e};
return {#if[FP]? $Type$.$type$ToRaw$Bitstype$Bits(e): e};
}

/*package-private*/

1 comment on commit 8969069

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 8969069 Nov 30, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.