1 /* $OpenBSD: abi.h,v 1.4 2010/06/03 16:38:50 deraadt Exp $ */ 2 /* $NetBSD: abi.h,v 1.2 2003/09/14 21:26:14 fvdl Exp $ */ 3 4 /* 5 * Written by Frank van der Linden (fvdl@wasabisystems.com) 6 */ 7 8 /* 9 * The x86-64 ABI specifies that float, double and long double 10 * arguments are passed in SSE2 (xmm) registers. Unfortunately, 11 * there is no way to push those on to the FP stack, which is 12 * where the fancier instructions get their arguments from. 13 * 14 * Define some prologues and epilogues to store and retrieve 15 * xmm regs to local variables. 16 */ 17 18 #define ARG_DOUBLE_ONE -8(%rsp) 19 #define ARG_DOUBLE_TWO -16(%rsp) 20 #define ARG_FLOAT_ONE -4(%rsp) 21 #define ARG_FLOAT_TWO -8(%rsp) 22 23 #define XMM_ONE_ARG_DOUBLE_PROLOGUE \ 24 movsd %xmm0, ARG_DOUBLE_ONE 25 26 #define XMM_TWO_ARG_DOUBLE_PROLOGUE \ 27 movsd %xmm0, ARG_DOUBLE_ONE ; \ 28 movsd %xmm1, ARG_DOUBLE_TWO 29 30 #define XMM_ONE_ARG_FLOAT_PROLOGUE \ 31 movss %xmm0, ARG_FLOAT_ONE 32 33 #define XMM_TWO_ARG_FLOAT_PROLOGUE \ 34 movss %xmm0, ARG_FLOAT_ONE ; \ 35 movss %xmm1, ARG_FLOAT_TWO 36 37 #define XMM_DOUBLE_EPILOGUE \ 38 fstpl ARG_DOUBLE_ONE ; \ 39 movsd ARG_DOUBLE_ONE, %xmm0 40 41 #define XMM_FLOAT_EPILOGUE \ 42 fstps ARG_FLOAT_ONE ; \ 43 movss ARG_FLOAT_ONE, %xmm0 44 45 #define FLDL_VAR(x) fldl x(%rip) 46 47