From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1664175504; bh=8RT1XOMbNU63WhIwKvgvGRW24sc+OqNiGXsEC2WYn2U=; h=From:To:Cc:Subject:Date:From; b=SxL3DlLPBTL2X+hKvHBB6Ypm29Rxs2kxI/F2ddFqq5BxhNCUJNX6G/BoXIsovTHEO YX++nOaWlaJnTVp87zokWHSQQiCxkRL/4SHx1jcVTRLmWspID+Xg5Ko5ljCMgizaGK mq2O82MTSDv3pZQjs0FmoAjDB87uFy1fa8uGmRC8= 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) From: Xi Ruoyao To: gcc-patches@gcc.gnu.org Cc: Lulu Cheng , Wang Xuerui , Chenghua Xu , Xi Ruoyao 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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"); -- 2.37.0