Skip to content

Commit

Permalink
[Backport] 8267370: [Vector API] Fix several crashes after JDK-8256973
Browse files Browse the repository at this point in the history
Summary: [Backport] 8267370: [Vector API] Fix several crashes after JDK-8256973

Test Plan: ci jtreg

Reviewed-by: JoshuaZhuwj

Issue: #588
  • Loading branch information
JinZhonghui authored and JoshuaZhuwj committed Nov 13, 2023
1 parent 2c575f6 commit 74f32cc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/hotspot/cpu/x86/assembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4230,9 +4230,10 @@ void Assembler::pmovmskb(Register dst, XMMRegister src) {
emit_int8((unsigned char)(0xC0 | encode));
}

void Assembler::vpmovmskb(Register dst, XMMRegister src) {
assert(VM_Version::supports_avx2(), "");
InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
void Assembler::vpmovmskb(Register dst, XMMRegister src, int vec_enc) {
assert((VM_Version::supports_avx() && vec_enc == AVX_128bit) ||
(VM_Version::supports_avx2() && vec_enc == AVX_256bit), "");
InstructionAttr attributes(vec_enc, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false);
int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes);
emit_int8((unsigned char)0xD7);
emit_int8((unsigned char)(0xC0 | encode));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/assembler_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ class Assembler : public AbstractAssembler {
void vpcmpgtq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);

void pmovmskb(Register dst, XMMRegister src);
void vpmovmskb(Register dst, XMMRegister src);
void vpmovmskb(Register dst, XMMRegister src, int vec_enc);

// SSE 4.1 extract
void pextrd(Register dst, XMMRegister src, int imm8);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister
assert(VM_Version::supports_avx(), "");
vpxor(xtmp, xtmp, xtmp, vec_enc);
vpsubb(xtmp, xtmp, mask, vec_enc);
vpmovmskb(tmp, xtmp);
vpmovmskb(tmp, xtmp, vec_enc);
switch(opc) {
case Op_VectorMaskTrueCount:
popcntq(dst, tmp);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4331,9 +4331,9 @@ void MacroAssembler::vpmovzxbw(XMMRegister dst, Address src, int vector_len) {
Assembler::vpmovzxbw(dst, src, vector_len);
}

void MacroAssembler::vpmovmskb(Register dst, XMMRegister src) {
void MacroAssembler::vpmovmskb(Register dst, XMMRegister src, int vector_len) {
assert((src->encoding() < 16),"XMM register should be 0-15");
Assembler::vpmovmskb(dst, src);
Assembler::vpmovmskb(dst, src, vector_len);
}

void MacroAssembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/macroAssembler_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ class MacroAssembler: public Assembler {
void vpmovzxbw(XMMRegister dst, Address src, int vector_len);
void vpmovzxbw(XMMRegister dst, XMMRegister src, int vector_len) { Assembler::vpmovzxbw(dst, src, vector_len); }

void vpmovmskb(Register dst, XMMRegister src);
void vpmovmskb(Register dst, XMMRegister src, int vector_len = Assembler::AVX_256bit);

void vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len);
void vpmullw(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
Expand Down

0 comments on commit 74f32cc

Please sign in to comment.