From patchwork Thu Mar 9 02:16:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayshao-oc X-Patchwork-Id: 66556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp47551wrd; Wed, 8 Mar 2023 18:17:22 -0800 (PST) X-Google-Smtp-Source: AK7set9v/EW8KhyskIC4aqJX/tXGXklE+tbhnJA+AIIMalrgGKxnzLhvAOGpsNbUwsIrpPN1dlth X-Received: by 2002:a17:906:9382:b0:8e5:40d0:f831 with SMTP id l2-20020a170906938200b008e540d0f831mr18950328ejx.43.1678328242146; Wed, 08 Mar 2023 18:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678328242; cv=none; d=google.com; s=arc-20160816; b=MAGsLyjoID+SjdJx0adxpwqXSUlQg3/2fy+zs4uHOwc1sfvRKQf0ItliB0WTvE2sIt zloAAli4LG8MyAGj5alJBGiBlKip7ePrsCf0S29v5/od1wE/l03p2YX17eVAg8In225S VtRfHXWh0jqD6SVmkCzN79UrzyS3lF1IhGoods7cZ2ZE7gHmpXsR0EfVlAQo+MMGquyw ME0jJ0xqTvgCwtX1gOPFC0j1dPeCpkulSSBU4I7mbTg8DEvov4t+Y8jIHb/betRhGw2J wp8fg4a1oPpJU09lg8iXMbVWg53W/MzYgOf42ub7ykyy6PTpH0sgelE7Cm3abrMSKFlQ 1uhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dmarc-filter :delivered-to; bh=Xy5kEcq8Zu63HGwcczErp9W/jYutzHb02zdftpObOnk=; b=Ij+IhWeRVlVEv4eG3WfKlBiKGlTR/00NWqp19PDTeXR/KzYwkXQeDLfGSSQr94lnSs SUvyc4N2PFsAyefKxlsnFF9/L3HeIHOxNSDMpumJ0ll8RnzkHwpQJ5m/shJxv3OJDF+d BdI5nUCRTKcPfgJkuAAQN6eC1B6KEdhQPXpWs3wh5jQWwgDcQ1DYjHpNETln9GgP1uHg rPAZ+jsD5DSfTKMLCEIEdyXYaUG7+n5Y5D3kDpj1JOZHsvPq1711l2e9/OOntPPnzd2Y 6ZDGsenPFXGsuyw9mp570FHrnv/ua8JwW3r7LYw6ue/+SA/rznS6EB9qO0mZpsdd/jG7 3pZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 14-20020a170906300e00b008e1a91a7b8csi4017294ejz.968.2023.03.08.18.17.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 18:17:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0FE4B384D174 for ; Thu, 9 Mar 2023 02:16:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.zhaoxin.com (mx2.zhaoxin.com [203.110.167.99]) by sourceware.org (Postfix) with ESMTPS id A384F3858022 for ; Thu, 9 Mar 2023 02:16:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A384F3858022 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=zhaoxin.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zhaoxin.com X-ASG-Debug-ID: 1678328181-1eb14e6d7902780001-Gfy7bY Received: from ZXSHMBX1.zhaoxin.com (ZXSHMBX1.zhaoxin.com [10.28.252.163]) by mx2.zhaoxin.com with ESMTP id 6OybEor7ficmRf6B (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 09 Mar 2023 10:16:21 +0800 (CST) X-Barracuda-Envelope-From: Mayshao-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 Received: from ZXBJMBX02.zhaoxin.com (10.29.252.6) by ZXSHMBX1.zhaoxin.com (10.28.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Mar 2023 10:16:20 +0800 Received: from zhaoxin.zhaoxin.com (10.29.8.5) by ZXBJMBX02.zhaoxin.com (10.29.252.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 9 Mar 2023 10:16:20 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.163 From: mayshao X-Barracuda-RBL-Trusted-Forwarder: 10.29.252.6 To: CC: , , , , , , mayshao-oc Subject: [gcc12 backport] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758] Date: Thu, 9 Mar 2023 10:16:20 +0800 X-ASG-Orig-Subj: [gcc12 backport] i386: Call get_available_features for all CPUs with max_level >= 1 [PR100758] Message-ID: <20230309021620.19719-1-mayshao-oc@zhaoxin.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.29.8.5] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX02.zhaoxin.com (10.29.252.6) X-Barracuda-Connect: ZXSHMBX1.zhaoxin.com[10.28.252.163] X-Barracuda-Start-Time: 1678328181 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.36:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 2228 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0265 1.0000 -1.8490 X-Barracuda-Spam-Score: -1.85 X-Barracuda-Spam-Status: No, SCORE=-1.85 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.105774 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759854714578051874?= X-GMAIL-MSGID: =?utf-8?q?1759854714578051874?= From: mayshao-oc Hi Jakub: This is backport of the fix for PR target/100758 from mainline to the gcc12 release branch. Because the bug still exists in gcc12 on Zhaoxin platform, and it will incur ISA feature detection failure, we want to fix it as the mainline.This patch has been retested against the gcc12 branch on Intel, Amd, Zhaoxin with make bootstrap and make -k check without failure. Ok for the gcc12 branch? BR Mayshao gcc/ChangeLog: PR target/100758 * common/config/i386/cpuinfo.h (cpu_indicator_init): Call get_available_features for all CPUs with max_level >= 1, rather than just Intel, AMD. --- gcc/common/config/i386/cpuinfo.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index 388f4798406..0333da56ba5 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -910,6 +910,10 @@ cpu_indicator_init (struct __processor_model *cpu_model, extended_model = (eax >> 12) & 0xf0; extended_family = (eax >> 20) & 0xff; + /* Find available features. */ + get_available_features (cpu_model, cpu_model2, cpu_features2, + ecx, edx); + if (vendor == signature_INTEL_ebx) { /* Adjust model and family for Intel CPUS. */ @@ -924,9 +928,6 @@ cpu_indicator_init (struct __processor_model *cpu_model, cpu_model2->__cpu_family = family; cpu_model2->__cpu_model = model; - /* Find available features. */ - get_available_features (cpu_model, cpu_model2, cpu_features2, - ecx, edx); /* Get CPU type. */ get_intel_cpu (cpu_model, cpu_model2, cpu_features2); cpu_model->__cpu_vendor = VENDOR_INTEL; @@ -943,9 +944,6 @@ cpu_indicator_init (struct __processor_model *cpu_model, cpu_model2->__cpu_family = family; cpu_model2->__cpu_model = model; - /* Find available features. */ - get_available_features (cpu_model, cpu_model2, cpu_features2, - ecx, edx); /* Get CPU type. */ get_amd_cpu (cpu_model, cpu_model2, cpu_features2); cpu_model->__cpu_vendor = VENDOR_AMD;