From patchwork Wed Aug 19 11:21:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 508713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5D3BD1402B1 for ; Wed, 19 Aug 2015 21:21:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=HUry/l7r; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; q=dns; s=default; b=Ek CgqiDAMxX6lVBP00lh6AfAntgmFASEc+2japBrGEwToBQSSGOFWFWbKZX8xMSPU4 NAu1Mm3v5nxDBuqOM5T9gvDYpC+OmhGUACEFyxpYJF3iGSEjVeylM8UYRahL80xI Lf7zRnCOWXkADjqdjmJ+2mvwq4Xm4z9Pc8QdsqRQU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; s=default; bh=7L99uzSd WGbi6ClINAc0YFxQiQw=; b=HUry/l7r0IITdEANhmKtCZgxuO9P206xaJiwS/62 Lik/Ep1qnYOmQVvlsnxIGpz1CzJdhBO21wmu2wg326quZqpAWgNa5ULicosAgcAV U9YdDNXb0bYs3hzapQuVoIlMvumKDFXTmxtHvr5e759PDf6DYMhdM8IxWdH9+q30 3D4= Received: (qmail 51345 invoked by alias); 19 Aug 2015 11:21:53 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 51336 invoked by uid 89); 19 Aug 2015 11:21:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f47.google.com MIME-Version: 1.0 X-Received: by 10.202.196.82 with SMTP id u79mr9786726oif.78.1439983308162; Wed, 19 Aug 2015 04:21:48 -0700 (PDT) In-Reply-To: <20150819031041.GT1584@vapier> References: <20150817231005.GA24205@intel.com> <20150818143258.GM1584@vapier> <20150818160232.GN1584@vapier> <20150819031041.GT1584@vapier> Date: Wed, 19 Aug 2015 04:21:48 -0700 Message-ID: Subject: Re: [PATCH] Define HAS_CPUID/HAS_I586/HAS_I686 from -march= From: "H.J. Lu" To: GNU C Library On Tue, Aug 18, 2015 at 8:10 PM, Mike Frysinger wrote: > On 18 Aug 2015 09:08, H.J. Lu wrote: >> On Tue, Aug 18, 2015 at 9:02 AM, Mike Frysinger wrote: >> > On 18 Aug 2015 07:56, H.J. Lu wrote: >> >> On Tue, Aug 18, 2015 at 7:32 AM, Mike Frysinger wrote: >> >> > On 17 Aug 2015 16:10, H.J. Lu wrote: >> >> >> +#ifdef __x86_64__ >> >> >> +# define HAS_CPUID 1 >> >> >> +#elif defined __pentium__ >> >> >> +# define HAS_CPUID 1 >> >> >> +# define HAS_I586 1 >> >> >> +# define HAS_I686 0 >> >> >> +#elif (defined __pentiumpro__ || defined __pentium4__ \ >> >> >> + || defined __nocona__ || defined __atom__ \ >> >> >> + || defined __core2__ || defined __corei7__ \ >> >> >> + || defined __corei7_avx__ || defined __core_avx2__ \ >> >> >> + || defined __nehalem__ || defined __sandybridge__ \ >> >> >> + || defined __haswell__ || defined __knl__ \ >> >> >> + || defined __bonnell__ || defined __silvermont__ \ >> >> >> + || defined __k6__ || defined __k8__ \ >> >> >> + || defined __athlon__ || defined __amdfam10__ \ >> >> >> + || defined __bdver1__ || defined __bdver2__ \ >> >> >> + || defined __bdver3__ || defined __bdver4__ \ >> >> >> + || defined __btver1__ || defined __btver2__) >> >> >> +# define HAS_CPUID 1 >> >> >> +# define HAS_I586 1 >> >> >> +# define HAS_I686 1 >> >> >> +#else >> >> >> +# define HAS_CPUID 0 >> >> >> +# define HAS_I586 0 >> >> >> +# define HAS_I686 0 >> >> >> +#endif >> >> > >> >> > why is testing for __i686__ & __i586__ unacceptable ? >> >> >> >> -march=haswell doesn't define __i686__ since __i686__ is >> >> mapped to -mach=i686. >> > >> > that's not entirely accurate. i did check before posting, but it looks like >> > the first two entries do set up i586 and i686 correctly (and i stopped after >> > spot checking the first two). so i guess change __pentium__ to __i586__ and >> > __pentiumpro__ to __i686__ ? >> >> My change is based on sysdeps/x86/bits/string.h and >> sysdeps/x86/bits/byteswap.h. None of them check >> __i586__ nor __i686__. > > i'm aware of the provenance. that's not a reason to not improve things :). > -mike This is what I checked in. diff --git a/ChangeLog b/ChangeLog index 7b8181e..962794a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-08-10 H.J. Lu + + * sysdeps/x86/cpu-features.h (HAS_I586): Defined to 1 if + __i586__ is defined. + (HAS_I686): Defined to 1 if __i686__ is defined. + 2015-08-19 Joseph Myers * elf/Makefile [$(have-z-execstack) = yes] diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h index 6b8299f..6e70624 100644 --- a/sysdeps/x86/cpu-features.h +++ b/sysdeps/x86/cpu-features.h @@ -239,17 +239,18 @@ extern const struct cpu_features *__get_cpu_features (void) #ifdef __x86_64__ # define HAS_CPUID 1 -#elif defined __pentium__ +#elif defined __i586__ || defined __pentium__ # define HAS_CPUID 1 # define HAS_I586 1 # define HAS_I686 0 -#elif (defined __pentiumpro__ || defined __pentium4__ \ - || defined __nocona__ || defined __atom__ \ - || defined __core2__ || defined __corei7__ \ - || defined __corei7_avx__ || defined __core_avx2__ \ - || defined __nehalem__ || defined __sandybridge__ \ - || defined __haswell__ || defined __knl__ \ - || defined __bonnell__ || defined __silvermont__ \ +#elif (defined __i686__ || defined __pentiumpro__ \ + || defined __pentium4__ || defined __nocona__ \ + || defined __atom__ || defined __core2__ \ + || defined __corei7__ || defined __corei7_avx__ \ + || defined __core_avx2__ || defined __nehalem__ \ + || defined __sandybridge__ || defined __haswell__ \ + || defined __knl__ || defined __bonnell__ \ + || defined __silvermont__ \ || defined __k6__ || defined __k8__ \ || defined __athlon__ || defined __amdfam10__ \