Received: from eggs.gnu.org ([2001:4830:134:3::10]:55242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVLqD-0006X7-6d for qemu-devel@nongnu.org; Thu, 04 Aug 2016 12:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVLq8-0004Wb-19 for qemu-devel@nongnu.org; Thu, 04 Aug 2016 12:49:52 -0400 Sender: Richard Henderson References: <1470315830-23724-1-git-send-email-raji@linux.vnet.ibm.com> <1470315830-23724-5-git-send-email-raji@linux.vnet.ibm.com> From: Richard Henderson Message-ID: <8f1cac15-4816-032a-8065-cc774dd3b0e9@twiddle.net> Date: Thu, 4 Aug 2016 22:19:31 +0530 MIME-Version: 1.0 In-Reply-To: <1470315830-23724-5-git-send-email-raji@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 4/5] target-ppc: add vector bit permute doubleword instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rajalakshmi Srinivasaraghavan , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org, nikunj@linux.vnet.ibm.com, benh@kernel.crashing.org On 08/04/2016 06:33 PM, Rajalakshmi Srinivasaraghavan wrote: > + uint64_t perm = 0; Move the variable inside the loop. > + VECTOR_FOR_INORDER_I(i, u64) { > + perm = 0; > + VECTOR_FOR_INORDER_I(j, u16) { Surely this is more clearly written as for (j = 0; j < 8; ++j) since u16 really has nothing to do with this. > + int index = VBPERMQ_INDEX(b, (i * 8) + j); > + if (index < 64) { > + uint64_t mask = (1ull << (63 - (index & 0x3F))); > + if (a->u64[VBPERMQ_DW(index)] & mask) { > + perm |= (0x80 >> j); > + } > + } > + r->u64[i] = perm; > + } > + } The final assignment of perm is done in the wrong loop. r~