diff --git a/src/cmd/compile/internal/gc/ssa_test.go b/src/cmd/compile/internal/gc/ssa_test.go index 8a233eafe0..c89917df88 100644 --- a/src/cmd/compile/internal/gc/ssa_test.go +++ b/src/cmd/compile/internal/gc/ssa_test.go @@ -57,12 +57,7 @@ func TestArithmetic(t *testing.T) { } // TestFP tests that both backends have the same result for floating point expressions. -func TestFP(t *testing.T) { - if runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { - t.Skip("legacy mips64 compiler doesn't handle uint->float conversion correctly (issue 15552)") - } - runTest(t, "fp_ssa.go") -} +func TestFP(t *testing.T) { runTest(t, "fp_ssa.go") } // TestArithmeticBoundary tests boundary results for arithmetic operations. func TestArithmeticBoundary(t *testing.T) { runTest(t, "arithBoundary_ssa.go") } diff --git a/src/cmd/compile/internal/mips64/gsubr.go b/src/cmd/compile/internal/mips64/gsubr.go index 864fd76d12..eb56d8b82e 100644 --- a/src/cmd/compile/internal/mips64/gsubr.go +++ b/src/cmd/compile/internal/mips64/gsubr.go @@ -466,7 +466,7 @@ func gmove(f *gc.Node, t *gc.Node) { //return; // algorithm is: // if small enough, use native int64 -> float64 conversion. - // otherwise, halve (rounding to odd?), convert, and double. + // otherwise, halve (x -> (x>>1)|(x&1)), convert, and double. /* * integer to float */ @@ -496,9 +496,16 @@ func gmove(f *gc.Node, t *gc.Node) { gmove(&bigi, &rtmp) gins(mips.AAND, &r1, &rtmp) p1 := ginsbranch(mips.ABEQ, nil, &rtmp, nil, 0) - p2 := gins(mips.ASRLV, nil, &r1) + var r3 gc.Node + gc.Regalloc(&r3, gc.Types[gc.TUINT64], nil) + p2 := gins3(mips.AAND, nil, &r1, &r3) p2.From.Type = obj.TYPE_CONST p2.From.Offset = 1 + p3 := gins(mips.ASRLV, nil, &r1) + p3.From.Type = obj.TYPE_CONST + p3.From.Offset = 1 + gins(mips.AOR, &r3, &r1) + gc.Regfree(&r3) gc.Patch(p1, gc.Pc) }