Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8266775: Add VectorLoadConst node implementation for Arm SVE
Co-authored-by: Wang Huang <whuang@openjdk.org>
Co-authored-by: Ai Jiaming <aijiaming1@huawei.com>
Reviewed-by: xgong, njian
  • Loading branch information
Wang Huang and Ai Jiaming committed May 17, 2021
1 parent 106b69a commit 0b2f1aa
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
9 changes: 5 additions & 4 deletions src/hotspot/cpu/aarch64/aarch64_neon.ad
Expand Up @@ -3368,9 +3368,10 @@ instruct vmaskcastX(vecX dst)

instruct loadcon8B(vecD dst, immI0 src)
%{
predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4 ||
n->as_Vector()->length() == 8) &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
predicate(UseSVE == 0 &&
(n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4 ||
n->as_Vector()->length() == 8) &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
match(Set dst (VectorLoadConst src));
ins_cost(INSN_COST);
format %{ "ldr $dst, CONSTANT_MEMORY\t# load iota indices" %}
Expand All @@ -3383,7 +3384,7 @@ instruct loadcon8B(vecD dst, immI0 src)

instruct loadcon16B(vecX dst, immI0 src)
%{
predicate(n->as_Vector()->length() == 16 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
predicate(UseSVE == 0 && n->as_Vector()->length() == 16 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
match(Set dst (VectorLoadConst src));
ins_cost(INSN_COST);
format %{ "ldr $dst, CONSTANT_MEMORY\t# load iota indices" %}
Expand Down
9 changes: 5 additions & 4 deletions src/hotspot/cpu/aarch64/aarch64_neon_ad.m4
Expand Up @@ -1282,10 +1282,11 @@ dnl
//-------------------------------- LOAD_IOTA_INDICES----------------------------------
dnl
define(`PREDICATE', `ifelse($1, 8,
`predicate((n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4 ||
n->as_Vector()->length() == 8) &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);',
`predicate(n->as_Vector()->length() == 16 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);')')dnl
`predicate(UseSVE == 0 &&
(n->as_Vector()->length() == 2 || n->as_Vector()->length() == 4 ||
n->as_Vector()->length() == 8) &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);',
`predicate(UseSVE == 0 && n->as_Vector()->length() == 16 && n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);')')dnl
dnl
define(`VECTOR_LOAD_CON', `
instruct loadcon$1B`'(vec$2 dst, immI0 src)
Expand Down
18 changes: 16 additions & 2 deletions src/hotspot/cpu/aarch64/aarch64_sve.ad
Expand Up @@ -225,9 +225,9 @@ source %{
// Others
case Op_ExtractC:
case Op_ExtractUB:
// Vector API specific
case Op_VectorLoadConst:
return false;
// Vector API specific
case Op_LoadVectorGather:
case Op_StoreVectorScatter:
// Currently the implementation for partial vectors are not implemented yet.
// Will add them in a separate patch.
Expand Down Expand Up @@ -4219,3 +4219,17 @@ instruct scatterL(vmemA mem, vReg src, vReg idx) %{
%}
ins_pipe(pipe_slow);
%}

// ------------------------------ Vector Load Const -------------------------------

instruct loadconB(vReg dst, immI0 src) %{
predicate(UseSVE > 0 &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
match(Set dst (VectorLoadConst src));
ins_cost(SVE_COST);
format %{ "sve_index $dst, 0, 1\t# generate iota indices" %}
ins_encode %{
__ sve_index(as_FloatRegister($dst$$reg), __ B, 0, 1);
%}
ins_pipe(pipe_slow);
%}
18 changes: 16 additions & 2 deletions src/hotspot/cpu/aarch64/aarch64_sve_ad.m4
Expand Up @@ -220,9 +220,9 @@ source %{
// Others
case Op_ExtractC:
case Op_ExtractUB:
// Vector API specific
case Op_VectorLoadConst:
return false;
// Vector API specific
case Op_LoadVectorGather:
case Op_StoreVectorScatter:
// Currently the implementation for partial vectors are not implemented yet.
// Will add them in a separate patch.
Expand Down Expand Up @@ -2491,3 +2491,17 @@ instruct scatterL(vmemA mem, vReg src, vReg idx) %{
%}
ins_pipe(pipe_slow);
%}

// ------------------------------ Vector Load Const -------------------------------

instruct loadconB(vReg dst, immI0 src) %{
predicate(UseSVE > 0 &&
n->bottom_type()->is_vect()->element_basic_type() == T_BYTE);
match(Set dst (VectorLoadConst src));
ins_cost(SVE_COST);
format %{ "sve_index $dst, 0, 1\t# generate iota indices" %}
ins_encode %{
__ sve_index(as_FloatRegister($dst$$reg), __ B, 0, 1);
%}
ins_pipe(pipe_slow);
%}

0 comments on commit 0b2f1aa

Please sign in to comment.