🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50962

gcc and SPEC eqntott

#50962
From: Henry McNair
Date: Thu, 15 Jul 1993 21:04
81 lines
3466 bytes
To whomever:

BACKGROUND:

  I recently joined Motorola in Urbana, Ill. to work on gcc.
  My first assignment is to improve the performance of the
  SPEC benchmark called eqntott. I have done some profiling of
  eqntott compiled with gcc on SVR4 using an m88110 chip. It
  seems that about 88% of the time is spent in a loop that looks
  like:

#include <stdio.h>
#include "x.h"
extern int ninputs, noutputs;

int cmppt (a, b)
PTERM *a[], *b[];
/*
 * compare product terms indirectly pointed to by a and b.
 */
{
	register int i, aa, bb;

	for (i = 0; i < ninputs; i++) {
		aa = a[0]->ptand[i];
		bb = b[0]->ptand[i];
		if (aa == 2)
			aa = 0;
		if (bb == 2)
			bb = 0;
		if (aa != bb) {
			if (aa < bb) {
				return (-1);
			}
			else	{
				return (1);
			}
		}
	}
	return (0);
}

  Now apparently there is a trick to optimizing this routine. It involves
  inserting code between the load of bb and the first jump.
  The code is of the form:
    if (aa == bb) continue;
  Given the data set of eqntott, this additional code makes a significant
  improvement in performance of eqntott. (Some of us question if such an
  optimization is really an improvement if an arbitrary data set was 
  choosen. On the other hand, management feels that we(i.e. I) must improve
  eqntott's performance using gcc because our competition - Sun, HP, and
  IBM as well as another Motorola compiler being developed internally -
  are all using this hack. Unfortunately, my hands are tied.)

PROBLEM:
  My problem is basically twofold. First, how do I recognize the above
  loop in RTL and add the required code fragment. Second, if I were
  to come up with a solution for gcc/m88k, should I try to generalize
  it for all architecture supported by gcc (i.e. make it architecture
  independent).

  I am 'just beginning' to study gcc and RTL, (like two weeks worth of 
  'just beginning'). In one case however, a developer who has done some
  work on gcc believes that the internal data structures of gcc are not
  rich enough to support the kind of analysis needed to generate this
  optimization.

  Any meaningful insight as to how gcc maybe be molded to perform such
  an optimization would be appreciated. I am not looking for a 
  specific solution in terms of code actually written. What would be
  nice would be to get a pointer to some internal data structures
  or a plan of implementation that would be consistent with the internals
  of gcc. (I would prefer not to break something in the process of
  trying to add another thing.)

-------------------------------------------------------------------------
Henry McNair                        hmcnair@urbana.mcd.mot.com
Motorola, Inc.
1101 E. University Aveune
Urbana, Ill. 61801
Technical Details
Message-ID: <9307152055.AA14020@pacific.urbana.mcd.mot.com>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!doc.ic.ac.uk!agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!pacific.urbana.mcd.mot.com!hmcnair

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,fe76432e69eb01e,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-07-15 16:03:24 PST
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!doc.ic.ac.uk!agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!pacific.urbana.mcd.mot.com!hmcnair
From: hmcnair@pacific.urbana.mcd.mot.com (Henry McNair)
Newsgroups: gnu.gcc.help
Subject: gcc and SPEC eqntott
Date: 15 Jul 1993 17:04:27 -0400
Organization: GNUs Not Usenet
Lines: 81
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Message-ID: <9307152055.AA14020@pacific.urbana.mcd.mot.com>