🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2680

Storing small structures in reisters?

#2680
From: Matthew Self
Date: Thu, 25 May 1989 21:37
38 lines
1538 bytes
  Has anyone looked into storing small structures in registers?  For
example, a complex math package would be enormously improved if using
a complex structure incurred no more penalty than using two separate
real and imaginary part variables.  This would not require having some
large machine mode which the structure fits in, but actually
recognizing that the components of the structure can be stored in
several smaller mode registers.  Clearly a lot of bookkeeping would
have to be added to keep track of where the components of the
structure currently are, but it could be a big win....

  For example, why should foo1 and foo2 generate different code?

typedef struct {double Re, Im;} complex;

double foo1 (void)
{
  complex z;

  z.Re = 3.0;
  z.Im = 4.0;
  return (z.Re + z.Im);
}

double foo2 (void)
{
  double Re, Im;

  Re = 3.0;
  Im = 4.0;
  return (Re + Im);
}

  Am I totally off the deep end, or what?  It simply seems to me that
structures are a nice way to reduce clutter in a program, but their
use prevents any reasonable register usage, so the cost is very high.

  --Matthew
Technical Details
Message-ID: <8905252137.AA02444@bayes.arc.nasa.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!BAYES.ARC.NASA.GOV!self

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!BAYES.ARC.NASA.GOV!self
From: self@BAYES.ARC.NASA.GOV (Matthew Self)
Newsgroups: gnu.gcc.bug
Subject: Storing small structures in reisters?
Message-ID: <8905252137.AA02444@bayes.arc.nasa.gov>
Date: 25 May 89 21:37:08 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 38