]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: repair MININT conversion bug in arm softfloat
authorDavid Chase <drchase@google.com>
Thu, 5 May 2016 20:35:10 +0000 (13:35 -0700)
committerDavid Chase <drchase@google.com>
Thu, 5 May 2016 22:29:25 +0000 (22:29 +0000)
Negative-case conversion code was wrong for minimum int32,
used negate-then-widen instead of widen-then-negate.

Test already exists; this fixes the failure.

Fixes #15563.

Change-Id: I4b0b3ae8f2c9714bdcc405d4d0b1502ccfba2b40
Reviewed-on: https://go-review.googlesource.com/22830
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/softfloat_arm.go

index 648b2e1169cffb8dec7330b4fdf146bb05c585c0..5f609c80d3ebae5924d5ae2e5be1f547f492a534 100644 (file)
@@ -530,7 +530,7 @@ execute:
        case 0xeeb80ac0: // D[regd] = S[regm] (MOVWF)
                cmp := int32(m.freglo[regm])
                if cmp < 0 {
-                       fputf(regd, f64to32(fintto64(int64(-cmp))))
+                       fputf(regd, f64to32(fintto64(-int64(cmp))))
                        m.freglo[regd] ^= 0x80000000
                } else {
                        fputf(regd, f64to32(fintto64(int64(cmp))))
@@ -552,7 +552,7 @@ execute:
        case 0xeeb80bc0: // D[regd] = S[regm] (MOVWD)
                cmp := int32(m.freglo[regm])
                if cmp < 0 {
-                       fputd(regd, fintto64(int64(-cmp)))
+                       fputd(regd, fintto64(-int64(cmp)))
                        m.freghi[regd] ^= 0x80000000
                } else {
                        fputd(regd, fintto64(int64(cmp)))