Received: from eggs.gnu.org ([2001:4830:134:3::10]:36097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfkpJ-0001kQ-HM for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:31:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfkpF-0005PP-BE for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:31:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfkpF-0005PA-38 for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:31:53 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u829Pp4l113599 for ; Fri, 2 Sep 2016 05:31:52 -0400 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146]) by mx0a-001b2d01.pphosted.com with ESMTP id 2575s2km8b-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Sep 2016 05:31:51 -0400 Received: from localhost by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Sep 2016 19:31:49 +1000 References: <1472711818-13514-1-git-send-email-raji@linux.vnet.ibm.com> <1472711818-13514-3-git-send-email-raji@linux.vnet.ibm.com> From: Rajalakshmi Srinivasaraghavan Date: Fri, 2 Sep 2016 15:01:40 +0530 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-Id: Subject: Re: [Qemu-devel] [PATCH v5 2/5] target-ppc: add vector extract instructions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com On 09/01/2016 09:38 PM, Richard Henderson wrote: > On 08/31/2016 11:36 PM, Rajalakshmi Srinivasaraghavan wrote: >> +#if defined(HOST_WORDS_BIGENDIAN) >> +#define VEXTRACT(suffix, >> element) \ >> + void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, >> uint32_t index) \ >> + { \ >> + r->u64[0] = r->u64[1] = >> 0; \ >> + memmove(&r->u8[8 - sizeof(r->element)], >> &b->u8[index], \ >> + sizeof(r->element[0])); \ > > Again, you must consider R == B. I made this same comment wrt v2, > when you still had a memcpy here. > > This is trivial: > > (1) Use memmove to set first sizeof(r->element[0]) bytes, > (2) Use memset 0 to clean last (16 - sizeof(r->element[0]) bytes. > Ack. So I have to call memset twice to clean initial and last bytes. #if defined(HOST_WORDS_BIGENDIAN) #define VEXTRACT(suffix, element) \ void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \ { \ uint32_t es = sizeof(r->element[0]); \ memmove(&r->u8[8 - es], &b->u8[index], es); \ memset(&r->u8[8], 0, 8); \ memset(&r->u8[0], 0, 8 - es); \ } #else #define VEXTRACT(suffix, element) \ void helper_vextract##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \ { \ uint32_t es = sizeof(r->element[0]); \ uint32_t s = (16 - index) - es; \ memmove(&r->u8[8], &b->u8[s], es); \ memset(&r->u8[0], 0, 8); \ memset(&r->u8[8 + es], 0, 8 - es); \ } #endif > You have some test cases for these insns, don't you? > > > r~ > > -- Thanks Rajalakshmi S