[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190829083233.24162-4-linux@rasmusvillemoes.dk>
Date: Thu, 29 Aug 2019 10:32:31 +0200
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: x86@...nel.org, linux-kernel@...r.kernel.org
Cc: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>, Nadav Amit <namit@...are.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
ndesaulniers@...gle.com,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: [RFC PATCH 3/5] compiler-gcc.h: add asm_inline definition
This adds an asm_inline macro which expands to "asm inline" when gcc
is new enough (>= 9.1), and just asm for older gccs and other
compilers.
Using asm inline("foo") instead of asm("foo") overrules gcc's
heuristic estimate of the size of the code represented by the asm()
statement, and makes gcc use the minimum possible size instead. That
can in turn affect gcc's inlining decisions.
I wasn't sure whether to make this a function-like macro or not - this
way, it can be combined with volatile as
asm_inline volatile()
but perhaps we'd prefer to spell that
asm_inline_volatile()
anyway.
Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
include/linux/compiler-gcc.h | 4 ++++
include/linux/compiler_types.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index d7ee4c6bad48..abd7abf7d06b 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -172,3 +172,7 @@
#endif
#define __no_fgcse __attribute__((optimize("-fno-gcse")))
+
+#if GCC_VERSION >= 90100
+#define asm_inline __asm__ __inline__
+#endif
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 4a8b63e3a31d..3d354b166a94 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -188,6 +188,10 @@ struct ftrace_likely_data {
#define asm_volatile_goto(x...) asm goto(x)
#endif
+#ifndef asm_inline
+#define asm_inline __asm__
+#endif
+
#ifndef __no_fgcse
# define __no_fgcse
#endif
--
2.20.1
Powered by blists - more mailing lists