1 /* $NetBSD: abi.h,v 1.5 2008/06/23 10:24:13 drochner Exp $ */
4 * Written by Frank van der Linden (fvdl@wasabisystems.com)
8 * The x86-64 ABI specifies that float, double and long double
9 * arguments are passed in SSE2 (xmm) registers. Unfortunately,
10 * there is no way to push those on to the FP stack, which is
11 * where the fancier instructions get their arguments from.
13 * Define some prologues and epilogues to store and retrieve
14 * xmm regs to local variables.
19 #define ARG_DOUBLE_ONE -8(%rsp)
20 #define ARG_DOUBLE_ONE_LSW -8(%rsp)
21 #define ARG_DOUBLE_ONE_MSW -4(%rsp)
22 #define ARG_DOUBLE_TWO -16(%rsp)
23 #define ARG_FLOAT_ONE -4(%rsp)
24 #define ARG_FLOAT_TWO -8(%rsp)
26 #define XMM_ONE_ARG_DOUBLE_PROLOGUE \
27 movsd %xmm0, ARG_DOUBLE_ONE
29 #define XMM_TWO_ARG_DOUBLE_PROLOGUE \
30 movsd %xmm0, ARG_DOUBLE_ONE ; \
31 movsd %xmm1, ARG_DOUBLE_TWO
33 #define XMM_ONE_ARG_FLOAT_PROLOGUE \
34 movss %xmm0, ARG_FLOAT_ONE
36 #define XMM_TWO_ARG_FLOAT_PROLOGUE \
37 movss %xmm0, ARG_FLOAT_ONE ; \
38 movss %xmm1, ARG_FLOAT_TWO
40 #define XMM_DOUBLE_EPILOGUE \
41 fstpl ARG_DOUBLE_ONE ; \
42 movsd ARG_DOUBLE_ONE, %xmm0
44 #define XMM_FLOAT_EPILOGUE \
45 fstps ARG_FLOAT_ONE ; \
46 movss ARG_FLOAT_ONE, %xmm0
48 #define FLDL_VAR(x) fldl x(%rip)
52 #define ARG_DOUBLE_ONE 4(%esp)
53 #define ARG_DOUBLE_ONE_LSW 4(%esp)
54 #define ARG_DOUBLE_ONE_MSW 8(%esp)
55 #define ARG_DOUBLE_TWO 12(%esp)
56 #define ARG_FLOAT_ONE 4(%esp)
57 #define ARG_FLOAT_TWO 8(%esp)
59 #define XMM_ONE_ARG_DOUBLE_PROLOGUE
60 #define XMM_TWO_ARG_DOUBLE_PROLOGUE
61 #define XMM_ONE_ARG_FLOAT_PROLOGUE
62 #define XMM_TWO_ARG_FLOAT_PROLOGUE
64 #define XMM_DOUBLE_EPILOGUE
65 #define XMM_FLOAT_EPILOGUE
70 fldl PIC_GOTOFF(x) ; \