addExact intrinsic

Andrew Haley aph at redhat.com
Tue Dec 10 03:46:47 PST 2013


I've been looking at addExact for AArch64, and I think I've got it
right, but it looks rather odd.

As far as I can see the output of addExact is fixed to a named
register and to the FlagsReg.  Matcher uses these functions to match
the output of addExact:

const RegMask Matcher::mathExactI_result_proj_mask() {
  return R0_REG_mask();
}

const RegMask Matcher::mathExactI_flags_proj_mask() {
  return INT_FLAGS_mask();
}

And these are the instruction patterns:

instruct addExactI_reg(iRegIorL2I src1, iRegIorL2I src2, rFlagsReg cr)
%{
  match(AddExactI src1 src2);
  effect(DEF cr);

  format %{ "addsw    r0, $src1, $src2\t# addExact int" %}
  ins_encode %{
    __ addsw(r0,
            as_Register($src1$$reg),
            as_Register($src2$$reg));
  %}
  ins_pipe(pipe_class_default);
%}

instruct addExactI_reg_imm(iRegIorL2I src1, immI src2, rFlagsReg cr)
%{
  match(AddExactI src1 src2);
  effect(DEF cr);

  format %{ "addsw    r0, $src1, $src2\t# addExact int" %}
  ins_encode %{
    __ addsw(r0,
            as_Register($src1$$reg),
            as_Register($src2$$constant));
  %}
  ins_pipe(pipe_class_default);
%}

Is that reasonable?

Thanks,
Andrew.


More information about the hotspot-dev mailing list