From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14510 invoked by alias); 13 Feb 2008 16:39:06 -0000 Received: (qmail 14502 invoked by uid 22791); 13 Feb 2008 16:39:05 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 13 Feb 2008 16:38:35 +0000 Received: from mailhub1.br.ibm.com (mailhub1 [9.18.232.109]) by igw1.br.ibm.com (Postfix) with ESMTP id A50F332C131 for ; Wed, 13 Feb 2008 14:15:53 -0200 (BRDT) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m1DGcVQb3682546 for ; Wed, 13 Feb 2008 14:38:32 -0200 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m1DGcVUW010896 for ; Wed, 13 Feb 2008 14:38:31 -0200 Received: from [9.18.238.95] ([9.18.238.95]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m1DGcVFX010892 for ; Wed, 13 Feb 2008 14:38:31 -0200 Subject: [RFA] Support for calling functions with decimal float arguments in x86 and x86_64 From: Thiago Jung Bauermann To: gdb-patches Content-Type: multipart/mixed; boundary="=-HLsSCulCKAsHEEQvOtaF" Date: Wed, 13 Feb 2008 16:39:00 -0000 Message-Id: <1202920713.20334.57.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00212.txt.bz2 --=-HLsSCulCKAsHEEQvOtaF Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 663 Hi, The attached patch implements the calling convention for decimal floating point in x86 32-bits and x86_64 (arguments and return value). Now all DFP tests pass in these architectures. For x86 it was very easy. The only case which needs special attention is a function returning a _Decimal128 value, which uses struct return convention. For x86_64, I just had to update the classification function with the proper class for the DFP types, as specified by the AMD64 ABI Draft version 0.99. This patch introduces no regression (tested in Linux/i686 and Linux/x86_64). Ok to commit? -- []'s Thiago Jung Bauermann Software Engineer IBM Linux Technology Center --=-HLsSCulCKAsHEEQvOtaF Content-Disposition: attachment; filename=dfp-infcall-x86.diff Content-Type: text/x-patch; name=dfp-infcall-x86.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 2349 2008-02-13 Thiago Jung Bauermann * amd64-tdep.c (amd64_classify): Add support for decimal float types. * i386-tdep.c (i386_return_value): Make 128-bit decimal float use the struct return convention. diff -r 4210c09bccd5 -r ada730f9adc3 gdb/amd64-tdep.c --- a/gdb/amd64-tdep.c Mon Feb 11 03:15:07 2008 -0800 +++ b/gdb/amd64-tdep.c Wed Feb 13 14:03:14 2008 -0200 @@ -364,15 +364,19 @@ amd64_classify (struct type *type, enum && (len == 1 || len == 2 || len == 4 || len == 8)) class[0] = AMD64_INTEGER; - /* Arguments of types float, double and __m64 are in class SSE. */ - else if (code == TYPE_CODE_FLT && (len == 4 || len == 8)) + /* Arguments of types float, double, _Decimal32, _Decimal64 and __m64 + are in class SSE. */ + else if ((code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT) + && (len == 4 || len == 8)) /* FIXME: __m64 . */ class[0] = AMD64_SSE; - /* Arguments of types __float128 and __m128 are split into two - halves. The least significant ones belong to class SSE, the most + /* Arguments of types __float128, _Decimal128 and __m128 are split into + two halves. The least significant ones belong to class SSE, the most significant one to class SSEUP. */ - /* FIXME: __float128, __m128. */ + else if (code == TYPE_CODE_DECFLOAT && len == 16) + /* FIXME: __float128, __m128. */ + class[0] = AMD64_SSE, class[1] = AMD64_SSEUP; /* The 64-bit mantissa of arguments of type long double belongs to class X87, the 16-bit exponent plus 6 bytes of padding belongs to diff -r 4210c09bccd5 -r ada730f9adc3 gdb/i386-tdep.c --- a/gdb/i386-tdep.c Mon Feb 11 03:15:07 2008 -0800 +++ b/gdb/i386-tdep.c Wed Feb 13 14:03:14 2008 -0200 @@ -1579,10 +1579,12 @@ i386_return_value (struct gdbarch *gdbar { enum type_code code = TYPE_CODE (type); - if ((code == TYPE_CODE_STRUCT - || code == TYPE_CODE_UNION - || code == TYPE_CODE_ARRAY) - && !i386_reg_struct_return_p (gdbarch, type)) + if (((code == TYPE_CODE_STRUCT + || code == TYPE_CODE_UNION + || code == TYPE_CODE_ARRAY) + && !i386_reg_struct_return_p (gdbarch, type)) + /* 128-bit decimal float uses the struct return convention. */ + || (code == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 16)) { /* The System V ABI says that: --=-HLsSCulCKAsHEEQvOtaF--