From patchwork Mon May 23 18:10:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 97021 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]) by ozlabs.org (Postfix) with SMTP id 264ADB6FBA for ; Tue, 24 May 2011 04:10:57 +1000 (EST) Received: (qmail 29417 invoked by alias); 23 May 2011 18:10:55 -0000 Received: (qmail 29397 invoked by uid 22791); 23 May 2011 18:10:54 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_HI, TW_AV, TW_CL, TW_OV, TW_PX, TW_TB, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 May 2011 18:10:40 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 23 May 2011 11:10:40 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by fmsmga001.fm.intel.com with ESMTP; 23 May 2011 11:10:27 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 03FF7180DB2; Mon, 23 May 2011 11:10:26 -0700 (PDT) Date: Mon, 23 May 2011 11:10:26 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: PATCH: PR target/49128: -mtune=native generates unsupported instructions Message-ID: <20110523181026.GA9013@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, We use processor model and family to detect processor. But some processors may have some ISAs disabled. This patch always adds -mno-XXX. OK for trunk and 4.6 if there are no regressions? Thanks. H.J. --- 2011-05-23 H.J. Lu PR target/49128 * config/i386/driver-i386.c (host_detect_local_cpu): Always add -mno-XXX. diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 35962c8..60dbb0b 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -681,37 +681,25 @@ const char *host_detect_local_cpu (int argc, const char **argv) if (arch) { - if (has_cmpxchg16b) - options = concat (options, " -mcx16", NULL); - if (has_lahf_lm) - options = concat (options, " -msahf", NULL); - if (has_movbe) - options = concat (options, " -mmovbe", NULL); - if (has_aes) - options = concat (options, " -maes", NULL); - if (has_pclmul) - options = concat (options, " -mpclmul", NULL); - if (has_popcnt) - options = concat (options, " -mpopcnt", NULL); - if (has_abm) - options = concat (options, " -mabm", NULL); - if (has_lwp) - options = concat (options, " -mlwp", NULL); - if (has_fma4) - options = concat (options, " -mfma4", NULL); - if (has_xop) - options = concat (options, " -mxop", NULL); - if (has_bmi) - options = concat (options, " -mbmi", NULL); - if (has_tbm) - options = concat (options, " -mtbm", NULL); - - if (has_avx) - options = concat (options, " -mavx", NULL); - else if (has_sse4_2) - options = concat (options, " -msse4.2", NULL); - else if (has_sse4_1) - options = concat (options, " -msse4.1", NULL); + const char *cx16 = has_cmpxchg16b ? " -mcx16" : " -mno-cx16"; + const char *sahf = has_lahf_lm ? " -msahf" : " -mno-sahf"; + const char *movbe = has_movbe ? " -mmovbe" : " -mno-movbe"; + const char *ase = has_aes ? " -maes" : " -mno-aes"; + const char *pclmul = has_pclmul ? " -mpclmul" : " -mno-pclmul"; + const char *popcnt = has_popcnt ? " -mpopcnt" : " -mno-popcnt"; + const char *abm = has_abm ? " -mabm" : " -mno-abm"; + const char *lwp = has_lwp ? " -mlwp" : " -mno-lwp"; + const char *fma4 = has_fma4 ? " -mfma4" : " -mno-fma4"; + const char *xop = has_xop ? " -mxop" : " -mno-xop"; + const char *bmi = has_bmi ? " -mbmi" : " -mno-bmi"; + const char *tbm = has_tbm ? " -mtbm" : " -mno-tbm"; + const char *avx = has_avx ? " -mavx" : " -mno-avx"; + const char *sse4_2 = has_sse4_2 ? " -msse4.2" : " -msse4.2"; + const char *sse4_1 = has_sse4_1 ? " -msse4.1" : " -msse4.1"; + + options = concat (options, cx16, sahf, movbe, ase, pclmul, + popcnt, abm, lwp, fma4, xop, bmi, tbm, avx, + sse4_2, sse4_1, NULL); } done: