From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KK9xC-0003cB-1z for qemu-devel@nongnu.org; Sat, 19 Jul 2008 06:46:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KK9x9-0003b8-IP for qemu-devel@nongnu.org; Sat, 19 Jul 2008 06:46:16 -0400 Received: from [199.232.76.173] (port=39200 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KK9x9-0003b1-9a for qemu-devel@nongnu.org; Sat, 19 Jul 2008 06:46:15 -0400 Received: from savannah.gnu.org ([199.232.41.3]:57176 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KK9x9-0002Xg-7m for qemu-devel@nongnu.org; Sat, 19 Jul 2008 06:46:15 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KK9x8-0002mW-Bq for qemu-devel@nongnu.org; Sat, 19 Jul 2008 10:46:14 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KK9x8-0002mS-2Z for qemu-devel@nongnu.org; Sat, 19 Jul 2008 10:46:14 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Sat, 19 Jul 2008 10:46:14 +0000 Subject: [Qemu-devel] [4900] ARMv6: fix SIMD add/sub carry flags (Vincent Palatin). Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4900 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4900 Author: balrog Date: 2008-07-19 10:46:13 +0000 (Sat, 19 Jul 2008) Log Message: ----------- ARMv6: fix SIMD add/sub carry flags (Vincent Palatin). After a quick code review, it seems to be a bad cut-n-paste between 16-bit and 8-bit UADD/USUB, indeed UADD8/USUB8 tries to set GE bits by pair instead of one at a time. Besides, the addition operations (UADD8/UADD16) set GE bits to "NOT carry" instead of "carry" (probably once again due to a copy of the substraction code which sets flags to "NOT borrow") Modified Paths: -------------- trunk/target-arm/helper.c Modified: trunk/target-arm/helper.c =================================================================== --- trunk/target-arm/helper.c 2008-07-19 10:34:35 UTC (rev 4899) +++ trunk/target-arm/helper.c 2008-07-19 10:46:13 UTC (rev 4900) @@ -2059,7 +2059,7 @@ uint32_t sum; \ sum = (uint32_t)(uint16_t)(a) + (uint32_t)(uint16_t)(b); \ RESULT(sum, n, 16); \ - if ((sum >> 16) == 0) \ + if ((sum >> 16) == 1) \ ge |= 3 << (n * 2); \ } while(0) @@ -2067,8 +2067,8 @@ uint32_t sum; \ sum = (uint32_t)(uint8_t)(a) + (uint32_t)(uint8_t)(b); \ RESULT(sum, n, 8); \ - if ((sum >> 8) == 0) \ - ge |= 3 << (n * 2); \ + if ((sum >> 8) == 1) \ + ge |= 1 << n; \ } while(0) #define SUB16(a, b, n) do { \ @@ -2084,7 +2084,7 @@ sum = (uint32_t)(uint8_t)(a) - (uint32_t)(uint8_t)(b); \ RESULT(sum, n, 8); \ if ((sum >> 8) == 0) \ - ge |= 3 << (n * 2); \ + ge |= 1 << n; \ } while(0) #define PFX u