From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id EBC0E383B825 for ; Tue, 13 Jul 2021 06:56:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBC0E383B825 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-599-NI68X3bANSuVhVbRFlA9tA-1; Tue, 13 Jul 2021 02:56:01 -0400 X-MC-Unique: NI68X3bANSuVhVbRFlA9tA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CCC61835AC2; Tue, 13 Jul 2021 06:56:00 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-143.ams2.redhat.com [10.36.112.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EDC25D9DC; Tue, 13 Jul 2021 06:55:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 16D6tuRO3647493 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 13 Jul 2021 08:55:57 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 16D6tuYb3647492; Tue, 13 Jul 2021 08:55:56 +0200 Date: Tue, 13 Jul 2021 08:55:56 +0200 From: Jakub Jelinek To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, Uros Bizjak Subject: Re: [PATCH v2] x86: Don't enable UINTR in 32-bit mode Message-ID: <20210713065556.GI2380545@tucnak> Reply-To: Jakub Jelinek References: <20210713015130.6297-1-hjl.tools@gmail.com> MIME-Version: 1.0 In-Reply-To: <20210713015130.6297-1-hjl.tools@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 06:56:08 -0000 On Mon, Jul 12, 2021 at 06:51:30PM -0700, H.J. Lu wrote: > @@ -404,9 +404,18 @@ const char *host_detect_local_cpu (int argc, const char **argv) > if (argc < 1) > return NULL; I think it would be simpler to use 2 arguments instead of one. So change the above to if (argc < 2) > > - arch = !strcmp (argv[0], "arch"); > + arch = !strncmp (argv[0], "arch", 4); > > - if (!arch && strcmp (argv[0], "tune")) > + if (!arch && strncmp (argv[0], "tune", 4)) > + return NULL; Keep strcmp as is here. > + > + bool codegen_x86_64; > + > + if (!strcmp (argv[0] + 4, "32")) > + codegen_x86_64 = false; > + else if (!strcmp (argv[0] + 4, "64")) > + codegen_x86_64 = true; > + else > return NULL; Check argv[1] here instead. > @@ -813,7 +826,8 @@ const char *host_detect_local_cpu (int argc, const char **argv) > } > > done: > - return concat (cache, "-m", argv[0], "=", cpu, options, NULL); > + const char *moption = arch ? "-march=" : "-mtune="; > + return concat (cache, moption, cpu, options, NULL); > } > #else You don't need this change. > diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c > index 7a35c468da3..7cba655595e 100644 > --- a/gcc/config/i386/i386-options.c > +++ b/gcc/config/i386/i386-options.c > @@ -2109,6 +2109,7 @@ ix86_option_override_internal (bool main_args_p, > #define DEF_PTA(NAME) \ > if (((processor_alias_table[i].flags & PTA_ ## NAME) != 0) \ > && PTA_ ## NAME != PTA_64BIT \ > + && (TARGET_64BIT || PTA_ ## NAME != PTA_UINTR) \ > && !TARGET_EXPLICIT_ ## NAME ## _P (opts)) \ > SET_TARGET_ ## NAME (opts); > #include "i386-isa.def" > diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h > index 8c3eace56da..ae9f455c48d 100644 > --- a/gcc/config/i386/i386.h > +++ b/gcc/config/i386/i386.h > @@ -577,9 +577,12 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); > #define CC1_CPU_SPEC CC1_CPU_SPEC_1 > #else > #define CC1_CPU_SPEC CC1_CPU_SPEC_1 \ > -"%{march=native:%>march=native %:local_cpu_detect(arch) \ > - %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} \ > -%{mtune=native:%>mtune=native %:local_cpu_detect(tune)}" > +"%{" OPT_ARCH32 ":%{march=native:%>march=native %:local_cpu_detect(arch32) \ > + %{!mtune=*:%>mtune=native %:local_cpu_detect(tune32)}}}" \ > +"%{" OPT_ARCH32 ":%{mtune=native:%>mtune=native %:local_cpu_detect(tune32)}}" \ > +"%{" OPT_ARCH64 ":%{march=native:%>march=native %:local_cpu_detect(arch64) \ > + %{!mtune=*:%>mtune=native %:local_cpu_detect(tune64)}}}" \ > +"%{" OPT_ARCH64 ":%{mtune=native:%>mtune=native %:local_cpu_detect(tune64)}}" And you can use #define ARCH_ARG "%{" OPT_ARCH64 ":64;32}" %:local_cpu_detect(arch, " ARCH_ARG ") etc. Jakub