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 042B43858D1E for ; Tue, 18 Apr 2023 13:17:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 042B43858D1E 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=1681823832; bh=rdhkNKWBjafPU5BEMgkU4Zsr9BtHemrYR+8oqAg+S34=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Vxl1L1Np8nmDo1TLiM7tSnxDlMLkruRNSlkNkcQmDDDOOf0RKjmhtKPbLgIdIgDVe UXQuc4b+lXjo49bjX/4igYWGQbtTM3suS/QdaaulfQgyR4GUDhE/URkg3oq5lisV4v IjbrF8KMOk7JU7EG+CTvOg6d8Zavo8LFXsHKCsxM= Received: from [192.168.124.11] (unknown [115.155.1.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) 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 8B8AA66394; Tue, 18 Apr 2023 09:17:10 -0400 (EDT) Message-ID: Subject: Re: [PATCH] LoongArch: Set 4 * (issue rate) as the default for -falign-functions and -falign-loops From: Xi Ruoyao To: Lulu Cheng , gcc-patches@gcc.gnu.org Cc: WANG Xuerui , Chenghua Xu Date: Tue, 18 Apr 2023 21:16:51 +0800 In-Reply-To: <0c8216d3-c40d-fa38-5cd5-129b4c3a81bb@loongson.cn> References: <20230418121753.50830-1-xry111@xry111.site> <0c8216d3-c40d-fa38-5cd5-129b4c3a81bb@loongson.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,LIKELY_SPAM_FROM,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On Tue, 2023-04-18 at 21:06 +0800, Lulu Cheng wrote: > Hi, ruoyao: >=20 > Thank you so much for making this submission. But we are testing the=20 > impact of these two alignment parameters >=20 > (also including -falign-jumps and -falign-lables ) on performance. So=20 > before the result comes out, this patch will >=20 > not be merged into the main branch for the time being. Ok, I'll wait for the result. >=20 > Thanks! >=20 > =E5=9C=A8 2023/4/18 =E4=B8=8B=E5=8D=888:17, Xi Ruoyao =E5=86=99=E9=81=93: > > According to Xuerui's LLVM changeset [1], doing so can make a > > significant performace gain. > >=20 > > Bootstrapped and regtested on loongarch64-linux-gnu.=C2=A0 Ok for GCC 1= 4? > >=20 > > [1]:https://reviews.llvm.org/D148622 > >=20 > > gcc/ChangeLog: > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* config/loongarch/loon= garch.cc > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(loongarch_option_overr= ide_internal): If -falign-functions > > is > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0used but the alignment = is not explicitly specified, set it > > to > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A04 * loongarch_issue_rat= e ().=C2=A0 Likewise for -falign-loops. > > --- > > =C2=A0 gcc/config/loongarch/loongarch.cc | 11 +++++++++++ > > =C2=A0 1 file changed, 11 insertions(+) > >=20 > > diff --git a/gcc/config/loongarch/loongarch.cc > > b/gcc/config/loongarch/loongarch.cc > > index 06fc1cd0604..6552484de7c 100644 > > --- a/gcc/config/loongarch/loongarch.cc > > +++ b/gcc/config/loongarch/loongarch.cc > > @@ -6236,6 +6236,17 @@ loongarch_option_override_internal (struct > > gcc_options *opts) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && !opts->x_optimize_size) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 opts->x_flag_prefetch_loop_arrays =3D 1; > > =C2=A0=20 > > +=C2=A0 /* Align functions and loops to (issue rate) * (insn size) to > > improve > > +=C2=A0=C2=A0=C2=A0=C2=A0 the throughput of the fetching units.=C2=A0 *= / > > +=C2=A0 char *align =3D XNEWVEC (char, 16); > > +=C2=A0 sprintf (align, "%d", loongarch_issue_rate () * 4); > > + > > +=C2=A0 if (opts->x_flag_align_functions && !opts->x_str_align_function= s) > > +=C2=A0=C2=A0=C2=A0 opts->x_str_align_functions =3D align; > > + > > +=C2=A0 if (opts->x_flag_align_loops && !opts->x_str_align_loops) > > +=C2=A0=C2=A0=C2=A0 opts->x_str_align_loops =3D align; > > + > > =C2=A0=C2=A0=C2=A0 if (TARGET_DIRECT_EXTERN_ACCESS && flag_shlib) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 error ("%qs cannot be used for compiling= a shared library", > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "-mdirect-= extern-access"); >=20 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University