From patchwork Mon Oct 15 11:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zong Li X-Patchwork-Id: 29740 Received: (qmail 10941 invoked by alias); 15 Oct 2018 11:54:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 10808 invoked by uid 89); 15 Oct 2018 11:54:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:q19-v6s, H*f:sk:cover.1, H*r:sk:mail-pl, HX-HELO:sk:mail-pl X-HELO: mail-pl1-f170.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G7qxmHodgSBbjkb7R4sdL7wje4grXpn947kKfcAgg1M=; b=ibPaS/AcV57Ngp0TARWIi+4d3tsmFuL5mgB8l6fTTQFT0iZ9tjqKHCQD2YgzrJw6Mi X00hBMNrNdo03aIO1fNi7rNz7yFtSaymbfShIDJm9sWp+Z/Bmj6cwptdlGJ9Ybezeb8+ XjTQL+E/GKvbUVbzL9BY29HJB6CfSDvcept8qWHyr18oZ5t32cHMh2qX+eM0efyziO8l nPnOp3PgmDpZZ9Llkftjsrx7o0hWJetIWgoCskeRuHw2Y2/ubI1G3VeqpHq4sd1625LL pvW83+v2bp3FbiK5NzO8jt67NqDWWDYM1QoK/+HGowjA++XCvXQJW+qpQmzGUc+fLRPb YOwQ== Return-Path: From: Zong Li To: joseph@codesourcery.com, palmer@dabbelt.com, darius@bluespec.com, andrew@sifive.com, dj@redhat.com, libc-alpha@sourceware.org Cc: jimw@sifive.com, kito@andestech.com, greentime@andestech.com, zongbox@gmail.com Subject: [PATCH 1/2] soft-fp: Fix overwritten issue for division in op-4.h Date: Mon, 15 Oct 2018 19:52:30 +0800 Message-Id: <5e51c4ea8cfe99f2faac5e206982658bd6c5d265.1539595555.git.zongbox@gmail.com> In-Reply-To: References: The original value of X##_f[0] is overwritten before the calculatation. After this modification, we can pass the soft floating testing of glibc testsuites on RV32. * soft-fp/op-4.h: Fix wrong calculation of division. --- ChangeLog | 4 ++++ soft-fp/op-4.h | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2601765..bb30093 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-10-15 Zong Li + + * soft-fp/op-4.h: Fix wrong calculation of division. + 2018-10-14 Paul Eggert regex: simplify by using intprops.h diff --git a/soft-fp/op-4.h b/soft-fp/op-4.h index 01b87d0..a407168 100644 --- a/soft-fp/op-4.h +++ b/soft-fp/op-4.h @@ -517,10 +517,15 @@ R##_f[_FP_DIV_MEAT_4_udiv_i] = -1; \ if (!_FP_DIV_MEAT_4_udiv_i) \ break; \ - __FP_FRAC_SUB_4 (X##_f[3], X##_f[2], X##_f[1], X##_f[0], \ + UWtype __FP_FRAC_tmp; \ + __FP_FRAC_SUB_4 (X##_f[2], X##_f[1], X##_f[0], __FP_FRAC_tmp, \ Y##_f[2], Y##_f[1], Y##_f[0], 0, \ X##_f[2], X##_f[1], X##_f[0], \ _FP_DIV_MEAT_4_udiv_n_f[_FP_DIV_MEAT_4_udiv_i]); \ + X##_f[3] = X##_f[2]; \ + X##_f[2] = X##_f[1]; \ + X##_f[1] = X##_f[0]; \ + X##_f[0] = __FP_FRAC_tmp; \ _FP_FRAC_SUB_4 (X, Y, X); \ if (X##_f[3] > Y##_f[3]) \ { \