Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: parisc-linux@lists.parisc-linux.org
Subject: [parisc-linux] floating point calling convention on pa
Date: Sat, 19 Apr 2003 18:12:56 -0700	[thread overview]
Message-ID: <20030420011256.GC25257@tausq.org> (raw)

Hi all,

I'm trying to understand the FP argument passing convention on 32-bit
palinux... I don't think I have it quite right. Can anyone comment on
the following?

1) float-type arguments
   float add(float a, float b, float c, float d)
        a -> fr4L
        b -> fr5L
        c -> fr6L
        d -> fr7L
        retval = fr4L

   If >4 arguments, the rest are passed on the stack
   starting at sp-52 in the caller's frame

2) double-type arguments
   double add(double a, double b, double c, double d)
        a -> fr5
        b -> fr7
        c -> sp-56 in caller frame
        d -> sp-64 in caller frame
        retval = fr4

   Is it correct that the high-order 32-bit of fr5 is in fr5L
   and the lower bits in fr5R?

3) What happens when you have a mix argument function? e.g.
   double foo(int a, float b, double c)

        a -> r26
        b -> fr5L
        c -> fr7
        retval = fr4

   I don't quite understand the logic here :) What happens when
   there are more and they need to go on the stack? What's the 
   arrangement?

I've looked through the SOM 32-bit runtime but (at least to me)
it doesn't talk about this very clearly. I've been experimenting with
gcc -S but I'd rather get a definitive answer :)

Also, for passing structures by value to functions, is this correct?
a) if sizeof(struct) <= 4, pass in register
b) if sizeof(struct) <= 8), pass in even-numbered register pairs 
c) if sizeof(struct) > 8, pass a pointer and callee will copy the
   structure?

thanks
randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

             reply	other threads:[~2003-04-20  1:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-20  1:12 Randolph Chung [this message]
2003-04-20  1:49 ` [parisc-linux] floating point calling convention on pa John David Anglin
2003-04-20  6:40   ` Randolph Chung
2003-04-20 13:41     ` Matthew Wilcox
2003-04-20 16:20     ` John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030420011256.GC25257@tausq.org \
    --to=randolph@tausq.org \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox