Implement side_cpu_relax for x86
[libside.git] / src / compiler.h
CommitLineData
7e38dc2e
MD
1// SPDX-License-Identifier: MIT
2/*
3 * Copyright (C) 2024 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 */
5
6#ifndef _SIDE_COMPILER_H
7#define _SIDE_COMPILER_H
8
538bc2f2
MD
9#if defined(__x86_64__) || defined(__i386__)
10static inline
11void side_cpu_relax(void)
12{
13 asm volatile ("rep; nop" : : : "memory");
14}
15#else
7e38dc2e
MD
16//TODO: implement per-architecture busy loop "pause"/"rep; nop;" instruction.
17static inline
18void side_cpu_relax(void)
19{
20 asm volatile ("" : : : "memory");
21}
538bc2f2 22#endif
7e38dc2e
MD
23
24#endif /* _SIDE_COMPILER_H */
This page took 0.022426 seconds and 4 git commands to generate.