From patchwork Mon Sep 26 06:58:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1352744wrt; Mon, 26 Sep 2022 00:00:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VAAC4XIUXoD3FPssG3DNSNDC3qYChHznqxX5vkffoNbfO1TyluW3yZnwoRhWh8bRkWfXp X-Received: by 2002:a17:907:c09:b0:781:ea21:3f69 with SMTP id ga9-20020a1709070c0900b00781ea213f69mr16086812ejc.413.1664175653246; Mon, 26 Sep 2022 00:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664175653; cv=none; d=google.com; s=arc-20160816; b=f61K751hii8YwXqtstport/uuPTWChEbpOENEcpyFKhbtm2MfLwwhIlNHuhV2ZkeWJ rF5yL5lZJ7P6xtU8ouWt5crTKRxpuU9m6bQFj6zDyIPnRA+WLD58r/lp8ycD0mGP8NuF +15E1DosIay+i/SsW2BCBf28eGTe0HANhxIPu77n963utSK5nxZeKxRaZ+P9qGsopAep Y3/wfKm7+bw9/+8m0Bu6/TJEDfD5yb7GCv0Efd8R2POixVQv42ECT/k1bJLHOaRA7Pmu 4Z7Ky+Mwm1oLie8SejxKa9pQ2zvZOVGBSwK7UnaGD5TujW09B99BZXAlT01+5hYE38gw gXmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ik0rKALi45v+kvUL9tmTlhlnpO1Ie0XT4rNDYqgsFD8=; b=OjjFtUNvQwDXSfO3GWmz5scH6ugDJ4beKZH6irb1GglvbtogtP0gC2bcaW/cNJg4tS pdIV5z9F+XjopML6e71L0U1+nX7i4L2v6lr6NVyhktaQSO+UHR+YwyWoMUmj3Xf7ya3T GXoFSaLJPMQQpd/crPtVpDLc18hI8dmBm8Sp0OTVqSBr6Bmz2YHE0/MgjHZ+2shpGhQ9 7/OGuv/lLfQWdsy8WmyiEaogCSpsXmQDiGAkYtLGrT5O20O1fejv4ztE5bAx3sIJeWHj QeC+VTms1CXqUUp3IIrQEAJATNQTMRs8QxqcQs+U51JzatcMN+jTQjqmCwUzPYIB2fHD 1khA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ij8v32PM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y72-20020a50bb4e000000b00454887937c7si13892274ede.456.2022.09.26.00.00.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 00:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ij8v32PM; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D424C385AC2D for ; Mon, 26 Sep 2022 07:00:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D424C385AC2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664175602; bh=ik0rKALi45v+kvUL9tmTlhlnpO1Ie0XT4rNDYqgsFD8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ij8v32PM8tBn7+cjPyzAx8k1Hzb4mir76IJROAafZ9uhleQpnDzN4vtczE8Iaqty+ YcIzNStzCNsDCRyTtF6p6pAqwLQXnB0b1IiPIUCAgTvh60fBuHKuXMvKPRDUkEp1AR EqUQ86VvGwNc2GAfBU7CmRzbUyDXKzNdaeT0c3Jk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id BF7793858281 for ; Mon, 26 Sep 2022 06:58:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BF7793858281 Received: from xry111-x57s1.. (unknown [IPv6:240e:358:1124:1b00:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id E6BDB65C79; Mon, 26 Sep 2022 02:58:18 -0400 (EDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] LoongArch: Pass cache information to optimizer Date: Mon, 26 Sep 2022 14:58:05 +0800 Message-Id: <20220926065805.15717-1-xry111@xry111.site> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, TXREP, T_PDS_OTHER_BAD_TLD 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: , X-Patchwork-Original-From: Xi Ruoyao via Gcc-patches From: Xi Ruoyao Reply-To: Xi Ruoyao Cc: Chenghua Xu , Lulu Cheng , Wang Xuerui 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?1745014649580580123?= X-GMAIL-MSGID: =?utf-8?q?1745014649580580123?= Currently our cache information from -mtune is not really used, pass it to the optimizer so it will be really in-effect. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_option_override_internal): Set the corresponding params for L1D cache line size, L1D cache size, and L2D cache size. --- gcc/config/loongarch/loongarch.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 98c0e26cdb9..81594cf5b98 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "context.h" #include "builtins.h" #include "rtl-iter.h" +#include "opts.h" /* This file should be included last. */ #include "target-def.h" @@ -6096,6 +6097,16 @@ loongarch_option_override_internal (struct gcc_options *opts) if (loongarch_branch_cost == 0) loongarch_branch_cost = loongarch_cost->branch_cost; + const loongarch_cache &tune_cache = + loongarch_cpu_cache[la_target.cpu_tune]; + + SET_OPTION_IF_UNSET (opts, &global_options_set, param_l1_cache_line_size, + tune_cache.l1d_line_size); + SET_OPTION_IF_UNSET (opts, &global_options_set, param_l1_cache_size, + tune_cache.l1d_size); + SET_OPTION_IF_UNSET (opts, &global_options_set, param_l2_cache_size, + tune_cache.l2d_size); + if (TARGET_DIRECT_EXTERN_ACCESS && flag_shlib) error ("%qs cannot be used for compiling a shared library", "-mdirect-extern-access");