diff options
| author | Bryan C. Mills <bcmills@google.com> | 2020-02-25 14:36:38 +0000 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2020-02-25 15:49:19 +0000 |
| commit | a9f1ea4a83da919acc254107661b99d0d6f8c7ec (patch) | |
| tree | f84c1473f39cb28963e36e18fea6a65c160798fb /test/codegen | |
| parent | 58ba0f9dcd6c8a94ad59609a370805902ebffd79 (diff) | |
| download | go-a9f1ea4a83da919acc254107661b99d0d6f8c7ec.tar.xz | |
Revert "cmd/compile: don't allow NaNs in floating-point constant ops"
This reverts CL 213477.
Reason for revert: tests are failing on linux-mips*-rtrk builders.
Change-Id: I8168f7450890233f1bd7e53930b73693c26d4dc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/220897
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/math.go | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/test/codegen/math.go b/test/codegen/math.go index 1ebfda0405..80e5d60d96 100644 --- a/test/codegen/math.go +++ b/test/codegen/math.go @@ -151,13 +151,13 @@ func toFloat32(u32 uint32) float32 { func constantCheck64() bool { // amd64:"MOVB\t[$]0",-"FCMP",-"MOVB\t[$]1" // s390x:"MOV(B|BZ|D)\t[$]0,",-"FCMPU",-"MOV(B|BZ|D)\t[$]1," - return 0.5 == float64(uint32(1)) || 1.5 > float64(uint64(1<<63)) + return 0.5 == float64(uint32(1)) || 1.5 > float64(uint64(1<<63)) || math.NaN() == math.NaN() } func constantCheck32() bool { // amd64:"MOVB\t[$]1",-"FCMP",-"MOVB\t[$]0" // s390x:"MOV(B|BZ|D)\t[$]1,",-"FCMPU",-"MOV(B|BZ|D)\t[$]0," - return float32(0.5) <= float32(int64(1)) && float32(1.5) >= float32(int32(-1<<31)) + return float32(0.5) <= float32(int64(1)) && float32(1.5) >= float32(int32(-1<<31)) && float32(math.NaN()) != float32(math.NaN()) } // Test that integer constants are converted to floating point constants @@ -186,32 +186,3 @@ func constantConvertInt32(x uint32) uint32 { } return x } - -func nanGenerate64() float64 { - // Test to make sure we don't generate a NaN while constant propagating. - // See issue 36400. - zero := 0.0 - // amd64:-"DIVSD" - inf := 1 / zero // +inf. We can constant propagate this one. - negone := -1.0 - - // amd64:"DIVSD" - z0 := zero / zero - // amd64:"MULSD" - z1 := zero * inf - // amd64:"SQRTSD" - z2 := math.Sqrt(negone) - return z0 + z1 + z2 -} - -func nanGenerate32() float32 { - zero := float32(0.0) - // amd64:-"DIVSS" - inf := 1 / zero // +inf. We can constant propagate this one. - - // amd64:"DIVSS" - z0 := zero / zero - // amd64:"MULSS" - z1 := zero * inf - return z0 + z1 -} |
