From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7223 invoked by alias); 10 Dec 2013 18:46:25 -0000 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 Received: (qmail 7213 invoked by uid 89); 10 Dec 2013 18:46:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from Unknown (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 10 Dec 2013 18:46:24 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rBAIkFRo001908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Dec 2013 18:46:16 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBAIkFjZ008090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Dec 2013 18:46:15 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBAIkEnf013833; Tue, 10 Dec 2013 18:46:14 GMT Received: from termi.oracle.com (/10.175.39.13) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Dec 2013 10:46:14 -0800 From: jose.marchesi@oracle.com (Jose E. Marchesi) To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix passing double float complex arguments in sparc64 References: <87ob6qo7bs.fsf@oracle.com> <201310231958.r9NJwEje005359@glazunov.sibelius.xs4all.nl> Date: Tue, 10 Dec 2013 18:46:00 -0000 In-Reply-To: <201310231958.r9NJwEje005359@glazunov.sibelius.xs4all.nl> (Mark Kettenis's message of "Wed, 23 Oct 2013 21:58:14 +0200 (CEST)") Message-ID: <878uvsv8xl.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00386.txt.bz2 > 2013-10-15 Jose E. Marchesi > > * sparc64-tdep.c (sparc64_store_arguments): Do not align complex > double float arguments to 16-byte. Hi Jose, A bit of digging around seems to confirm that we shouldn't align double complex variables. However, I think that with your diff we're still not storing things in the right registers. Aye. Fixed in the amended patch below. 2013-10-15 Jose E. Marchesi * sparc64-tdep.c (sparc64_store_arguments): Do not align complex double float arguments to 16-byte in the argument slots. diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index 8bcf418..9767bbe 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -831,7 +831,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, quad-aligned, and thus a hole might be introduced into the parameter array to force alignment." Skip an element if necessary. */ - if (num_elements % 2) + if ((num_elements % 2) && sparc64_16_byte_align_p (type)) num_elements++; } else @@ -890,7 +890,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, if (sparc64_structure_or_union_p (type) || (sparc64_complex_floating_p (type) && len == 32)) { - /* Structure or Union arguments. */ + /* Structure, Union or long double Complex arguments. */ gdb_assert (len <= 16); memset (buf, 0, sizeof (buf)); valbuf = memcpy (buf, valbuf, len); @@ -908,7 +908,13 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, if (element < 16) sparc64_store_floating_fields (regcache, type, valbuf, element, 0); } - else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type)) + else if (sparc64_complex_floating_p (type)) + { + /* Float Complex or double Complex arguments. */ + if (element < 16) + regnum = SPARC64_D0_REGNUM + element; + } + else if (sparc64_floating_p (type)) { /* Floating arguments. */ if (len == 16) @@ -950,6 +956,10 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, if (regnum != -1) { regcache_cooked_write (regcache, regnum, valbuf); + if (sparc64_complex_floating_p (type) + && (len == 16) + && (regnum < SPARC64_D10_REGNUM)) + regcache_cooked_write (regcache, regnum + 1, valbuf + 8); /* If we're storing the value in a floating-point register, also store it in the corresponding %0 register(s). */