2 * Copyright 2016 Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <folly/Portability.h>
26 inline void asm_volatile_memory() {
27 #if defined(__clang__) || defined(__GNUC__)
28 asm volatile("" : : : "memory");
29 #elif defined(_MSC_VER)
30 ::_ReadWriteBarrier();
34 inline void asm_volatile_pause() {
35 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
37 #elif defined(__i386__) || FOLLY_X64
38 asm volatile("pause");
39 #elif FOLLY_A64 || defined(__arm__)
40 asm volatile("yield");
42 asm volatile("or 27,27,27");
46 inline void asm_pause() {
47 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
49 #elif defined(__i386__) || FOLLY_X64
51 #elif FOLLY_A64 || defined(__arm__)