1 //  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 #pragma once
7 
8 #include <folly/Portability.h>
9 
10 #include <cstdint>
11 
12 #ifdef _MSC_VER
13 #include <intrin.h>
14 #endif
15 
16 namespace folly {
asm_volatile_pause()17 inline void asm_volatile_pause() {
18 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
19   ::_mm_pause();
20 #elif defined(__i386__) || FOLLY_X64
21   asm volatile("pause");
22 #elif FOLLY_AARCH64 || defined(__arm__)
23   asm volatile("yield");
24 #elif FOLLY_PPC64
25   asm volatile("or 27,27,27");
26 #endif
27 }
28 } // namespace folly
29