From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 2B0413858CDA for ; Mon, 26 Sep 2022 07:04:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B0413858CDA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from [10.20.4.52] (unknown [10.20.4.52]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxkOD2TjFjoRYiAA--.61894S2; Mon, 26 Sep 2022 15:04:22 +0800 (CST) Subject: Re: [PATCH] LoongArch: Pass cache information to optimizer To: Xi Ruoyao , gcc-patches@gcc.gnu.org Cc: Wang Xuerui , Chenghua Xu References: <20220926065805.15717-1-xry111@xry111.site> From: Lulu Cheng Message-ID: <79a5f56c-e526-0b71-daa9-5b0867a22f9b@loongson.cn> Date: Mon, 26 Sep 2022 15:04:22 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20220926065805.15717-1-xry111@xry111.site> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8CxkOD2TjFjoRYiAA--.61894S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KrW3Aw47Gw1fXw43XFy3XFb_yoW8AFWDpr Zruw15Gr48Arn7GryDta4rXwn5XrZrGF129a4aqrWfCF43Xr12vr18tr9xWFWUt398Jr42 qF1Sk3WY9F1UAaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUva14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCY02Avz4vE-syl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyT uYvjfU5WlkUUUUU X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,MIME_CHARSET_FARAWAY,NICE_REPLY_A,SPF_HELO_PASS,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 List-Id: This change may have to wait for the test results to determine whether to merge. ÔÚ 2022/9/26 ÏÂÎç2:58, Xi Ruoyao дµÀ: > 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");