<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Peter,<br>
    <br>
    I tried ccmp as part of improving itable stub on aarch64, and the
    results were not promising. Applying ccmp as suggested increased
    geomean from 15.7 ns to 15.9 ns on N1 and from 201 ns to 205 ns on
    A72. I don't think micro-architecture specialization in itable stub
    would bring universal benefits, it will only make code more
    complicated. I would appreciate your review of the AArch64 part of
    JDK-8305959 once I post it.<br>
    <br>
    thanks,<br>
    Boris<br>
    <br>
    <div class="moz-cite-prefix">On 4/29/2023 1:48 PM, Boris Ulasevich
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:19e76652-f635-5ad9-cf84-37e7b87b8adc@bell-sw.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hi Peter,<br>
      <br>
      Please have a look at JDK-8305959. I'm going to rewrite the itable
      stub codes to use a single pass over itable! I have an aarch64
      implementation which shows improvement on <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">Ampere
        Altra.</span><br>
      <br>
      Boris<br>
      <br>
      <div class="moz-cite-prefix">On 4/29/2023 6:18 AM, Peter Kessler
        OS wrote:<br>
      </div>
      <blockquote type="cite"
cite="mid:SJ0PR01MB74149EF5FB147590E6CB9815D4689@SJ0PR01MB7414.prod.exchangelabs.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=UTF-8">
        <meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
        <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;}span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}div.WordSection1
        {page:WordSection1;}</style>
        <div class="WordSection1">
          <p class="MsoNormal">I notice that <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
              MacroAssembler::lookup_interface_method loops over the
              itable list with code that uses two branches: one to check
              for a null indicating the end of the list, and one to see
              if the appropriate entry has been found.  aarch64 has a
              "ccmp" instruction that can be used to evaluate two
              conditions with only one branch.  On an out-of-order
              implementation with more integer execution units than
              branch units, the trading of a branch for a ccmp can be
              beneficial.  The downside is that one has to check, after
              the loop has exited, which of the conditions cause the
              loop to exit, but if the loop executes more than once or
              twice, that is still a win.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">There
              are other opportunities to use cmp;ccmp;br instead of
              cmp;br;cmp;br.  I happened to see the one in
              MacroAssembler::lookup_interface_method because it was in
              what passes for hand-written assembler in HotSpot.  For
              generic searches for a key in a key-value array the
              improvement can be ~10% on a Ampere Altra, depending on
              how far down the key-value array one has to look.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">I
              am only proposing to fix the loop in
              MacroAssembler::lookup_interface_method, but I would be
              interested in talking to people about where else the ccmp
              style could be applied.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#172B4D;background:white">                                   
              ... peter</span><o:p></o:p></p>
        </div>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>