<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="extern {
    #[link_name = &quot;llvm.expect.i8&quot;]
    fn expect(val: u8, expected_val: u8) -&gt; u8;
}"><pre class="notranslate"><span class="pl-k">extern</span> <span class="pl-kos">{</span>
    <span class="pl-c1">#<span class="pl-kos">[</span>link_name = <span class="pl-s">"llvm.expect.i8"</span><span class="pl-kos">]</span></span>
    <span class="pl-k">fn</span> <span class="pl-en">expect</span><span class="pl-kos">(</span><span class="pl-s1">val</span><span class="pl-kos">:</span> <span class="pl-smi">u8</span><span class="pl-kos">,</span> <span class="pl-s1">expected_val</span><span class="pl-kos">:</span> <span class="pl-smi">u8</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">u8</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Branch prediction intrinsic equivalent to GCC’s <code class="notranslate">__builtin_expect</code> should exist. Alternatively two intrinsics <code class="notranslate">likely</code> and <code class="notranslate">unlikely</code> could be implemented.</p>