From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id DD62A386F81F for ; Wed, 26 Aug 2020 21:30:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DD62A386F81F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-A-uQsbfrOwWYTzSkRjvy8Q-1; Wed, 26 Aug 2020 17:30:27 -0400 X-MC-Unique: A-uQsbfrOwWYTzSkRjvy8Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CAC4425D2; Wed, 26 Aug 2020 21:30:26 +0000 (UTC) Received: from ovpn-112-190.phx2.redhat.com (ovpn-112-190.phx2.redhat.com [10.3.112.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 380A07A41C; Wed, 26 Aug 2020 21:30:26 +0000 (UTC) Message-ID: Subject: Re: [PATCH] hppa: Improve expansion of ashldi3 when !TARGET_64BIT From: Jeff Law Reply-To: law@redhat.com To: Roger Sayle , 'John David Anglin' , 'GCC Patches' Date: Wed, 26 Aug 2020 15:30:25 -0600 In-Reply-To: <005201d67bef$1816b5b0$48442110$@nextmovesoftware.com> References: <044501d677ba$099a5520$1cceff60$@nextmovesoftware.com> <6942a7b4-ec9b-0278-21e0-fa2f6a13b09b@bell.net> <00c701d67861$a1c37370$e54a5a50$@nextmovesoftware.com> <42249873-db65-322f-1305-3295e8ca27f6@bell.net> <000901d6789d$8bdd40e0$a397c2a0$@nextmovesoftware.com> <001501d678db$56a34580$03e9d080$@nextmovesoftware.com> <709e096b57a340e75084980d27c43229099ac87a.camel@redhat.com> <005201d67bef$1816b5b0$48442110$@nextmovesoftware.com> Organization: Red Hat User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Wed, 26 Aug 2020 21:30:31 -0000 On Wed, 2020-08-26 at 22:23 +0100, Roger Sayle wrote: > The failure of slsr-13.c is not caused by the patchh3.txt, but the previous patchh2.txt > that's now on mainline and the gcc-10 branch. That change provided more accurate > rtx_costs for hppa, and solved the performance problems with synth_mult. > > These more accurate target rtx_costs are used by the gimple-ssa-strength-reduction.c > (via a call to mult_by_coeff_cost) to decide whether applying strength reduction would > be profitable. This test case, slsr-13.c, assumes that two multiplications by four are > cheaper than two multiplications by five. (I believe) This is not the case on hppa which > has a sh2add instruction, that performs a multiplication by five in one cycle, or exactly > the same cost as performing a left shift by two (i.e. a multiplication by four). Oddly, I > also believe this isn't the case on x86_64, where the similar lea instruction is (sometimes) > as efficient as left shift by two bits. Yea, you can do a multiplication by 5 cheap on the PA. While the x86 can too, I don't think it's as clear cut a win as the PA, so they may not cost the same as a multiply by 4 or left shift by 2. > > I suspect that slsr-13.c should be expected to fail on some platforms depending upon > a targets instruction set/timings. Sounds like you're right since it depends on mult_by_coeff_cost under the hood :( I presume you or John will xfail it for the PA. > > Unfortunately, to complicate things in our case, it appears that after RTL optimizations, > performing this strength reduction actually does results in fewer instructions on the PA, > so it's the right thing to do. I'll need to study the logic in gimple-ssa-strength to see > how mult_by_coeff cost is being used; cost(x*4) == cost(x*5), but cost(x*4+y) < cost(x*5+y). Yea, x*4+y is cheaper than x*5+y on the PA. The first is a single sh2add, the second requires an additional add instruction. Jeff