Article View: gnu.gcc.help
Article #53488Re: registers: globals and argument passing
From: Michael Gschwind - EECS
Date: Thu, 26 Dec 1991 21:59
Date: Thu, 26 Dec 1991 21:59
53 lines
2690 bytes
2690 bytes
In article <1991Dec19.174056.21785@umbc3.umbc.edu> alex@umbc4.umbc.edu (Alex S. Crain) writes:
I need a IEEE floating point emulation library for a 68K machine.
I've been working on Scott McCauley's gnulib, and I would like to improve
the speed by:
(a) using global registers for internal quantities. This works fine,
except that I have to explicitly save the registers at the entry points. Is
there any way to tell gcc to saev the registers at the link stage, as part of
the movem instruction?
(b) since these calls are generated internally by gcc, is there any
way to get gcc to pass the arguments in registers? I don't want to use
registers for everything, just for calls to _addf2 (), et al.
One way to fix this might be to add define_insn clauses to do the
work, e.g.:
(define_insn "addsf3"
[(set (match_operand:SF "register_operand" "X")
(plus:SF (match_operand:SF "register_operand" "Y")
(match_operand:SF "register_operand" "Z")))
(clobber (reg:SF 3)) ; if you clobber register 3
(clobber (cc0))]
"TARGET_SOFT_FLOAT"
"jsr _addsf3")
X, Y, Z are constraints on the register operands, e.g. X matches only
register 0, Y register 1, Z register 2.
This way you emit the right calls, get the parameters in the registers
and get all the clobber information to the register allocator.
Compiling the floating point lib might be a bit tricky:
If you clobber register 3, you could compile with -fcaller-savesd3.
Making the libraries find the arguments needs a trick:
/* assume that _float is the name of the data type where you store the
float value - I don't recall the name of this structure.... */
addsf()
{
register _float parameter1 asm("d1");
register _float parameter2 asm("d2");
.... use parameter1 and parameter2 as usual...
}
hope this helps,
mike
Technical Details
Message-ID:
<MIKEG.91Dec26135907@decserv2.eecs.wsu.edu>Path:
arc1-ca.pugleaf.net!gmdzi!ira.uka.de!sol.ctr.columbia.edu!ucselx!network.ucsd.edu!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!ogicse!uidaho!serval!eecs.wsu.edu!mikegReferences:
<1991Dec19.174056.21785@umbc3.umbc.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,1b701f58ca2017a4,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1991-12-26 18:05:54 PST Path: arc1-ca.pugleaf.net!gmdzi!ira.uka.de!sol.ctr.columbia.edu!ucselx!network.ucsd.edu!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!ogicse!uidaho!serval!eecs.wsu.edu!mikeg From: mikeg@eecs.wsu.edu (Michael Gschwind - EECS) Newsgroups: gnu.gcc.help Subject: Re: registers: globals and argument passing Message-ID: <MIKEG.91Dec26135907@decserv2.eecs.wsu.edu> Date: 26 Dec 91 21:59:07 GMT References: <1991Dec19.174056.21785@umbc3.umbc.edu> Sender: news@serval.net.wsu.edu (USENET News System) Organization: Washington State University Lines: 53 In-Reply-To: alex@umbc4.umbc.edu's message of 19 Dec 91 17:40:56 GMT