From: Vincent Palatin <vincent.palatin_qemu@polytechnique.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] ARM: fix carry flags for ARMv6 unsigned SIMD operations
Date: Fri, 13 Jun 2008 20:06:02 +0200 [thread overview]
Message-ID: <200806132006.02599.vincent.palatin_qemu@polytechnique.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
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
[-- Attachment #2: arith_ge.patch --]
[-- Type: text/plain, Size: 935 bytes --]
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
reply other threads:[~2008-06-13 18:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200806132006.02599.vincent.palatin_qemu@polytechnique.org \
--to=vincent.palatin_qemu@polytechnique.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).