linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot for H. Peter Anvin" <hpa@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	eric.dumazet@gmail.com, tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/urgent] x86, cpufeature: Unbreak compile with gcc 3.x
Date: Thu, 27 May 2010 20:12:54 GMT	[thread overview]
Message-ID: <tip-1ba4f22c426ba04b00fd717318d50620c621a0e1@git.kernel.org> (raw)
In-Reply-To: <4BF2FF82.7090005@zytor.com>

Commit-ID:  1ba4f22c426ba04b00fd717318d50620c621a0e1
Gitweb:     http://git.kernel.org/tip/1ba4f22c426ba04b00fd717318d50620c621a0e1
Author:     H. Peter Anvin <hpa@linux.intel.com>
AuthorDate: Thu, 27 May 2010 12:02:00 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 27 May 2010 12:02:00 -0700

x86, cpufeature: Unbreak compile with gcc 3.x

gcc 3 is too braindamaged to be able to compile static_cpu_has() --
apparently it can't tell that a constant passed to an inline function
is still a constant -- so if we're using gcc 3, just use the dynamic
test.  This is bad for performance, but if you care about performance,
don't use an ancient, known-to-optimize-poorly compiler.

Reported-and-tested-by: Eric Dumazet <eric.dumazet@gmail.com>
LKML-Reference: <4BF2FF82.7090005@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/cpufeature.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index dca9c54..4681459 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -332,6 +332,7 @@ static __always_inline __pure bool __static_cpu_has(u8 bit)
 #endif
 }
 
+#if __GNUC__ >= 4
 #define static_cpu_has(bit)					\
 (								\
 	__builtin_constant_p(boot_cpu_has(bit)) ?		\
@@ -340,6 +341,12 @@ static __always_inline __pure bool __static_cpu_has(u8 bit)
 		__static_cpu_has(bit) :				\
 		boot_cpu_has(bit)				\
 )
+#else
+/*
+ * gcc 3.x is too stupid to do the static test; fall back to dynamic.
+ */
+#define static_cpu_has(bit) boot_cpu_has(bit)
+#endif
 
 #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
 

  parent reply	other threads:[~2010-05-27 20:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-06  8:45 [PATCH v3 0/2] x86 FPU API Avi Kivity
2010-05-06  8:45 ` [PATCH v3 1/2] x86: eliminate TS_XSAVE Avi Kivity
2010-05-10 20:39   ` [tip:x86/fpu] x86: Eliminate TS_XSAVE tip-bot for Avi Kivity
2010-05-12  0:18   ` [tip:x86/fpu] x86, fpu: Use the proper asm constraint in use_xsave() tip-bot for H. Peter Anvin
2010-05-12  1:06   ` [tip:x86/fpu] x86: Add new static_cpu_has() function using alternatives tip-bot for H. Peter Anvin
2010-05-18 20:10     ` Eric Dumazet
2010-05-18 20:43       ` H. Peter Anvin
2010-05-18 20:57       ` H. Peter Anvin
2010-05-18 21:11         ` Eric Dumazet
2010-05-18 21:31           ` H. Peter Anvin
2010-05-18 21:38           ` Does anyone care about gcc 3.x support for x86 anymore? H. Peter Anvin
2010-05-19 23:10             ` Mauro Carvalho Chehab
2010-05-20  0:39               ` H. Peter Anvin
2010-05-20  0:42               ` H. Peter Anvin
2010-05-20 12:44                 ` Ingo Molnar
2010-05-18 20:58       ` [tip:x86/fpu] x86: Add new static_cpu_has() function using alternatives H. Peter Anvin
2010-05-18 21:31         ` Eric Dumazet
2010-05-27 20:12         ` tip-bot for H. Peter Anvin [this message]
2010-05-12  1:06   ` [tip:x86/fpu] x86, fpu: Use static_cpu_has() to implement use_xsave() tip-bot for H. Peter Anvin
2010-05-06  8:45 ` [PATCH v3 2/2] x86: Introduce 'struct fpu' and related API Avi Kivity
2010-05-10 20:39   ` [tip:x86/fpu] " tip-bot for Avi Kivity
2010-05-10 20:40   ` [tip:x86/fpu] x86, fpu: Unbreak FPU emulation tip-bot for H. Peter Anvin
2010-05-10  8:48 ` [PATCH v3 0/2] x86 FPU API Avi Kivity
2010-05-10 15:24   ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-1ba4f22c426ba04b00fd717318d50620c621a0e1@git.kernel.org \
    --to=hpa@linux.intel.com \
    --cc=eric.dumazet@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).