RFR: 8301739: AArch64: Add optimized rules for vector compare with immediate for SVE [v3]

Chang Peng duke at openjdk.org
Tue Apr 25 10:21:08 UTC 2023


On Tue, 25 Apr 2023 10:10:03 GMT, Chang Peng <duke at openjdk.org> wrote:

>>> @theRealAph The ReplicateXNodes used in match rules are also different in these two marcos. I think we needn't to merge these two marcos since this will introduce some if-else statements which will reduce the readability.
>> 
>> It won't introduce if-else, surely. Not if you make the parts that are different into parameters. Then a reviewer can immediately see which parts of the macros are actually different, rather than needing to do a deep study.;
>
> Sorry for confusion. I will try to rewrite the marcos according to your comments.

If we merge these marcos like following, there will be more generated matching rules.
But I think it is trivial since the number of class in ad_aarch64.hpp will not change.

dnl VMASKCMP_SVE_IMM($1          , $2          , $3      , $4            )
dnl VMASKCMP_SVE_IMM(element_size, element_type, type_imm, type_condition)
define(`VMASKCMP_SVE_IMM', `
instruct vmask$4_imm$2_sve(pReg dst, vReg src, $3 imm, immI_$4_cond cond, rFlagsReg cr) %{
  predicate(UseSVE > 0);
  match(Set dst (VectorMaskCmp (Binary src (Replicate$2 imm)) cond));
  effect(KILL cr);
  format %{ "vmask$4_imm$2_sve $dst, $src, $imm, $cond\t# KILL cr" %}
  ins_encode %{
    Assembler::Condition condition = to_assembler_cond((BoolTest::mask)$cond$$constant);
    uint length_in_bytes = Matcher::vector_length_in_bytes(this);
    assert(length_in_bytes == MaxVectorSize, "invalid vector length");
    __ sve_cmp(condition, $dst$$PRegister, __ $1, ptrue, $src$$FloatRegister, (int)$imm$$constant);
  %}
  ins_pipe(pipe_slow);
%}')dnl
VMASKCMP_SVE_IMM(B, B, immI5, cmp)
VMASKCMP_SVE_IMM(B, B, immIU7, cmpU)
VMASKCMP_SVE_IMM(H, S, immI5, cmp)
VMASKCMP_SVE_IMM(H, S, immIU7, cmpU)
VMASKCMP_SVE_IMM(S, I, immI5, cmp)
VMASKCMP_SVE_IMM(S, I, immIU7, cmpU)
VMASKCMP_SVE_IMM(D, L, immL5, cmp)
VMASKCMP_SVE_IMM(D, L, immLU7, cmpU)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13200#discussion_r1176310384


More information about the hotspot-compiler-dev mailing list