Received: from eggs.gnu.org ([140.186.70.92]:44561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKTjX-0005bP-FE for qemu-devel@nongnu.org; Sun, 30 Oct 2011 07:39:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKTjW-0003gN-5s for qemu-devel@nongnu.org; Sun, 30 Oct 2011 07:39:23 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:30644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKTjV-0003bF-F7 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 07:39:22 -0400 Received: from csmailer.cs.nctu.edu.tw (localhost [127.0.0.1]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id CCC20AB7 for ; Sun, 30 Oct 2011 19:37:28 +0800 (CST) Received: from alumni.cs.nctu.edu.tw (alumni.cs.nctu.edu.tw [140.113.235.116]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id A9599AB6 for ; Sun, 30 Oct 2011 19:37:28 +0800 (CST) Received: (from chenwj@localhost) by alumni.cs.nctu.edu.tw (8.14.4/8.14.4/Submit) id p9UBd8RR044225 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 19:39:09 +0800 (CST) (envelope-from chenwj) Date: Sun, 30 Oct 2011 19:39:08 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7?= Message-ID: <20111030113908.GA18904@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Why some ARM NEON helper functions need mask? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, all I am looking into QEMU's implementation for ARM NEON instructions (target-arm/neon_helper.c). Some helper functions will do mask operation, neon_add_u8, for example. I thought simply adding a and b is enough and can't figure out why the mask operation is needed. --- uint32_t HELPER(neon_add_u8)(uint32_t a, uint32_t b) { uint32_t mask; mask =3D (a ^ b) & 0x80808080u; a &=3D ~0x80808080u; b &=3D ~0x80808080u; return (a + b) ^ mask; } --- Any help is appreciated. Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667