-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8303762: Optimize vector slice operation with constant index using VPALIGNR instruction #24104
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 all commits
2a17c5d
7385c75
edf51e7
607a8fc
b2e9343
04be59a
e7c7374
405de56
f36ae6d
70c2293
340f184
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1723,6 +1723,14 @@ bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType bt) { | |||||||||
| return false; // Implementation limitation | ||||||||||
| } | ||||||||||
| break; | ||||||||||
| case Op_VectorSlice: | ||||||||||
| if (UseAVX < 1 || size_in_bits < 128) { | ||||||||||
| return false; | ||||||||||
| } | ||||||||||
| if (size_in_bits == 512 && !VM_Version::supports_avx512bw()) { | ||||||||||
| return false; | ||||||||||
| } | ||||||||||
| break; | ||||||||||
| case Op_VectorLoadShuffle: | ||||||||||
| case Op_VectorRearrange: | ||||||||||
| if(vlen == 2) { | ||||||||||
|
|
@@ -10759,6 +10767,70 @@ instruct scalar_fma_HF_reg(regF dst, regF src1, regF src2) | |||||||||
| ins_pipe( pipe_slow ); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_slice_const_origin_LT16B_reg(vec dst, vec src1, vec src2, immI origin) | ||||||||||
|
Contributor
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
Or
Suggested change
|
||||||||||
| %{ | ||||||||||
| predicate(Matcher::vector_length_in_bytes(n) == 16); | ||||||||||
| match(Set dst (VectorSlice (Binary src1 src2) origin)); | ||||||||||
| format %{ "vector_slice_const_origin $dst, $origin, $src1, $src2 \t" %} | ||||||||||
| ins_encode %{ | ||||||||||
| int vlen_enc = vector_length_encoding(this); | ||||||||||
| __ vpalignr($dst$$XMMRegister, $src2$$XMMRegister, $src1$$XMMRegister, $origin$$constant, vlen_enc); | ||||||||||
| %} | ||||||||||
| ins_pipe(pipe_slow); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_slice_const_origin_GT16B_index16B_reg(vec dst, vec src1, vec src2, immI origin) | ||||||||||
| %{ | ||||||||||
| predicate(Matcher::vector_length_in_bytes(n) > 16 && !VM_Version::supports_avx512vlbw() && n->in(2)->get_int() == 16); | ||||||||||
| match(Set dst (VectorSlice (Binary src1 src2) origin)); | ||||||||||
| format %{ "vector_slice_const_origin $dst, $origin, $src1, $src2" %} | ||||||||||
| ins_encode %{ | ||||||||||
| int vlen_enc = vector_length_encoding(this); | ||||||||||
| // src1 = [v2, v1], src2 = [v4, v3] | ||||||||||
| // dst = [v3, v2] | ||||||||||
| __ vperm2i128($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, 0x21); | ||||||||||
| %} | ||||||||||
| ins_pipe(pipe_slow); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_slice_const_origin_GT16B_reg(vec dst, vec src1, vec src2, immI origin, vec xtmp) | ||||||||||
| %{ | ||||||||||
| predicate(Matcher::vector_length_in_bytes(n) > 16 && !VM_Version::supports_avx512vlbw() && n->in(2)->get_int() != 16); | ||||||||||
| match(Set dst (VectorSlice (Binary src1 src2) origin)); | ||||||||||
| effect(TEMP xtmp); | ||||||||||
| format %{ "vector_slice_const_origin $dst, $origin, $src1, $src2 \t!using $xtmp as TEMP" %} | ||||||||||
| ins_encode %{ | ||||||||||
| int vlen_enc = vector_length_encoding(this); | ||||||||||
| __ vector_slice_op($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, $xtmp$$XMMRegister, $origin$$constant, vlen_enc); | ||||||||||
| %} | ||||||||||
| ins_pipe(pipe_slow); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_slice_const_origin_GT16B_index_multiple4_reg_evex(vec dst, vec src1, vec src2, immI origin) | ||||||||||
| %{ | ||||||||||
| predicate(Matcher::vector_length_in_bytes(n) > 16 && VM_Version::supports_avx512vlbw() && (n->in(2)->get_int() & 0x3) == 0); | ||||||||||
| match(Set dst (VectorSlice (Binary src1 src2) origin)); | ||||||||||
| format %{ "vector_slice_const_origin $dst, $origin, $src1, $src2" %} | ||||||||||
| ins_encode %{ | ||||||||||
| int vlen_enc = vector_length_encoding(this); | ||||||||||
| int normalized_origin = $origin$$constant >> 2; | ||||||||||
| __ evalignd($dst$$XMMRegister, $src2$$XMMRegister, $src1$$XMMRegister, normalized_origin, vlen_enc); | ||||||||||
| %} | ||||||||||
| ins_pipe(pipe_slow); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_slice_const_origin_GT16B_reg_evex(vec dst, vec src1, vec src2, immI origin, vec xtmp) | ||||||||||
| %{ | ||||||||||
| predicate(Matcher::vector_length_in_bytes(n) > 16 && VM_Version::supports_avx512vlbw() && (n->in(2)->get_int() & 0x3) != 0); | ||||||||||
| match(Set dst (VectorSlice (Binary src1 src2) origin)); | ||||||||||
| effect(TEMP dst, TEMP xtmp); | ||||||||||
| format %{ "vector_slice_const_origin $dst, $origin, $src1, $src2 \t!using $xtmp as TEMP" %} | ||||||||||
| ins_encode %{ | ||||||||||
| int vlen_enc = vector_length_encoding(this); | ||||||||||
| __ vector_slice_op($dst$$XMMRegister, $src1$$XMMRegister, $src2$$XMMRegister, $xtmp$$XMMRegister, $origin$$constant, vlen_enc); | ||||||||||
| %} | ||||||||||
| ins_pipe(pipe_slow); | ||||||||||
| %} | ||||||||||
|
|
||||||||||
| instruct vector_sqrt_HF_reg(vec dst, vec src) | ||||||||||
| %{ | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1167,6 +1167,18 @@ class methodHandle; | |
| "Z") \ | ||
| do_name(vector_test_name, "test") \ | ||
| \ | ||
| do_intrinsic(_VectorSlice, jdk_internal_vm_vector_VectorSupport, vector_slice_name, vector_slice_sig, F_S) \ | ||
| do_signature(vector_slice_sig, "(I" \ | ||
| "Ljava/lang/Class;" \ | ||
| "Ljava/lang/Class;" \ | ||
| "I" \ | ||
| "Ljdk/internal/vm/vector/VectorSupport$Vector;" \ | ||
| "Ljdk/internal/vm/vector/VectorSupport$Vector;" \ | ||
| "Ljdk/internal/vm/vector/VectorSupport$VectorSliceOp;)" \ | ||
| "Ljdk/internal/vm/vector/VectorSupport$Vector;") \ | ||
|
Contributor
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. Seems this |
||
| do_name(vector_slice_name, "sliceOp") \ | ||
|
Contributor
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. ditto |
||
| \ | ||
| \ | ||
| do_intrinsic(_VectorBlend, jdk_internal_vm_vector_VectorSupport, vector_blend_name, vector_blend_sig, F_S) \ | ||
| do_signature(vector_blend_sig, "(Ljava/lang/Class;" \ | ||
| "Ljava/lang/Class;" \ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.