Patchwork [alpha,v2] : Fix sysdeps/alpha/remqu.S clobbering $f3 reg

login
register
mail settings
Submitter Uros Bizjak
Date Jan. 24, 2019, 9:40 a.m.
Message ID <CAFULd4YPY82vzMqpyCj7ng_Q2wW+LuLr7tMn=V-kh+rK_JNZqg@mail.gmail.com>
Download mbox | patch
Permalink /patch/31201/
State New
Headers show

Comments

Uros Bizjak - Jan. 24, 2019, 9:40 a.m.
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.

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 <ubizjak@gmail.com>

2019-24-01  Uroš Bizjak  <ubizjak@gmail.com>

    * sysdeps/alpha/remqu.S (__remqu): Add missing restore
    of $f3 register on $y_is_neg path.

Uros.
Richard Henderson - Jan. 24, 2019, 6:04 p.m.
On 1/24/19 1:40 AM, Uros Bizjak wrote:
> 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.
> 
> 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 <ubizjak@gmail.com>
> 
> 2019-24-01  Uroš Bizjak  <ubizjak@gmail.com>
> 
>     * sysdeps/alpha/remqu.S (__remqu): Add missing restore
>     of $f3 register on $y_is_neg path.

Thanks.  I've created BZ# 24130 to go with this.
Siddhesh, ok to commit at this stage?


r~
Siddhesh Poyarekar - Jan. 24, 2019, 6:13 p.m.
On 24/01/19 11:34 PM, Richard Henderson wrote:
> On 1/24/19 1:40 AM, Uros Bizjak wrote:
>> 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.
>>
>> 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 <ubizjak@gmail.com>
>>
>> 2019-24-01  Uroš Bizjak  <ubizjak@gmail.com>
>>
>>     * sysdeps/alpha/remqu.S (__remqu): Add missing restore
>>     of $f3 register on $y_is_neg path.
> 
> Thanks.  I've created BZ# 24130 to go with this.
> Siddhesh, ok to commit at this stage?

This is fine.

Thanks,
Siddhesh

Patch

diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S
index c2c5caf3c20..a240ee97358 100644
--- a/sysdeps/alpha/remqu.S
+++ b/sysdeps/alpha/remqu.S
@@ -246,12 +246,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