From patchwork Sat Jan 18 13:58:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 312288 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 047432C009A for ; Sun, 19 Jan 2014 00:58:40 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=U7hckwcN8Qnyi7MiCT C9ZH3zAOSIf1liNFasYoBqPx0GDhd4mfGFRFsm7eT6WFA+exO+n1lEeEQ6SB54Cp 9zTefZSBt0sdYIcCleBb70VcaUI2NoP0uu84+uhdWVRuGQOTQAbf433dl3ncaNio Hwxaktsp20yoX8xOoXQ114ps0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=BYxjhPc2nSQubRoKwLKL4pr/ 2So=; b=lRO+WnIqZ0a3w+3NAULKFgAxA7WDJZ8cs7ebb0qUMdTSWbtowOe8qoaQ /EOSrYxHN6EGMr0xoPr/UKQlzH3YH8mbsT08TY2R3PMMYPCCefbwm7S1WSBmYHjW YJ9uAlsvVQf0AbPmno1pD3TDWBp2EMvjDLoO8XsslRryRTBIIFA= Received: (qmail 5557 invoked by alias); 18 Jan 2014 13:58:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5544 invoked by uid 89); 18 Jan 2014 13:58:31 -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-ob0-f175.google.com Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 18 Jan 2014 13:58:29 +0000 Received: by mail-ob0-f175.google.com with SMTP id uz6so5506436obc.20 for ; Sat, 18 Jan 2014 05:58:28 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.28.134 with SMTP id b6mr6666127obh.27.1390053507895; Sat, 18 Jan 2014 05:58:27 -0800 (PST) Received: by 10.76.105.174 with HTTP; Sat, 18 Jan 2014 05:58:27 -0800 (PST) In-Reply-To: References: <20131219164556.GX892@tucnak.redhat.com> <20131220164740.GA46311@msticlxl7.ims.intel.com> <20131222125549.GN892@tucnak.redhat.com> <20131222160434.GA3086@gmail.com> <20131222192830.GA10682@gmail.com> <20131223141410.GA1684@gmail.com> Date: Sat, 18 Jan 2014 05:58:27 -0800 Message-ID: Subject: Re: PATCH: PRs bootstrap/59580/59583: Improve x86 --with-arch/--with-cpu= configure handling From: "H.J. Lu" To: Uros Bizjak Cc: Paolo Bonzini , Jakub Jelinek , GCC Patches X-IsSubscribed: yes On Sat, Jan 18, 2014 at 2:24 AM, Uros Bizjak wrote: > On Mon, Dec 23, 2013 at 3:14 PM, H.J. Lu wrote: > >>> Please get someone to review config.gcc changes. They are OK as far as >>> x86 rename is concerned, but I can't review functional changes. >> >> Hi Paolo, >> >> Can you review this config.gcc change? >> >>> >>> > @@ -588,6 +588,22 @@ esac >>> > # Common C libraries. >>> > tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" >>> > >>> > +# 32-bit x86 processors supported by --with-arch=. Each processor >>> > +# MUST be separated by exactly one space. >>> > +x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ >>> > +athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \ >>> > +i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \ >>> > +pentium4 pentium4m pentiumpro prescott" >>> >>> Missing "native". >> >> x86_archs contains 32-bit x86 processors. "native" is allowed for >> 64-bit targets and is included in x86_64_archs. 64-bit processors >> can be used in --with-arch/--with-cpu= for 32-bit targets. >> >> Here is a patch to improve x86 x86 --with-arch/--with-cpu= configure >> handling. This patch defines 3 variables: >> >> 1. x86_archs: It contains 32-bit x86 processors supported by >> --with-arch=, which aren't allowed for 64-bit targets. >> 2. x86_64_archs: It contains 64-bit x86 processors supported by >> --with-arch=, which are allowed for both 32-bit and 64-bit targets. >> 3. x86_cpus. It contains x86 processors supported by --with-cpu=, >> which are allowed for both 32-bit and 64-bit targets. >> >> Each processor in those 3 variables are separated by exactly one space. >> >> Instead of checking if a value of --with-arch/--with-cpu= is valid in many >> difference places with >> >> case ${val} in >> valid pattern list) >> OK >> ;; >> *) >> error >> exit 1 >> ;; >> esac >> >> and updating all pattern lists when adding a new processor, this patch >> uses >> >> case " valid processor list separated by exactly one space " in >> *" ${val} "*) >> OK >> ;; >> *) >> error >> exit 1 >> ;; >> esac >> >> "valid processor list separated by exactly one space" is combination >> of 3 processor variables. It only needs separate a check for empty >> value with >> >> if test x${val} != x; then >> $val isn't empty >> else >> $val is empty >> fi >> >> With this approach, we only need to add new 32-bit processors to x86_archs >> and new 64-bit processors to x86_64_archs. They will be supported by >> --with-arch/--with-cpu= automatically. OK to install? >> >> Thanks. >> >> >> H.J. >> --- >> 2013-12-23 H.J. Lu >> >> PR bootstrap/59580 >> PR bootstrap/59583 >> * config.gcc (x86_archs): New variable. >> (x86_64_archs): Likewise. >> (x86_cpus): Likewise. >> Use $x86_archs, $x86_64_archs and $x86_cpus to check valid >> --with-arch/--with-cpu= options. >> Support --with-arch=/--with-cpu={nehalem,westmere, >> sandybridge,ivybridge,haswell,broadwell,bonnell,silvermont}. > > Probably we can use some regex for whitespace to relax "MUST be > separated by exacly one space" limitation, but nevertheless the patch Here is a patch to remove this limitation: --- ---- I am tested for both Linux/x86 and Linux/x86-64 with different configurations. OK to install? > looks like a much needed cleanup to me. OTOH, the comment clearly says > what to do when changing strings. > > Under the assumption that build maintainers silently agree, and due to > the fact that the patch touches x86 parts only, the patch is OK for > mainline with a couple of nits below. > > Thanks, > Uros. > >> diff --git a/gcc/config.gcc b/gcc/config.gcc >> index 24dbaf9..51eb2b1 100644 >> --- a/gcc/config.gcc >> +++ b/gcc/config.gcc >> @@ -588,6 +588,22 @@ esac >> # Common C libraries. >> tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" >> >> +# 32-bit x86 processors supported by --with-arch=. Each processor >> +# MUST be separated by exactly one space. >> +x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ >> +athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \ >> +i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \ >> +pentium4 pentium4m pentiumpro prescott" > > Please put some vertical space here... > >> +# 64-bit x86 processors supported by --with-arch=. Each processor >> +# MUST be separated by exactly one space. >> +x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \ >> +bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \ >> +core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \ >> +sandybridge ivybridge haswell broadwell bonnell silvermont x86-64 native" > > ... and here. > >> +# Additional x86 processors supported by --with-cpu=. Each processor >> +# MUST be separated by exactly one space. >> +x86_cpus="generic intel" Done. I checked my updated initial patch in. Thanks. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89669bd..62dcca7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2014-01-18 H.J. Lu + * config.gcc (x86_archs): Use sed to make sure that each + processor is separated by exactly one space. + (x86_64_archs): Likewise. + (x86_cpus): Likewise. + +2014-01-18 H.J. Lu + PR bootstrap/59580 PR bootstrap/59583 * config.gcc (x86_archs): New variable. diff --git a/gcc/config.gcc b/gcc/config.gcc index c3124be..11e948a 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -596,23 +596,27 @@ esac # Common C libraries. tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" -# 32-bit x86 processors supported by --with-arch=. Each processor -# MUST be separated by exactly one space. +# 32-bit x86 processors supported by --with-arch=. x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \ -athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \ -i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \ -pentium4 pentium4m pentiumpro prescott" + athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 \ + i386 i486 i586 i686 pentium pentium-m pentium-mmx pentium2 \ + pentium3 pentium3m pentium4 pentium4m pentiumpro prescott" +# Make sure that each processor is separated by exactly one space. +x86_archs=`echo $x86_archs | sed -e "s/[ ]+/ /g"` -# 64-bit x86 processors supported by --with-arch=. Each processor -# MUST be separated by exactly one space. +# 64-bit x86 processors supported by --with-arch=. x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \ -bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron opteron-sse3 nocona \ -core2 corei7 corei7-avx core-avx-i core-avx2 atom slm nehalem westmere \ -sandybridge ivybridge haswell broadwell bonnell silvermont x86-64 native" + bdver3 bdver4 btver1 btver2 k8 k8-sse3 opteron \ + opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i \ + core-avx2 atom slm nehalem westmere sandybridge ivybridge \ + haswell broadwell bonnell silvermont x86-64 native" +# Make sure that each processor is separated by exactly one space. +x86_64_archs=`echo $x86_64_archs | sed -e "s/[ ]+/ /g"` -# Additional x86 processors supported by --with-cpu=. Each processor -# MUST be separated by exactly one space. +# Additional x86 processors supported by --with-cpu=. x86_cpus="generic intel" +# Make sure that each processor is separated by exactly one space. +x86_cpus=`echo $x86_cpus | sed -e "s/[ ]+/ /g"` # Common parts for widely ported systems. case ${target} in