From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22034 invoked by alias); 28 Jul 2010 15:40:43 -0000 Received: (qmail 22024 invoked by uid 22791); 28 Jul 2010 15:40:42 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_TM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (217.140.96.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 15:40:31 +0000 Received: from cam-owa1.Emea.Arm.com (cam-owa1.emea.arm.com [10.1.255.62]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id o6SFeEF9012563; Wed, 28 Jul 2010 16:40:14 +0100 (BST) Received: from [10.1.66.29] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 28 Jul 2010 16:40:14 +0100 Subject: Re: Extend widening_mul pass to handle fixed-point types From: Ramana Radhakrishnan Reply-To: ramana.radhakrishnan@arm.com To: Bernd Schmidt Cc: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com In-Reply-To: <4C4F009B.6040201@codesourcery.com> References: <87fwzhro8i.fsf@firetop.home> <4C436835.20307@codesourcery.com> <87oce3s4kv.fsf@firetop.home> <4C44C948.3050801@codesourcery.com> <1280233130.18689.17.camel@e102325-lin.cambridge.arm.com> <4C4F009B.6040201@codesourcery.com> Content-Type: text/plain Date: Wed, 28 Jul 2010 15:43:00 -0000 Message-Id: <1280331613.18689.137.camel@e102325-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2010-07/txt/msg02185.txt.bz2 On Tue, 2010-07-27 at 17:51 +0200, Bernd Schmidt wrote: > On 07/27/2010 02:18 PM, Ramana Radhakrishnan wrote: > > > > On Mon, 2010-07-19 at 23:53 +0200, Bernd Schmidt wrote: > >> That's pretty much what I had in mind. Ok if it passes testing. > > > > This broke bootstraps on arm-linux-gnueabi and caused > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45067 . > > > > Taking a brief look at it this morning, I think the problem here is that > > the call to optab_for_tree_code is made with the wrong type of the > > expression. The presence of a widening optab for a WIDEN_MULT_PLUS_EXPR > > should be based on the type of ops->op2 rather than opnd0 because you > > have something like intval0 = shortval1 * shortval2 + intval1 whereas > > the expander is testing for a widening mult and plus where the results > > are into a HImode value and thus effectively for a widening operation > > into an HImode value. > > > > The assert that fails is because > > gcc_assert (icode != CODE_FOR_nothing); > > > > Something like this fixes the problem for the test-cases under question > > or would you prefer something else. A full bootstrap and test is > > underway. > > > > Ok to commit if no regressions ? > > I think this is consistent with the code in tree-ssa-math-opts (there we > use the type of the lhs, which should match that of operand 2). So, OK > - I think the ARM testsuite has some widening-macc cases so you should > notice if there's something wrong. > > > + { > > + widen_pattern_optab = > > + optab_for_tree_code (ops->code, TREE_TYPE (ops->op2), > > optab_default); > > + icode = (int) optab_handler (widen_pattern_optab, > > TYPE_MODE (TREE_TYPE (ops->op2))); > > + } > > else > > - icode = (int) optab_handler (widen_pattern_optab, tmode0); > > + { > > + widen_pattern_optab = > > + optab_for_tree_code (ops->code, TREE_TYPE (oprnd0), > > optab_default); > > + icode = (int) optab_handler (widen_pattern_optab, tmode0); > > + } > > This can be written slightly more simply assigning the type to some > variable and then using that when computing widen_pattern_optab and > icode. It would be nice to change that but I won't require it. Hmmm there are regressions after my patch was applied. I had to do some rebuilds because trunk appears to be broken for other reasons at the minute for ARM which I shall investigate next. After these 2 patches to fix the ICEs on top of r162301 - I see breakages in the testsuite with execute/arith-rand.c and execute/arith-rand-ll.c . The difference in code generated is in the following case for -O2 is the following for arith-rand.c smlabb sl, r0, r7, sl | mla sl, r7, r0, sl with the failing case on the left. The problem appears to be as though the gimple pass for generating widening macs now generates a widening multiply and add for the case under question here while it didn't earlier. D.2130_36 = WIDEN_MULT_PLUS_EXPR ; We weren't generating any widening operations before this patch (and I suspect my 2 patches are just for fixing the ICE's and doing the right thing). If it were just adding support for fixed point arithmetic then this is just broken because it shouldn't have changed the way in which code was generated for normal integer operations. Ideas ? I haven't looked at this in any great depth but the essential breakages in the C only testsuite are as below [2]. The native compiler has been configured with the following options - you can see the same result using a cross-compiler with the following parameters. --with-cpu=cortex-a9 --with-fpu=vfpv3-d16 --with-float=softfp cheers Ramana [1] Trunk as of this morning gives me a miscompare in stage2 and stage3 when my patches are applied which indicates a different underlying problem, the testsuite breakages are 162301 + the two patches applied. [2] FAIL: gcc.c-torture/execute/builtins/abs-1.c execution, -O2 -fwhopr FAIL: gcc.c-torture/execute/builtins/strstr-asm.c execution, -O2 -fwhopr FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O2 FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O3 -fomit-frame-pointer FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O3 -fomit-frame-pointer -funroll-loops FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O3 -g FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -Os FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O2 -flto FAIL: gcc.c-torture/execute/arith-rand-ll.c execution, -O2 -fwhopr FAIL: gcc.c-torture/execute/arith-rand.c execution, -O2 FAIL: gcc.c-torture/execute/arith-rand.c execution, -O3 -fomit-frame-pointer FAIL: gcc.c-torture/execute/arith-rand.c execution, -O3 -fomit-frame-pointer -funroll-loops FAIL: gcc.c-torture/execute/arith-rand.c execution, -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions FAIL: gcc.c-torture/execute/arith-rand.c execution, -O3 -g FAIL: gcc.c-torture/execute/arith-rand.c execution, -Os FAIL: gcc.c-torture/execute/arith-rand.c execution, -O2 -flto FAIL: gcc.c-torture/execute/arith-rand.c execution, -O2 -fwhopr FAIL: gcc.dg/c99-stdint-1.c (test for excess errors) FAIL: gcc.dg/c99-stdint-7.c (test for excess errors) FAIL: gcc.dg/cproj-fails-with-broken-glibc.c execution test FAIL: gcc.dg/uninit-13.c unconditional (test for warnings, line 8) FAIL: gcc.dg/uninit-13.c (test for excess errors) FAIL: gcc.dg/graphite/pr44391.c (test for excess errors) FAIL: gcc.dg/lto/20081111 c_lto_20081111_0.o-c_lto_20081111_1.o execute -O2 -fwhopr FAIL: gcc.dg/lto/20081112 c_lto_20081112_0.o-c_lto_20081112_1.o execute -O2 -fwhopr FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -fwhopr -fwhole-program FAIL: gcc.dg/torture/fp-int-convert-double.c -O1 execution test FAIL: gcc.dg/torture/fp-int-convert-long-double.c -O1 execution test FAIL: gcc.dg/torture/fp-int-convert-timode.c -O1 execution test FAIL: gcc.dg/torture/pr43879_1.c -O2 -fwhopr execution test FAIL: gcc.dg/tree-ssa/pr42585.c scan-tree-dump-times optimized "struct _fat_ptr _ans" 0 FAIL: gcc.dg/tree-ssa/pr42585.c scan-tree-dump-times optimized "struct _fat_ptr _T2" 0 FAIL: gcc.dg/vect/pr43430-1.c scan-tree-dump-times vect "vectorized 1 loops" 1 FAIL: gcc.dg/vect/vect-35.c scan-tree-dump-times vect "vectorized 2 loops" 1 FAIL: gcc.dg/vect/vect-peel-3.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1 FAIL: gcc.dg/vect/vect-peel-4.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1 FAIL: gcc.dg/vect/slp-reduc-3.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1 FAIL: gcc.dg/vect/slp-reduc-6.c scan-tree-dump-times vect "vectorized 1 loops" 2 > > > Bernd