From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50514 invoked by alias); 7 Jun 2017 10:15:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 50425 invoked by uid 89); 7 Jun 2017 10:15:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Impact X-HELO: EUR03-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr30078.outbound.protection.outlook.com (HELO EUR03-AM5-obe.outbound.protection.outlook.com) (40.107.3.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Jun 2017 10:15:50 +0000 Received: from VI1PR0801MB2031.eurprd08.prod.outlook.com (10.173.74.140) by VI1PR0802MB2544.eurprd08.prod.outlook.com (10.175.20.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Wed, 7 Jun 2017 10:15:50 +0000 Received: from VI1PR0801MB2031.eurprd08.prod.outlook.com ([fe80::b9d4:b6e7:35f9:e399]) by VI1PR0801MB2031.eurprd08.prod.outlook.com ([fe80::b9d4:b6e7:35f9:e399%17]) with mapi id 15.01.1143.018; Wed, 7 Jun 2017 10:15:50 +0000 From: Tamar Christina To: Kyrill Tkachov , GCC Patches CC: nd , Ramana Radhakrishnan , Richard Earnshaw , "nickc@redhat.com" Subject: RE: [PATCH][GCC][ARM] Adjust costs so udiv is preferred over sdiv when both are valid. [Patch (2/2)] Date: Wed, 07 Jun 2017 10:15:00 -0000 Message-ID: References: <5937CF90.9040506@foss.arm.com> In-Reply-To: <5937CF90.9040506@foss.arm.com> authentication-results: foss.arm.com; dkim=none (message not signed) header.d=none;foss.arm.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0802MB2544;7:X79POApk79yF36ysF+ypFqxEVp6Nz6jSfnKok3cfJISy1Ba2bQ9d8vUzABerXYJDgXdpQcQtAXV204FzTmwVMAObQXkdUamEaDLxGfYlsK3QxwP60RwEl/ZXztzwZ53KKDbnPYD0rqcMkxPdEttGNKT90pQMovK+OKx+wX4yb1I4QFZajvF9N4oIZnOYMdEWYTNiiGURjM6QS0GG3jwTfvQ2nYkljy7W0M0yhbKgO45ZWsllguVOKkkOlqLSDl9j3Xqm8D8t+g9XfuT8k9DLpA6dSyuXCrYkISxlgqa/mQ1KSb+rGg92ammADJcFU41sWmb4Z3GPd17cehJhM6RtgA== x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-traffictypediagnostic: VI1PR0802MB2544: x-ms-office365-filtering-correlation-id: ed767f31-511b-4cc8-ff3f-08d4ad8e2c4f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:VI1PR0802MB2544; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(201703131423075)(201703011903075)(201702281528075)(201703061421075)(20161123564025)(20161123555025)(20161123558100)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR0802MB2544;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR0802MB2544; x-forefront-prvs: 03319F6FEF x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39450400003)(39400400002)(39840400002)(39860400002)(39410400002)(39850400002)(25786009)(6246003)(54356999)(189998001)(76176999)(7696004)(3280700002)(229853002)(53936002)(14454004)(3660700001)(38730400002)(50986999)(86362001)(9686003)(33656002)(54906002)(2950100002)(575784001)(55016002)(6506006)(4326008)(5250100002)(99286003)(72206003)(7736002)(2900100001)(66066001)(508600001)(74316002)(8936002)(5660300001)(2906002)(102836003)(6116002)(8676002)(305945005)(3846002)(81166006)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0802MB2544;H:VI1PR0801MB2031.eurprd08.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2017 10:15:50.1015 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2544 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00415.txt.bz2 Hi Kyrill, > diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index > b24143e32e2f100000f3b150f7ed0df4fabb3cc8..ecc7688b1db6309a4dd694a8e > 254e64abe14d7e3 100644 > --- a/gcc/config/arm/arm.c > +++ b/gcc/config/arm/arm.c > @@ -9258,6 +9258,8 @@ arm_rtx_costs_internal (rtx x, enum rtx_code > code, enum rtx_code outer_code, > *cost +=3D COSTS_N_INSNS (speed_p ? extra_cost->mult[0].idiv : 0); > else > *cost =3D LIBCALL_COST (2); > + > + *cost +=3D (code =3D=3D DIV ? 1 : 0); > return false; /* All arguments must be in registers. */ >=20 >=20 > We usually try to avoid adjusting the costs in units other than > COSTS_N_INSNS. > Would adding COSTS_N_INSNS (1) here work? > If so, could you also add a comment here to describe why we're adjusting = the > cost. It would, I'm just slightly worried it might end up generating different co= de for DIV then. The reason I have used a unit smaller than COSTS_N_INSNS it so that it shou= ld have any real Impact on any other optimization as the cost is likely treated as an intege= r? It's only for things that Compare the costs values between signed and unsigned would the small unit m= ake a difference. Since I think the compiler still has some hard coded cost limits somewhere = it may be an issue, but I'm not 100% certain. I can make the change though. >=20 > case MOD: > @@ -9280,7 +9282,7 @@ arm_rtx_costs_internal (rtx x, enum rtx_code > code, enum rtx_code outer_code, >=20 > /* Fall-through. */ > case UMOD: > - *cost =3D LIBCALL_COST (2); > + *cost =3D LIBCALL_COST (2) + (code =3D=3D MOD ? 1 : 0); >=20 > Same here. >=20 > Thanks, > Kyrill >=20