From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8139 invoked by alias); 28 Oct 2014 19:46:33 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 8099 invoked by uid 89); 28 Oct 2014 19:46:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qa0-f45.google.com Received: from mail-qa0-f45.google.com (HELO mail-qa0-f45.google.com) (209.85.216.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 28 Oct 2014 19:46:31 +0000 Received: by mail-qa0-f45.google.com with SMTP id dc16so1038579qab.18 for ; Tue, 28 Oct 2014 12:46:29 -0700 (PDT) X-Received: by 10.224.129.195 with SMTP id p3mr8381078qas.66.1414525589041; Tue, 28 Oct 2014 12:46:29 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id 11sm2042715qgj.34.2014.10.28.12.46.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Oct 2014 12:46:28 -0700 (PDT) From: Richard Henderson To: libffi-discuss@sourceware.org Cc: davem@davemloft.net Subject: [PATCH 1/8] sparc: Eliminate long double ifdefs Date: Tue, 28 Oct 2014 19:46:00 -0000 Message-Id: <1414525555-21256-2-git-send-email-rth@twiddle.net> In-Reply-To: <1414525555-21256-1-git-send-email-rth@twiddle.net> References: <1414525555-21256-1-git-send-email-rth@twiddle.net> X-SW-Source: 2014/txt/msg00155.txt.bz2 --- src/sparc/ffi.c | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/src/sparc/ffi.c b/src/sparc/ffi.c index 9f0fded..c2a0d14 100644 --- a/src/sparc/ffi.c +++ b/src/sparc/ffi.c @@ -27,9 +27,19 @@ #include #include - #include +/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; + all further uses in this file will refer to the 128-bit type. */ +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +# if FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +#else +# undef FFI_TYPE_LONGDOUBLE +# define FFI_TYPE_LONGDOUBLE 4 +#endif + /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ @@ -72,10 +82,7 @@ void ffi_prep_args_v8(char *stack, extended_cif *ecif) size_t z; if ((*p_arg)->type == FFI_TYPE_STRUCT -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || (*p_arg)->type == FFI_TYPE_LONGDOUBLE -#endif - ) + || (*p_arg)->type == FFI_TYPE_LONGDOUBLE) { *(unsigned int *) argp = (unsigned long)(* p_argv); z = sizeof(int); @@ -176,9 +183,7 @@ int ffi_prep_args_v9(char *stack, extended_cif *ecif) /* FALLTHROUGH */ case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: -#endif ret = 1; /* We should promote into FP regs as well as integer. */ break; } @@ -296,9 +301,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: -#endif cif->flags = cif->rtype->type; break; @@ -351,9 +354,7 @@ int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *fl break; case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: -#endif memmove(ret + off, flt + off, (*ptr)->size); off += (*ptr)->size; break; @@ -412,10 +413,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) FFI_ASSERT(0); #else if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || cif->flags == FFI_TYPE_LONGDOUBLE -#endif - )) + || cif->flags == FFI_TYPE_LONGDOUBLE)) { /* For v8, we need an "unimp" with size of returning struct */ /* behind "call", so we alloc some executable space for it. */ @@ -551,11 +549,7 @@ ffi_closure_sparc_inner_v8(ffi_closure *closure, /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ - if (cif->flags == FFI_TYPE_STRUCT -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || cif->flags == FFI_TYPE_LONGDOUBLE -#endif - ) + if (cif->flags == FFI_TYPE_STRUCT || cif->flags == FFI_TYPE_LONGDOUBLE) rvalue = (void *) gpr[0]; /* Always skip the structure return address. */ @@ -565,10 +559,7 @@ ffi_closure_sparc_inner_v8(ffi_closure *closure, for (i = 0; i < cif->nargs; i++) { if (arg_types[i]->type == FFI_TYPE_STRUCT -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || arg_types[i]->type == FFI_TYPE_LONGDOUBLE -#endif - ) + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE) { /* Straight copy of invisible reference. */ avalue[i] = (void *)gpr[argn++]; @@ -656,17 +647,12 @@ ffi_closure_sparc_inner_v9(ffi_closure *closure, argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; /* Align on a 16-byte boundary. */ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0) argn++; -#endif if (i < fp_slot_max && (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - || arg_types[i]->type == FFI_TYPE_LONGDOUBLE -#endif - )) + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE)) avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size; else avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; -- 1.9.3