<p>I know this question is about Visual Studio, but I'm going to try to answer for as many compilers as I can (including Visual Studio)…</p>
<p>A decade later there is progress!  As of Visual Studio 2019 MSVC still doesn't support anything like this (even though it's <a href="https://arxiv.org/pdf/1907.00863.pdf" rel="nofollow noreferrer">the most popular builtin/intrinsic</a>), but as Pauli Nieminen mentioned above C++20 has <a href="http://wg21.link/p0479r5" rel="nofollow noreferrer"><code>likely</code> / <code>unlikely</code> attributes</a> which can be used to create likely/unlikely macros and MSVC usually adds support for new C++ standards pretty quickly (unlike C) so I expect Visual Studio 2021 to support them.</p>
<p>Currently (2019-10-14) only GCC supports these attributes, and even then only applied to labels, but it is sufficient to at least do some basic testing.  Here is a quick implementation which you can <a href="https://godbolt.org/z/n32vRw" rel="nofollow noreferrer">test on Compiler Explorer</a>:</p>
<pre class="lang-cpp prettyprint-override"><code>#define LIKELY(expr) \
  ( \
    ([](bool value){ \
      switch (value) { \
        [[likely]] case true: \
          return true; \
        [[unlikely]] case false: \
          return false; \
      } \
    }) \
  (expr))
#define UNLIKELY(expr) \
  ( \
    ([](bool value){ \
      switch (value) { \
        [[unlikely]] case true: \
          return true; \
        [[likely]] case false: \
          return false; \
      } \
    }) \
  (expr))
</code></pre>
<p><em>Edit (2022-05-02)</em>: MSVC 2022 supports C++20, including <code>[[likely]]</code>/<code>[[unlikely]]</code>, but generates absolutely terrible code for this (see the comments on this post)... don't use it there.</p>
<p>You'll probably want to #ifdef around it to support compilers that can't handle it, but luckily most compilers support <code>__builtin_expect</code>:</p>
<ul>
<li>GCC 3.0</li>
<li>clang</li>
<li>ICC since at least 13, probably much longer.</li>
<li>Oracle Development Studio 12.6+, but only in C++ mode.</li>
<li>ARM 4.1</li>
<li>IBM XL C/C++ since at least 10.1, probably longer.</li>
<li>TI since 6.1</li>
<li>TinyCC since 0.9.27</li>
</ul>
<p>GCC 9+ also supports <a href="https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fexpect_005fwith_005fprobability" rel="nofollow noreferrer"><code>__builtin_expect_with_probability</code></a>.  It's not available anywhere else, but hopefully one day…  It takes a lot of the guesswork out of trying to figure out whether to use ilkely/unlikely or not—you just set the probability and the compiler (theoretically) does the right thing.</p>
<p>Also, clang supports a <a href="https://clang.llvm.org/docs/LanguageExtensions.html#builtin-unpredictable" rel="nofollow noreferrer"><code>__builtin_unpredictable</code></a> (since 3.8, but test for it with <code>__has_builtin(__builtin_unpredictable)</code>).  Since a lot of compilers are based on clang these days it probably works in them, too.</p>
<p>If you want this all wrapped up and ready to go, you might be interested in one of my projects, <a href="https://nemequ.github.io/hedley/" rel="nofollow noreferrer">Hedley</a>.  It's a single public-domain C/C++ header which works on pretty much all compilers and contains lots of useful macros, including <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_LIKELY" rel="nofollow noreferrer"><code>HEDLEY_LIKELY</code></a>, <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_UNLIKELY" rel="nofollow noreferrer"><code>HEDLEY_UNLIKELY</code></a>, <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_UNPREDICTABLE" rel="nofollow noreferrer"><code>HEDLEY_UNPREDICTABLE</code></a>, <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_PREDICT" rel="nofollow noreferrer"><code>HEDLEY_PREDICT</code></a>, <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_PREDICT_TRUE" rel="nofollow noreferrer"><code>HEDLEY_PREDICT_TRUE</code></a>, and <a href="https://nemequ.github.io/hedley/api-reference.html#HEDLEY_PREDICT_FALSE" rel="nofollow noreferrer"><code>HEDLEY_PREDICT_FALSE</code></a>.  It doesn't have the C++20 version quite yet, but <a href="https://github.com/nemequ/hedley/issues/29" rel="nofollow noreferrer">it should be there soon</a>…</p>
<p>Even if you don't want to use Hedley in your project, you might want to check the the implementations there instead of relying on the lists above; I'll probably forget to update this answer with new information, but Hedley should always be up-to-date.</p>
likely/unlikely equivalent for MSVC
<p>GCC compiler supports __builtin_expect statement that is used to define likely and unlikely macros.</p>

<p>eg.</p>

<pre><code>#define likely(expr)    (__builtin_expect(!!(expr), 1))
#define unlikely(expr)  (__builtin_expect(!!(expr), 0))
</code></pre>

<p>Is there an equivalent statement for the Microsoft Visual C compiler, or something equivalent ?</p>