From patchwork Fri Jan 18 13:06:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 31105 Received: (qmail 36579 invoked by alias); 18 Jan 2019 13:06:46 -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 36551 invoked by uid 89); 18 Jan 2019 13:06:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=BAYES_05, 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*Ad:U*rth, ubizjak@gmail.com, ubizjakgmailcom, U*ubizjak X-HELO: mail-io1-f48.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=csNNPYHiEzLW+zYcDxvaiQ4YYCV8V3Lc6Kh3dkyPj4g=; b=jZwEN6kmXUdw0l840oUck/A6lZpISH/H50Synni1RL9ieyQLY93mY0LU60U0MRVISt Tn9oFjIeMc8u1b7pUVPBjQIYLXOrUqohmonRTQwsW4OlOpcJEPIXPH8sx8RePnUC0sBl lIGxtXYRaphE1VI8ZwjOvb05SkgXpqBJRpg3E+7QCkd/9cG/MDRzfYVUvNm0bn8aIzCn MOZwf2N5rQ6bBGVoAmUF0fLpKXvHVo50xtWiVIj2J1XI1uTzw75gU3gA9tEcPABfplPJ 0pXx22yCO0qfeCCrGt1hHg0jgJQd4KzFQFxqEJxdV6Ni4HRSkTF0+ZTRzyaOWrleuJD5 a5iQ== MIME-Version: 1.0 From: Uros Bizjak Date: Fri, 18 Jan 2019 14:06:30 +0100 Message-ID: Subject: [PATCH, alpha]: Fix sysdeps/alpha/remqu.S clobbering $f3 reg To: libc-alpha@sourceware.org Cc: Richard Henderson Hello! Attached patch fixes sysdeps/alpha/remqu.S clobbering $f3 register via $y_is_neg path. There was missing restore of $f3 before the return from the function. The patch also reorders insns a bit, so it becomes similar as much as possible to divqu.S. Without the patch, math/big testcase from Go-1.11 testsuite (that includes lots of corner cases that exercise remqu) FAIL, with patched function, the testcase PASSes without problems. Signed-off-by: Uros Bizjak Uros. diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S index c2c5caf3c20..7210628f973 100644 --- a/sysdeps/alpha/remqu.S +++ b/sysdeps/alpha/remqu.S @@ -59,20 +59,19 @@ __remqu: subq Y, 1, AT stt $f0, 0(sp) and Y, AT, AT + excb + beq AT, $powerof2 stt $f1, 8(sp) - excb stt $f3, 48(sp) - beq AT, $powerof2 cfi_rel_offset ($f0, 0) cfi_rel_offset ($f1, 8) cfi_rel_offset ($f3, 48) + mf_fpcr $f3 _ITOFT2 X, $f0, 16, Y, $f1, 24 - mf_fpcr $f3 cvtqt $f0, $f0 cvtqt $f1, $f1 - blt X, $x_is_neg divt/c $f0, $f1, $f0 @@ -94,12 +93,12 @@ __remqu: mulq AT, Y, AT ldt $f0, 0(sp) ldt $f3, 48(sp) - lda sp, FRAME(sp) cfi_remember_state cfi_restore ($f0) cfi_restore ($f1) cfi_restore ($f3) cfi_def_cfa_offset (0) + lda sp, FRAME(sp) .align 4 subq X, AT, RV @@ -116,11 +115,13 @@ $x_is_neg: cfi_rel_offset ($f2, 24) _ITOFS AT, $f2, 16 + .align 4 addt $f0, $f2, $f0 + unop divt/c $f0, $f1, $f0 + unop /* Ok, we've now the divide issued. Continue with other checks. */ - .align 4 ldt $f1, 8(sp) unop ldt $f2, 24(sp) @@ -246,12 +247,16 @@ $y_is_neg: quotient must be either 0 or 1, so the remainder must be X or X-Y, so just compute it directly. */ cmpule Y, X, AT + excb + mt_fpcr $f3 subq X, Y, RV ldt $f0, 0(sp) + ldt $f3, 48(sp) cmoveq AT, X, RV lda sp, FRAME(sp) cfi_restore ($f0) + cfi_restore ($f3) cfi_def_cfa_offset (0) ret $31, (RA), 1