From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7Dbd-00039I-UW for qemu-devel@nongnu.org; Fri, 13 Jun 2008 14:02:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7Dbc-000385-EK for qemu-devel@nongnu.org; Fri, 13 Jun 2008 14:02:33 -0400 Received: from [199.232.76.173] (port=44931 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7Dbc-000382-CL for qemu-devel@nongnu.org; Fri, 13 Jun 2008 14:02:32 -0400 Received: from smtp6-g19.free.fr ([212.27.42.36]:50826) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7Dbb-000423-8V for qemu-devel@nongnu.org; Fri, 13 Jun 2008 14:02:31 -0400 Received: from smtp6-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp6-g19.free.fr (Postfix) with ESMTP id E45655FE65 for ; Fri, 13 Jun 2008 20:02:26 +0200 (CEST) Received: from [192.168.0.20] (adsl.palats.com [82.233.120.18]) by smtp6-g19.free.fr (Postfix) with ESMTP id CECE25FE63 for ; Fri, 13 Jun 2008 20:02:26 +0200 (CEST) From: Vincent Palatin Date: Fri, 13 Jun 2008 20:06:02 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_KcrUIznpLGu5tGF" Message-Id: <200806132006.02599.vincent.palatin_qemu@polytechnique.org> Subject: [Qemu-devel] [PATCH] ARM: fix carry flags for ARMv6 unsigned SIMD operations 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 This is a multi-part message in MIME format. --Boundary-00=_KcrUIznpLGu5tGF Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On ARMv6 emulation, I have caught some cases where the GE flags were badly set after a "uadd8" operation. 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") I attach a patch to fix those issues. -- Vincent --Boundary-00=_KcrUIznpLGu5tGF Content-Type: text/plain; name="arith_ge.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="arith_ge.patch" Index: target-arm/helper.c =================================================================== --- target-arm/helper.c (revision 4740) +++ target-arm/helper.c (working copy) @@ -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 --Boundary-00=_KcrUIznpLGu5tGF--