|
From: | LIU Zhiwei |
Subject: | Re: [PATCH v5 11/60] target/riscv: vector integer add-with-carry / subtract-with-borrow instructions |
Date: | Sat, 14 Mar 2020 14:08:41 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 2020/3/14 13:58, Richard Henderson wrote:
On 3/12/20 7:58 AM, LIU Zhiwei wrote:+#define DO_MADC(N, M, C) ((__typeof(N))(N + M + C) < N ? 1 : 0)Incorrect. E.g N = 1, M = UINT_MAX, C = 1, adds to 1, which is not less than N, despite the carry-out.
Yes, it really the corner case. I should test C first. Thanks for pointing that. Zhiwei
You want C ? N + M <= N : N + M < N+#define DO_MSBC(N, M, C) ((__typeof(N))(N - M - C) > N ? 1 : 0)Similarly C ? N <= M : N < M r~
[Prev in Thread] | Current Thread | [Next in Thread] |