@@ -2900,11 +2900,9 @@ instruct vmask_gen_I(vRegMask dst, iRegI src) %{
2900
2900
format %{ "vmask_gen_I $dst, $src" %}
2901
2901
ins_encode %{
2902
2902
BasicType bt = Matcher::vector_element_basic_type(this);
2903
- Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
2904
2903
__ 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);
2908
2906
%}
2909
2907
ins_pipe(pipe_slow);
2910
2908
%}
@@ -2914,26 +2912,30 @@ instruct vmask_gen_L(vRegMask dst, iRegL src) %{
2914
2912
format %{ "vmask_gen_L $dst, $src" %}
2915
2913
ins_encode %{
2916
2914
BasicType bt = Matcher::vector_element_basic_type(this);
2917
- Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
2918
2915
__ 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);
2922
2918
%}
2923
2919
ins_pipe(pipe_slow);
2924
2920
%}
2925
2921
2926
2922
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));
2927
2925
match(Set dst (VectorMaskGen con));
2928
2926
format %{ "vmask_gen_imm $dst, $con" %}
2929
2927
ins_encode %{
2930
2928
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) {
2933
2931
__ 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);
2934
2938
}
2935
- __ vsetvli_helper(bt, (uint)($con$$constant));
2936
- __ vmset_m(as_VectorRegister($dst$$reg));
2937
2939
%}
2938
2940
ins_pipe(pipe_slow);
2939
2941
%}
@@ -3497,18 +3499,16 @@ instruct extractD(fRegD dst, vReg src, immI idx, vReg tmp)
3497
3499
3498
3500
// ------------------------------ Compress/Expand Operations -------------------
3499
3501
3500
- instruct mcompress(vRegMask dst, vRegMask src, iRegLNoSp tmp) %{
3502
+ instruct mcompress(vRegMask dst, vRegMask src, vReg tmp) %{
3501
3503
match(Set dst (CompressM src));
3502
- effect(TEMP_DEF dst, TEMP tmp);
3504
+ effect(TEMP tmp);
3503
3505
format %{ "mcompress $dst, $src\t# KILL $tmp" %}
3504
3506
ins_encode %{
3505
3507
BasicType bt = Matcher::vector_element_basic_type(this);
3506
- Assembler::SEW sew = Assembler::elemtype_to_sew(bt);
3507
3508
__ 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);
3512
3512
%}
3513
3513
ins_pipe(pipe_slow);
3514
3514
%}
0 commit comments