From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130573 invoked by alias); 12 Jun 2015 17:10:49 -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 130553 invoked by uid 89); 12 Jun 2015 17:10:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Jun 2015 17:10:46 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 5F.B5.06409.49CAA755; Fri, 12 Jun 2015 11:55:32 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.92) with Microsoft SMTP Server id 14.3.210.2; Fri, 12 Jun 2015 13:10:43 -0400 Message-ID: <557B1293.8040108@ericsson.com> Date: Fri, 12 Jun 2015 17:10:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ulrich Weigand , Subject: Re: [committed] ppc64: Handle short vectors as function return types References: <20150612154605.24CAB12CF@oc7340732750.ibm.com> In-Reply-To: <20150612154605.24CAB12CF@oc7340732750.ibm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00266.txt.bz2 On 15-06-12 11:46 AM, Ulrich Weigand wrote: > Hello, > > Short synthetic vector types (i.e. those defined using GCC's > attribute ((vector_size)) instead of AltiVec vector types) > are returned in r3. Fix ppc64_sysv_abi_return_value to > correctly handle this. > > Tested on powerpc64-linux and powerpc64le-linux. > Pushed to mainline. > > Bye, > Ulrich > > gdb/ChangeLog: > > * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value_base): Handle short > synthetic (non-AltiVec) vector types. > (ppc64_sysv_abi_return_value): Likewise. > > diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c > index 6487bec..ea98c6e 100644 > --- a/gdb/ppc-sysv-tdep.c > +++ b/gdb/ppc-sysv-tdep.c > @@ -1892,7 +1892,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, > } > > /* AltiVec vectors are returned in VRs starting at v2. */ > - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) > + if (TYPE_LENGTH (valtype) == 16 > + && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) > && tdep->vector_abi == POWERPC_VEC_ALTIVEC) > { > int regnum = tdep->ppc_vr0_regnum + 2 + index; > @@ -1904,6 +1905,25 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, > return 1; > } > > + /* Short vectors are returned in GPRs starting at r3. */ > + if (TYPE_LENGTH (valtype) <= 8 > + && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) > + { > + int regnum = tdep->ppc_gp0_regnum + 3 + index; > + int offset = 0; > + > + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) > + offset = 8 - TYPE_LENGTH (valtype); > + > + if (writebuf != NULL) > + regcache_cooked_write_part (regcache, regnum, > + offset, TYPE_LENGTH (valtype), writebuf); > + if (readbuf != NULL) > + regcache_cooked_read_part (regcache, regnum, > + offset, TYPE_LENGTH (valtype), readbuf); > + return 1; > + } > + > return 0; > } > > @@ -1993,6 +2013,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, > > /* Small character arrays are returned, right justified, in r3. */ > if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY > + && !TYPE_VECTOR (valtype) > && TYPE_LENGTH (valtype) <= 8 > && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT > && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) > @@ -2012,7 +2033,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, > /* In the ELFv2 ABI, homogeneous floating-point or vector > aggregates are returned in registers. */ > if (tdep->elf_abi == POWERPC_ELF_V2 > - && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)) > + && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt) > + && (TYPE_CODE (eltype) == TYPE_CODE_FLT > + || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT > + || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY > + && TYPE_VECTOR (eltype) > + && tdep->vector_abi == POWERPC_VEC_ALTIVEC > + && TYPE_LENGTH (eltype) == 16))) > { > for (i = 0; i < nelt; i++) > { > Hi Ulrich, I think you made a typo in the date in the ChangeLog (05 instead of 06). While we are at it, there is a missing space before your name. Do I let you change it or do I do it myself? Thanks, Simon