From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8380 invoked by alias); 10 Jan 2013 17:47:12 -0000 Received: (qmail 8255 invoked by uid 48); 10 Jan 2013 17:46:42 -0000 From: "aldyh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55565] [4.8 regression] FAIL: gcc.target/powerpc/ppc-mov-1.c scan-assembler-not fmr [0-9]+,[0-9]+ Date: Thu, 10 Jan 2013 17:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aldyh at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: aldyh at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg00967.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55565 --- Comment #4 from Aldy Hernandez 2013-01-10 17:46:39 UTC --- I compared the code generated by trunk with the generated code in rev 190339 which broke the test. The trunk code is more optimal than when the test "passed", so I suggest either removing the dg-final in the test, or modifying the regex in the dg-final. In the testcase we have something functionally equivalent to (where x is the original function argument passed in f1): if (huge + x > 0.0) { if ((int)x > 0) return 0.0; ... } else return x; When the test passed, we used to generate: .L17: ld %r8,.LC0@toc(%r2) ld %r10,.LC2@toc(%r2) lfd %f13,0(%r8) lfd %f0,0(%r10) fadd %f1,%f1,%f13 fcmpu %cr7,%f1,%f0 bng %cr7,.L4 /* if (!(huge + x > 0.0)) return x; */ ... ... .L4: /* return x; */ std %r9,-8(%r1) ori 2,2,0 lfd %f1,-8(%r1) blr Notice that since we perform the fadd onto %f1, we need to reload %f1 from memory. On trunk though, we keep x/%f1 and 0.0/%f0 around so we can return them directly. We can return x/%f1 directly in one case, or copy 0.0/%f0 to the return register (%f1) in the another case. .L18: ld %r8,.LC6@toc(%r2) ld %r9,.LC1@toc(%r2) lfd %f13,0(%r8) lfd %f0,0(%r9) fadd %f13,%f1,%f13 fcmpu %cr7,%f13,%f0 bnglr %cr7 /* if (!(huge + x > 0.0)) return x; */ cmpdi %cr7,%r10,0 fmr %f1,%f0 bgelr %cr7 /* if (huge+x>0.0 && (int)x >0) return 0.0 */ Bottom line, on trunk we avoid a branch and memory load/stores. Testing a patch.