]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: skip float32 constant folding test on 387 builder
authorMichael Munday <mike.munday@ibm.com>
Thu, 13 Sep 2018 12:16:46 +0000 (13:16 +0100)
committerMichael Munday <mike.munday@ibm.com>
Fri, 14 Sep 2018 12:39:54 +0000 (12:39 +0000)
The 387 unit always quietens float64 and float32 signaling NaNs,
even when just loading and storing them. This makes it difficult
to propagate such values in the compiler. This is a hard problem
to fix and it is also very obscure.

Updates #27516.

Change-Id: I03d88e31f14c86fa682fcea4b6d1fba18968aee8
Reviewed-on: https://go-review.googlesource.com/135195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/float_test.go

index c0a8cfc89e6d775a1e2faca49772716648c542e4..c5c604003ab8dd54e494aeca9123092ee2d2d0e9 100644 (file)
@@ -6,6 +6,8 @@ package gc
 
 import (
        "math"
+       "os"
+       "runtime"
        "testing"
 )
 
@@ -364,11 +366,19 @@ func TestFloatConvertFolded(t *testing.T) {
 
 func TestFloat32StoreToLoadConstantFold(t *testing.T) {
        // Test that math.Float32{,from}bits constant fold correctly.
-       // In particular we need to be careful that signalling NaN (sNaN) values
+       // In particular we need to be careful that signaling NaN (sNaN) values
        // are not converted to quiet NaN (qNaN) values during compilation.
        // See issue #27193 for more information.
 
-       // signalling NaNs
+       // TODO: this method for detecting 387 won't work if the compiler has been
+       // built using GOARCH=386 GO386=387 and either the target is a different
+       // architecture or the GO386=387 environment variable is not set when the
+       // test is run.
+       if runtime.GOARCH == "386" && os.Getenv("GO386") == "387" {
+               t.Skip("signaling NaNs are not propagated on 387 (issue #27516)")
+       }
+
+       // signaling NaNs
        {
                const nan = uint32(0x7f800001) // sNaN
                if x := math.Float32bits(math.Float32frombits(nan)); x != nan {