From patchwork Tue Sep 7 09:58:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Seymour X-Patchwork-Id: 63979 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 F31F6B6EFE for ; Tue, 7 Sep 2010 19:59:04 +1000 (EST) Received: (qmail 1495 invoked by alias); 7 Sep 2010 09:59:02 -0000 Received: (qmail 1482 invoked by uid 22791); 7 Sep 2010 09:59:00 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL, BAYES_05, 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 09:58:54 +0000 X-ASG-Debug-ID: 1283853531-4a7000160000-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 84765E56B3 for ; Tue, 7 Sep 2010 09:58:51 +0000 (GMT) Received: from Exchangevs.Icerasemi.com (cluster1.icerasemi.local [192.168.1.203]) by pOrtaL.icerasemi.com with ESMTP id MegMt216LbUhVOdh for ; Tue, 07 Sep 2010 09:58:51 +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 10:58:51 +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 o879wp9i023805; Tue, 7 Sep 2010 10:58:51 +0100 Received: (from seymour@localhost) by brsbs01.icerasemi.com (8.12.11/8.12.11/Submit) id o879wpKg023802; Tue, 7 Sep 2010 10:58:51 +0100 Date: Tue, 7 Sep 2010 10:58:51 +0100 Message-Id: <201009070958.o879wpKg023802@brsbs01.icerasemi.com> From: Joe Seymour To: gcc-patches@gcc.gnu.org CC: sdkteam-gnu@icerasemi.com X-ASG-Orig-Subj: GNU Superopt patches 2/6 Subject: GNU Superopt patches 2/6 X-Barracuda-Connect: cluster1.icerasemi.local[192.168.1.203] X-Barracuda-Start-Time: 1283853531 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 moves Aux Stuff into a seperate file: Tues Aug 31 2010 Joseph Seymour * aux.c: New file containing 'Aux Stuff' previously after main in superopt.c. * superopt.c: Removed 'Aux stuff'. * superopt.h: Added check to superopt.h so only parsed by cpp once. * Makefile: Added aux.c -- Joe Seymour diff -Nup /home/seymour/testpatch/aux.c ./aux.c --- /home/seymour/testpatch/aux.c 1970-01-01 01:00:00.000000000 +0100 +++ ./aux.c 2010-08-27 14:52:58.955603000 +0100 @@ -0,0 +1,93 @@ +/* Aux stuff that should go into a separate file. */ + +#include "superopt.h" +#include +#include + +int +ffs_internal(x) + word x; +{ + int co, ci = -1; + word d; + PERFORM_FFS(d, co, x, ci); + return d; +} + +int +floor_log2 (x) + word x; +{ + register int log = -1; + while (x != 0) + log++, + x >>= 1; + return log; +} + +int +ceil_log2 (x) + word x; +{ + return floor_log2 (x - 1) + 1; +} + +const char clz_tab[] = +{ + 32,31,30,30,29,29,29,29,28,28,28,28,28,28,28,28, + 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27, + 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, + 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, + 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, + 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, + 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, + 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, + 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, +}; + +const char ctz_tab[] = +{ + 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, + 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, +}; + +const char ff1_tab[] = +{ + 32,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +}; diff -Nup /home/seymour/testpatch/Makefile ./Makefile --- /home/seymour/testpatch/Makefile 2010-08-27 15:07:48.586203000 +0100 +++ ./Makefile 2010-08-27 14:56:43.781357000 +0100 @@ -22,8 +22,8 @@ ALL_MACHINES = superopt-sparc \ superopt-sh \ superopt-hppa -OBJS = superopt.o -SRCS = superopt.c +OBJS = superopt.o aux.o +SRCS = superopt.c aux.c HDRS = run_program.def insn.def goal.def superopt.h version.h longlong.h BINDIR = /usr/local/bin INSTALL = install -c diff -Nup /home/seymour/testpatch/superopt.c ./superopt.c --- /home/seymour/testpatch/superopt.c 2010-08-27 15:08:13.113530000 +0100 +++ ./superopt.c 2010-08-27 14:51:19.480415000 +0100 @@ -2989,93 +2989,3 @@ main(int argc, char **argv) main_synth(maxmax_cost, allowed_extra_cost); exit (!success); } - -/* Aux stuff that should go into a separate file. */ - -int -ffs_internal(x) - word x; -{ - int co, ci = -1; - word d; - PERFORM_FFS(d, co, x, ci); - return d; -} - -int -floor_log2 (x) - word x; -{ - register int log = -1; - while (x != 0) - log++, - x >>= 1; - return log; -} - -int -ceil_log2 (x) - word x; -{ - return floor_log2 (x - 1) + 1; -} - -const char clz_tab[] = -{ - 32,31,30,30,29,29,29,29,28,28,28,28,28,28,28,28, - 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27, - 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, - 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, - 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, - 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, - 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, - 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, - 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, -}; - -const char ctz_tab[] = -{ - 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, - 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, -}; - -const char ff1_tab[] = -{ - 32,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, -}; diff -Nup /home/seymour/testpatch/superopt.h ./superopt.h --- /home/seymour/testpatch/superopt.h 2010-08-27 15:08:13.116530000 +0100 +++ ./superopt.h 2010-08-27 14:53:38.706951000 +0100 @@ -16,6 +16,9 @@ with this program; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef SUPEROPT_HEADERS +#define SUPEROPT_HEADERS + #if !(defined(SPARC) || defined(POWER) || defined(POWERPC) || defined(M88000) \ || defined(AM29K) || defined(MC68000) || defined(MC68020) \ || defined(I386) || defined(PYR) || defined(ALPHA) || defined(HPPA) \ @@ -151,7 +154,6 @@ typedef unsigned_word word; #define PSTR "0x%x" #endif - #define TRUNC_CNT(cnt) ((unsigned) (cnt) % BITS_PER_WORD) #if defined(sparc) || defined(__GNUC__) @@ -1480,3 +1482,5 @@ run_program(insn_t *sequence, int n_insn extern const char clz_tab[]; extern const char ctz_tab[]; extern const char ff1_tab[]; + +#endif // ifdef SUPEROPT_HEADERS