<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
/* Style Definitions */
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;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<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>
</body>
</html>