Skip to content

Commit 4070829

Browse files
zifeihanRealFYang
authored andcommittedSep 15, 2023
8315931: RISC-V: xxxMaxVectorTestsSmokeTest fails when using RVV
Reviewed-by: fyang, dzhang
1 parent d575968 commit 4070829

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed
 

‎src/hotspot/cpu/riscv/riscv_v.ad

+19-19
Original file line numberDiff line numberDiff line change
@@ -2900,11 +2900,9 @@ instruct vmask_gen_I(vRegMask dst, iRegI src) %{
29002900
format %{ "vmask_gen_I $dst, $src" %}
29012901
ins_encode %{
29022902
BasicType bt = Matcher::vector_element_basic_type(this);
2903-
Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
29042903
__ vsetvli_helper(bt, Matcher::vector_length(this));
2905-
__ vmclr_m(as_VectorRegister($dst$$reg));
2906-
__ vsetvli(t0, $src$$Register, sew);
2907-
__ vmset_m(as_VectorRegister($dst$$reg));
2904+
__ vid_v(as_VectorRegister($dst$$reg));
2905+
__ vmsltu_vx(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg), $src$$Register);
29082906
%}
29092907
ins_pipe(pipe_slow);
29102908
%}
@@ -2914,26 +2912,30 @@ instruct vmask_gen_L(vRegMask dst, iRegL src) %{
29142912
format %{ "vmask_gen_L $dst, $src" %}
29152913
ins_encode %{
29162914
BasicType bt = Matcher::vector_element_basic_type(this);
2917-
Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
29182915
__ vsetvli_helper(bt, Matcher::vector_length(this));
2919-
__ vmclr_m(as_VectorRegister($dst$$reg));
2920-
__ vsetvli(t0, $src$$Register, sew);
2921-
__ vmset_m(as_VectorRegister($dst$$reg));
2916+
__ vid_v(as_VectorRegister($dst$$reg));
2917+
__ vmsltu_vx(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg), $src$$Register);
29222918
%}
29232919
ins_pipe(pipe_slow);
29242920
%}
29252921

29262922
instruct vmask_gen_imm(vRegMask dst, immL con) %{
2923+
predicate(n->in(1)->get_long() <= 16 ||
2924+
n->in(1)->get_long() == Matcher::vector_length(n));
29272925
match(Set dst (VectorMaskGen con));
29282926
format %{ "vmask_gen_imm $dst, $con" %}
29292927
ins_encode %{
29302928
BasicType bt = Matcher::vector_element_basic_type(this);
2931-
if ($con$$constant != Matcher::vector_length(this)) {
2932-
__ vsetvli_helper(bt, Matcher::vector_length(this));
2929+
__ vsetvli_helper(bt, Matcher::vector_length(this));
2930+
if ((uint)($con$$constant) == 0) {
29332931
__ vmclr_m(as_VectorRegister($dst$$reg));
2932+
} else if ((uint)($con$$constant) == Matcher::vector_length(this)) {
2933+
__ vmset_m(as_VectorRegister($dst$$reg));
2934+
} else {
2935+
assert((uint)($con$$constant) < Matcher::vector_length(this), "unsupported input lane_cnt");
2936+
__ vid_v(as_VectorRegister($dst$$reg));
2937+
__ vmsleu_vi(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg), (uint)($con$$constant) - 1);
29342938
}
2935-
__ vsetvli_helper(bt, (uint)($con$$constant));
2936-
__ vmset_m(as_VectorRegister($dst$$reg));
29372939
%}
29382940
ins_pipe(pipe_slow);
29392941
%}
@@ -3497,18 +3499,16 @@ instruct extractD(fRegD dst, vReg src, immI idx, vReg tmp)
34973499

34983500
// ------------------------------ Compress/Expand Operations -------------------
34993501

3500-
instruct mcompress(vRegMask dst, vRegMask src, iRegLNoSp tmp) %{
3502+
instruct mcompress(vRegMask dst, vRegMask src, vReg tmp) %{
35013503
match(Set dst (CompressM src));
3502-
effect(TEMP_DEF dst, TEMP tmp);
3504+
effect(TEMP tmp);
35033505
format %{ "mcompress $dst, $src\t# KILL $tmp" %}
35043506
ins_encode %{
35053507
BasicType bt = Matcher::vector_element_basic_type(this);
3506-
Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
35073508
__ vsetvli_helper(bt, Matcher::vector_length(this));
3508-
__ vmclr_m(as_VectorRegister($dst$$reg));
3509-
__ vcpop_m($tmp$$Register, as_VectorRegister($src$$reg));
3510-
__ vsetvli(t0, $tmp$$Register, sew);
3511-
__ vmset_m(as_VectorRegister($dst$$reg));
3509+
__ vid_v(as_VectorRegister($tmp$$reg));
3510+
__ vcpop_m(t0, as_VectorRegister($src$$reg));
3511+
__ vmsltu_vx(as_VectorRegister($dst$$reg), as_VectorRegister($tmp$$reg), t0);
35123512
%}
35133513
ins_pipe(pipe_slow);
35143514
%}

0 commit comments

Comments
 (0)
Please sign in to comment.