Commit a87aa10b85dcaf8e1a4cc962edbd562a96f78650
1 parent
7997d92f
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") git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4900 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
4 deletions
target-arm/helper.c
... | ... | @@ -2059,7 +2059,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) |
2059 | 2059 | uint32_t sum; \ |
2060 | 2060 | sum = (uint32_t)(uint16_t)(a) + (uint32_t)(uint16_t)(b); \ |
2061 | 2061 | RESULT(sum, n, 16); \ |
2062 | - if ((sum >> 16) == 0) \ | |
2062 | + if ((sum >> 16) == 1) \ | |
2063 | 2063 | ge |= 3 << (n * 2); \ |
2064 | 2064 | } while(0) |
2065 | 2065 | |
... | ... | @@ -2067,8 +2067,8 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) |
2067 | 2067 | uint32_t sum; \ |
2068 | 2068 | sum = (uint32_t)(uint8_t)(a) + (uint32_t)(uint8_t)(b); \ |
2069 | 2069 | RESULT(sum, n, 8); \ |
2070 | - if ((sum >> 8) == 0) \ | |
2071 | - ge |= 3 << (n * 2); \ | |
2070 | + if ((sum >> 8) == 1) \ | |
2071 | + ge |= 1 << n; \ | |
2072 | 2072 | } while(0) |
2073 | 2073 | |
2074 | 2074 | #define SUB16(a, b, n) do { \ |
... | ... | @@ -2084,7 +2084,7 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b) |
2084 | 2084 | sum = (uint32_t)(uint8_t)(a) - (uint32_t)(uint8_t)(b); \ |
2085 | 2085 | RESULT(sum, n, 8); \ |
2086 | 2086 | if ((sum >> 8) == 0) \ |
2087 | - ge |= 3 << (n * 2); \ | |
2087 | + ge |= 1 << n; \ | |
2088 | 2088 | } while(0) |
2089 | 2089 | |
2090 | 2090 | #define PFX u | ... | ... |