-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8371259: ML-DSA AVX2 and AVX512 intrinsics and improvements #28136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 10 commits
35841c7
2ff3b82
f4f84b6
6d3f779
050312f
e913340
b04f4f0
cefa021
691e1df
bfc16f1
094051e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3860,6 +3860,46 @@ void Assembler::evmovdquq(Address dst, KRegister mask, XMMRegister src, bool mer | |||||
| emit_operand(src, dst, 0); | ||||||
| } | ||||||
|
|
||||||
| void Assembler::vmovsldup(XMMRegister dst, XMMRegister src, int vector_len) { | ||||||
| assert(vector_len == AVX_512bit ? VM_Version::supports_evex() : VM_Version::supports_avx(), ""); | ||||||
| InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); | ||||||
| int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); | ||||||
| emit_int16(0x12, (0xC0 | encode)); | ||||||
| } | ||||||
|
|
||||||
| void Assembler::vmovshdup(XMMRegister dst, XMMRegister src, int vector_len) { | ||||||
| assert(vector_len == AVX_512bit ? VM_Version::supports_evex() : VM_Version::supports_avx(), ""); | ||||||
| InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you check for AVX512-VL you allow accessing 128/256 bit registers from the higher register bank [X/Y]MM(16-31) But your assertions are nowhere checking this. |
||||||
| int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); | ||||||
| emit_int16(0x16, (0xC0 | encode)); | ||||||
| } | ||||||
|
|
||||||
| void Assembler::evmovsldup(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { | ||||||
| assert(VM_Version::supports_evex(), ""); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took the patch, but also kept the supports_evex() assert |
||||||
| assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); | ||||||
| InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); | ||||||
| attributes.set_embedded_opmask_register_specifier(mask); | ||||||
| attributes.set_is_evex_instruction(); | ||||||
| if (merge) { | ||||||
| attributes.reset_is_clear_context(); | ||||||
| } | ||||||
| int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); | ||||||
| emit_int16(0x12, (0xC0 | encode)); | ||||||
| } | ||||||
|
|
||||||
| void Assembler::evmovshdup(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { | ||||||
| assert(VM_Version::supports_evex(), ""); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||||||
| assert(vector_len == AVX_512bit || VM_Version::supports_avx512vl(), ""); | ||||||
| InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); | ||||||
| attributes.set_embedded_opmask_register_specifier(mask); | ||||||
| attributes.set_is_evex_instruction(); | ||||||
| if (merge) { | ||||||
| attributes.reset_is_clear_context(); | ||||||
| } | ||||||
| int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); | ||||||
| emit_int16(0x16, (0xC0 | encode)); | ||||||
| } | ||||||
|
|
||||||
| // Uses zero extension on 64bit | ||||||
|
|
||||||
| void Assembler::movl(Register dst, int32_t imm32) { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you check for AVX512-VL you allow accessing 128/256 bit registers from the higher register bank [X/Y]MM(16-31)
But your assertions are nowhere checking this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe those asserts are in
vex_prefix_and_encode(jdk/src/hotspot/cpu/x86/assembler_x86.cpp
Line 13164 in 6d3f779
vex_prefix(jdk/src/hotspot/cpu/x86/assembler_x86.cpp
Line 13047 in 6d3f779
I also haven't found any other instruction that does this check so I could emulate the style.