aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/vlrt.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-07-26 11:51:33 -0700
committerKeith Randall <khr@golang.org>2016-08-10 17:41:01 +0000
commitc069bc49963bd5c2c152fe600fdcb9a2b7b58f76 (patch)
treeec3fddf4775c4092bb6e4b7beba0751940b1c2c7 /src/runtime/vlrt.go
parent77ef597f38e11e03522d1ccac34cfd39a1ca8d8e (diff)
downloadgo-c069bc49963bd5c2c152fe600fdcb9a2b7b58f76.tar.gz
go-c069bc49963bd5c2c152fe600fdcb9a2b7b58f76.zip
[dev.ssa] cmd/compile: implement GO386=387
Last part of the 386 SSA port. Modify the x86 backend to simulate SSE registers and instructions with 387 registers and instructions. The simulation isn't terribly performant, but it works, and the old implementation wasn't very performant either. Leaving to people who care about 387 to optimize if they want. Turn on SSA backend for 386 by default. Fixes #16358 Change-Id: I678fb59132620b2c47e993c1c10c4c21135f70c0 Reviewed-on: https://go-review.googlesource.com/25271 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/vlrt.go')
-rw-r--r--src/runtime/vlrt.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime/vlrt.go b/src/runtime/vlrt.go
index cd37828ae4..7300f55dad 100644
--- a/src/runtime/vlrt.go
+++ b/src/runtime/vlrt.go
@@ -255,3 +255,17 @@ func slowdodiv(n, d uint64) (q, r uint64) {
}
return q, n
}
+
+// Floating point control word values for GOARCH=386 GO386=387.
+// Bits 0-5 are bits to disable floating-point exceptions.
+// Bits 8-9 are the precision control:
+// 0 = single precision a.k.a. float32
+// 2 = double precision a.k.a. float64
+// Bits 10-11 are the rounding mode:
+// 0 = round to nearest (even on a tie)
+// 3 = round toward zero
+var (
+ controlWord64 uint16 = 0x3f + 2<<8 + 0<<10
+ controlWord32 = 0x3f + 0<<8 + 0<<10
+ controlWord64trunc = 0x3f + 2<<8 + 3<<10
+)