From patchwork Tue Sep 7 10:04:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Seymour X-Patchwork-Id: 63981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0F21FB6F0E for ; Tue, 7 Sep 2010 20:04:56 +1000 (EST) Received: (qmail 4661 invoked by alias); 7 Sep 2010 10:04:55 -0000 Received: (qmail 4651 invoked by uid 22791); 7 Sep 2010 10:04:53 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from portal.icerasemi.com (HELO pOrtaL.icerasemi.com) (213.249.204.90) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Sep 2010 10:04:49 +0000 X-ASG-Debug-ID: 1283853886-4a7000210000-Gfy7bY X-Barracuda-URL: http://192.168.1.243:80/cgi-bin/mark.cgi Received: from Exchangevs.Icerasemi.com (cluster1.icerasemi.local [192.168.1.203]) by pOrtaL.icerasemi.com (Spam & Virus Firewall) with ESMTP id 2A0DFE56D0 for ; Tue, 7 Sep 2010 10:04:46 +0000 (GMT) Received: from Exchangevs.Icerasemi.com (cluster1.icerasemi.local [192.168.1.203]) by pOrtaL.icerasemi.com with ESMTP id U3pvDckXN137q1hP for ; Tue, 07 Sep 2010 10:04:46 +0000 (GMT) Received: from brsbs01.icerasemi.com ([192.168.1.54]) by Exchangevs.Icerasemi.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 7 Sep 2010 11:04:45 +0100 Received: from brsbs01.icerasemi.com (localhost [127.0.0.1]) by brsbs01.icerasemi.com (8.14.2/8.14.2/Debian-2build1) with ESMTP id o87A4jpX025780; Tue, 7 Sep 2010 11:04:45 +0100 Received: (from seymour@localhost) by brsbs01.icerasemi.com (8.12.11/8.12.11/Submit) id o87A4jU8025777; Tue, 7 Sep 2010 11:04:45 +0100 Date: Tue, 7 Sep 2010 11:04:45 +0100 Message-Id: <201009071004.o87A4jU8025777@brsbs01.icerasemi.com> From: Joe Seymour To: gcc-patches@gcc.gnu.org CC: sdkteam-gnu@icerasemi.com X-ASG-Orig-Subj: GNU Superopt patches 4/6 Subject: GNU Superopt patches 4/6 X-Barracuda-Connect: cluster1.icerasemi.local[192.168.1.203] X-Barracuda-Start-Time: 1283853886 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.40136 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This one initializes first register to zero if R0_READS_ZERO is defined as 1: Tues Aug 31 2010 Joseph Seymour * superopt.c (main_synth): Conditionally set first register to zero. (test_sequence): Conditionally set first register to zero. diff -up ./superopt.c /home/seymour/tp/superopt-2.5/superopt.c --- ./superopt.c 2010-08-27 17:01:19.000000000 +0100 +++ /home/seymour/tp/superopt-2.5/superopt.c 2010-09-01 11:08:44.338227000 +0100 @@ -2543,9 +2543,16 @@ test_sequence(insn_t *sequence, int n_in { /* Update the tvalues array in each iteration, as execution of the sequence might clobber the values. (On 2-operand machines.) */ - for (i = arity - 1; i >= 0; i--) +#if R0_READS_0 + /* If the first register always reads zero, set it and place + arguments starting from second register. */ + tvalues[0] = 0; + for (i = arity; i > 0; i--) { +#else + for (i = arity-1; i >= 0; i--) { +#endif tvalues[i] = *test_set++; - + } /* Execute the synthesised sequence for the current operand values. */ #if HAS_NULLIFICATION @@ -2751,11 +2758,24 @@ main_synth(int min_cost, int maxmax_cost /* Don't pass CY_JUST_SET ever, since we don't know which of the predefined insn above set cy. */ +#if R0_READS_0 + /* If first register reads zero set it, and make sure synth + know's it starts with arity + 1 live registers. Also ensure + that eval_goal_function, gets it's args correctly (indexed + from zero). */ + values[0] = 0; + SYNTH(sequence, ii, values, goal_function_arity+ii+1, + (*eval_goal_function)(values+1), + max_cost, i, NO_PRUNE + , NOT_NULLIFY + ); +#else SYNTH(sequence, ii, values, goal_function_arity+ii, (*eval_goal_function)(values), max_cost, i, NO_PRUNE , NOT_NULLIFY ); +#endif #ifdef STATISTICS printf("\n");