From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22184 invoked by alias); 11 Feb 2004 00:40:19 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22177 invoked from network); 11 Feb 2004 00:40:18 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 11 Feb 2004 00:40:18 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id i1B0eHb13566 for ; Tue, 10 Feb 2004 19:40:17 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i1B0eGM03515; Tue, 10 Feb 2004 19:40:16 -0500 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i1B0e9X10454; Tue, 10 Feb 2004 16:40:10 -0800 Message-ID: <402979E9.7030902@redhat.com> Date: Wed, 11 Feb 2004 00:40:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 MIME-Version: 1.0 To: Joern Rennecke CC: joern.rennecke@superh.com, gdb-patches@sources.redhat.com Subject: [RFA (revised)] sh-sim, expand the opcode table Content-Type: multipart/mixed; boundary="------------020902070606080708050409" X-SW-Source: 2004-02/txt/msg00271.txt.bz2 This is a multi-part message in MIME format. --------------020902070606080708050409 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 763 Hi Joern, Here are some benchmark results. Following your advice, I took the arith-rand test, increased its main loop count until it took around 10 seconds to run on my test machine, and tested it against the eight optimization combinations that are tested for in the gcc torture test [see methodology notes attached] I found that my change increased the runtime by 1.5 to 2 percent (even when I added the new instructions that I'm working on). That didn't seem too bad to me, but I took some advice from Alex Oliva and tried simply changing the sh_jmp_table from char to short. This much simpler change increased the runtime by only 0.5 to 1 percent, at the cost of 64k more data space. So I'll withdraw my previous patch and submit the following instead: --------------020902070606080708050409 Content-Type: text/plain; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" Content-length: 2984 2004-02-10 Michael Snyder * gencode.c (table): Change from char to short. (dumptable): Change generated table from char to short. * interp.c (sh_jump_table, sh_dsp_table, ppi_table): char to short. (init_dsp): Compute size of sh_dsp_table. (sim_resume): Change jump_table from char to short. Index: gencode.c =================================================================== RCS file: /cvs/src/src/sim/sh/gencode.c,v retrieving revision 1.26 diff -p -r1.26 gencode.c *** gencode.c 27 Jan 2004 23:30:01 -0000 1.26 --- gencode.c 11 Feb 2004 00:34:36 -0000 *************** gengastab () *** 2265,2271 **** } } ! static unsigned char table[1 << 16]; /* Take an opcode, expand all varying fields in it out and fill all the right entries in 'table' with the opcode index. */ --- 2265,2271 ---- } } ! static unsigned short table[1 << 16]; /* Take an opcode, expand all varying fields in it out and fill all the right entries in 'table' with the opcode index. */ *************** dumptable (name, size, start) *** 2407,2413 **** int i = start; ! printf ("unsigned char %s[%d]={\n", name, size); while (i < start + size) { int j = 0; --- 2407,2413 ---- int i = start; ! printf ("unsigned short %s[%d]={\n", name, size); while (i < start + size) { int j = 0; Index: interp.c =================================================================== RCS file: /cvs/src/src/sim/sh/interp.c,v retrieving revision 1.14 diff -p -r1.14 interp.c *** interp.c 10 Jan 2004 00:43:28 -0000 1.14 --- interp.c 11 Feb 2004 00:34:37 -0000 *************** *** 53,59 **** #define SIGTRAP 5 #endif ! extern unsigned char sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; int sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size); --- 53,59 ---- #define SIGTRAP 5 #endif ! extern unsigned short sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; int sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size); *************** init_dsp (abfd) *** 1646,1652 **** { int i, tmp; ! for (i = sizeof sh_dsp_table - 1; i >= 0; i--) { tmp = sh_jump_table[0xf000 + i]; sh_jump_table[0xf000 + i] = sh_dsp_table[i]; --- 1646,1652 ---- { int i, tmp; ! for (i = (sizeof sh_dsp_table / sizeof sh_dsp_table[0]) - 1; i >= 0; i--) { tmp = sh_jump_table[0xf000 + i]; sh_jump_table[0xf000 + i] = sh_dsp_table[i]; *************** sim_resume (sd, step, siggnal) *** 1752,1758 **** void (*prev) (); void (*prev_fpe) (); ! register unsigned char *jump_table = sh_jump_table; register int *R = &(saved_state.asregs.regs[0]); /*register int T;*/ --- 1752,1758 ---- void (*prev) (); void (*prev_fpe) (); ! register unsigned short *jump_table = sh_jump_table; register int *R = &(saved_state.asregs.regs[0]); /*register int T;*/ --------------020902070606080708050409 Content-Type: text/plain; name="methodology" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="methodology" Content-length: 898 Benchmark Methodology Notes: Dell Precision 420 running RH 7.3 No other users, no other user processes except X and windows manager. Main loop increased from 1000 to 100000 iterations. Each test run 3 times and averaged. Time in seconds for control, 16-bit table, and split table, with percent increase. "omit" == -fomit-frame-pointer, "unroll" == -funroll-all-loops. ctrl 2table %inc 16bit %inc O0 10.862 11.044 1.7 10.884 .20 10.855 11.040 1.7 10.875 .18 O1 6.669 6.810 2.1 6.700 .46 6.660 6.805 2.2 6.700 .60 O2 6.561 6.707 2.2 6.650 1.36 6.555 6.710 2.4 6.650 1.45 O3 5.780 5.876 1.7 5.800 .34 5.780 5.875 1.6 5.800 .34 O3 omit 5.646 5.744 1.7 5.671 .44 5.640 5.740 1.8 5.670 .53 O3 omit unroll 5.636 5.744 1.9 5.664 .50 5.630 5.750 2.1 5.660 .53 O3 -g 5.772 5.875 1.8 5.799 .46 5.770 5.865 1.6 5.795 .43 Os 6.600 6.735 2.0 6.649 .74 6.590 6.730 2.1 6.650 .91 --------------020902070606080708050409--