All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] Re: Fwd: Re: Any hppa gurus?
       [not found]   ` <E16qkq2-0008AG-00.2002-03-29-01-05-55@mail7.svr.pol.co.uk>
@ 2002-03-30 15:47     ` Carlos O'Donell Jr.
  2002-03-30 17:36       ` John David Anglin
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos O'Donell Jr. @ 2002-03-30 15:47 UTC (permalink / raw)
  To: Will Newton; +Cc: parisc-linux, debian-hppa

> 
> So, are the first four floats/doubles in an arg list always passed in 
> registers?
> 
> How about func(int, float, int, double, int, float)?
> 
>

A float fits into a single fr register.
A double fits into two fr registers (fr7 (uses fr6),fr5 (uses fr4)) 


	int    gr26 - fr7    ===
	===    gr25 - fr6    ===
	int    gr24 - fr5    float
	===    gr23 - fr4    ===

I wonder what happens if the call was int,int,float... and if that
would make a difference :)

/me goes to check

Hrmm...

        int    gr26 - fr7    ===
        int    gr25 - fr6    float
        ===    gr24 - fr5    === 
        ===    gr23 - fr4    ===

Not sure why that doesn't happen in the first example. Though 
I am no guru at this :)

Any help from more knowledgable parties would be helpful.

c.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] Re: Fwd: Re: Any hppa gurus?
  2002-03-30 15:47     ` [parisc-linux] Re: Fwd: Re: Any hppa gurus? Carlos O'Donell Jr.
@ 2002-03-30 17:36       ` John David Anglin
  2002-03-30 20:11         ` Carlos O'Donell Jr.
  0 siblings, 1 reply; 6+ messages in thread
From: John David Anglin @ 2002-03-30 17:36 UTC (permalink / raw)
  To: Carlos O'Donell Jr.; +Cc: will, parisc-linux, debian-hppa

> > 
> > So, are the first four floats/doubles in an arg list always passed in 
> > registers?

No.  Although it might seem that you could pass 4 floats and 4 ints, this
is not done.  The 32-bit linux ABI is exactly the same as the 32-bit hpux ABI
except that argument relocations aren't done.  There are situations (e.g.,
indirect calls) where an argument is passed in both general and floating
registers under hpux because the linker doesn't know how to relocate
the arguments for the call.  Thus, you can't use gr24 for an int argument
and fr5 for a different float argument.

This isn't going to change as changing the ABI would require recompilation
of everthing, as well as modifications to gcc, binutils, gdb and the
runtime documentation.  You can find the HP runtime documents here:
<http://h21007.www2.hp.com/dspp/tech/tech_TechTypeListingPage_IDX/1,1704,10403,00.html>.

> > 
> > How about func(int, float, int, double, int, float)?
> > 
> >
> 
> A float fits into a single fr register.
> A double fits into two fr registers (fr7 (uses fr6),fr5 (uses fr4)) 
> 
> 
> 	int    gr26 - fr7    ===
> 	===    gr25 - fr6    ===
> 	int    gr24 - fr5    float
> 	===    gr23 - fr4    ===

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] Re: Fwd: Re: Any hppa gurus?
  2002-03-30 17:36       ` John David Anglin
@ 2002-03-30 20:11         ` Carlos O'Donell Jr.
  2002-03-30 21:32           ` John David Anglin
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos O'Donell Jr. @ 2002-03-30 20:11 UTC (permalink / raw)
  To: John David Anglin; +Cc: parisc-linux, will

> 
> No.  Although it might seem that you could pass 4 floats and 4 ints, this
> is not done.  The 32-bit linux ABI is exactly the same as the 32-bit hpux ABI
> except that argument relocations aren't done.  There are situations (e.g.,
> indirect calls) where an argument is passed in both general and floating
> registers under hpux because the linker doesn't know how to relocate
> the arguments for the call.  Thus, you can't use gr24 for an int argument
> and fr5 for a different float argument.
> 
> This isn't going to change as changing the ABI would require recompilation
> of everthing, as well as modifications to gcc, binutils, gdb and the
> runtime documentation.  You can find the HP runtime documents here:
> <http://h21007.www2.hp.com/dspp/tech/tech_TechTypeListingPage_IDX/1,1704,10403,00.html>.
>

It's clear that you can't pass 8 words, since the 32-Bit ABI says that
only the first 4 words are passed in registers as parameters for a function (2-26).

I'm not sure what's implied by the need for 4 words of "spill over" in the stack
for the first 4 arguments to the function call.

int,int,float produces:

	Produced	Produced		Expected

	int	gr26	fr7	-----		===	float
	int	gr25	fr6	float		===	-----
	---	gr24	fr5	-----		---	-----
	---	gr23	fr4	-----		---	-----

int,float,int produces:

	Produced	Produced		Expected

	int	gr26	fr7	-----		===	float
	---	gr25	fr6	-----		int	-----
	int	gr24	fr5	float		---	-----
	---	gr23	fr4	-----		---	-----

int,float,double produces:

	Produced	Produced		Expected

	int	gr26	fr7	double		===	float
	---	gr25	fr6	+++		---	---
	---	gr24	fr5	float		---	double
	---	gr23	fr4	---		---	+++


I generally read from the 274 Page pdf HPUX 11.00 v1.0
 "The 32-Bit PARISC Run-Time Architecture Document"

It's become a little game lately ;) I build some code, and try to 
second guess what the .s file will contain... and I'm usually wrong.
Which just means that I need to start looking at more code to see
how things were implemented.


Lately I was thrown by the call to printf (vararg):

char*,int,double,int,float,int,float:

	Produced		Produced	

        char		gr26	fr7	doubleH
        int		gr25	fr6	doubleL
        doubleH		gr24	fr5	-----
        doubleL		gr23	fr4	-----

Which really leaves me scratching my head, since gr24 and gr23
shouldn't be used for relocation in this case? I guess varargs
are another cute case :}

--

Re: New ABI -> Possibly minimal perforamnce increase, and loss of HPUX compatibility.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] Re: Fwd: Re: Any hppa gurus?
  2002-03-30 20:11         ` Carlos O'Donell Jr.
@ 2002-03-30 21:32           ` John David Anglin
  2002-03-30 21:56             ` John David Anglin
  2002-04-02 13:47             ` Carlos O'Donell Jr.
  0 siblings, 2 replies; 6+ messages in thread
From: John David Anglin @ 2002-03-30 21:32 UTC (permalink / raw)
  To: Carlos O'Donell Jr.; +Cc: parisc-linux, will

> It's clear that you can't pass 8 words, since the 32-Bit ABI says that
> only the first 4 words are passed in registers as parameters for a function (2-26).
> 
> I'm not sure what's implied by the need for 4 words of "spill over" in the stack

I some situations, the callee needs to save the argument registers on
the stack.  There are 4 words reserved for this.

> for the first 4 arguments to the function call.
> 
> int,int,float produces:
> 
> 	Produced	Produced		Expected
> 
> 	int	gr26	fr7	-----		===	float
> 	int	gr25	fr6	float		===	-----
> 	---	gr24	fr5	-----		---	-----
> 	---	gr23	fr4	-----		---	-----

You've got the order of the float registers reversed.  They are allocated
in order of increasing number starting with fr4.

> Lately I was thrown by the call to printf (vararg):
> 
> char*,int,double,int,float,int,float:
> 
> 	Produced		Produced	
> 
>         char		gr26	fr7	doubleH
>         int		gr25	fr6	doubleL
>         doubleH		gr24	fr5	-----
>         doubleL		gr23	fr4	-----
> 
> Which really leaves me scratching my head, since gr24 and gr23
> shouldn't be used for relocation in this case? I guess varargs
> are another cute case :}

Again, reverse the order of the float regs and it makes more sense.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] Re: Fwd: Re: Any hppa gurus?
  2002-03-30 21:32           ` John David Anglin
@ 2002-03-30 21:56             ` John David Anglin
  2002-04-02 13:47             ` Carlos O'Donell Jr.
  1 sibling, 0 replies; 6+ messages in thread
From: John David Anglin @ 2002-03-30 21:56 UTC (permalink / raw)
  To: John David Anglin; +Cc: carlos, parisc-linux, will

> You've got the order of the float registers reversed.  They are allocated
> in order of increasing number starting with fr4.

I should add that the numbering of the floating registers depends on
processor variant.  PA 1.0 had 16 floating registers holding word or
double word values.  PA 1.1 has 32 floating registers and each half
are separately addressable.  See pa32-regs.h for more details.  The
ABI was designed for the base 1.0 processor.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [parisc-linux] Re: Fwd: Re: Any hppa gurus?
  2002-03-30 21:32           ` John David Anglin
  2002-03-30 21:56             ` John David Anglin
@ 2002-04-02 13:47             ` Carlos O'Donell Jr.
  1 sibling, 0 replies; 6+ messages in thread
From: Carlos O'Donell Jr. @ 2002-04-02 13:47 UTC (permalink / raw)
  To: John David Anglin; +Cc: parisc-linux, will

> 
> I some situations, the callee needs to save the argument registers on
> the stack.  There are 4 words reserved for this.
> 

Okay. I'll see if I can find those in the documentation.

> > 	int	gr26	fr7	-----		===	float
> > 	int	gr25	fr6	float		===	-----
> > 	---	gr24	fr5	-----		---	-----
> > 	---	gr23	fr4	-----		---	-----
> 
> You've got the order of the float registers reversed.  They are allocated
> in order of increasing number starting with fr4.
> 

Ah! Excellent. After looking at some more assembly output and reading...
I should have realized that it was the other way around :) Thanks.

Now some of my register allocation guessing is coming out correct :}

Serves me right for using complex examples all the time.

c.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-02 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E16qeEE-0000jh-00.2002-03-28-18-02-27@mail6.svr.pol.co.uk>
     [not found] ` <20020328143202.I12094@systemhalted>
     [not found]   ` <E16qkq2-0008AG-00.2002-03-29-01-05-55@mail7.svr.pol.co.uk>
2002-03-30 15:47     ` [parisc-linux] Re: Fwd: Re: Any hppa gurus? Carlos O'Donell Jr.
2002-03-30 17:36       ` John David Anglin
2002-03-30 20:11         ` Carlos O'Donell Jr.
2002-03-30 21:32           ` John David Anglin
2002-03-30 21:56             ` John David Anglin
2002-04-02 13:47             ` Carlos O'Donell Jr.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.