]> Cypherpunks repositories - gostls13.git/commit
internal/cpu: add experiment to disable CPU features with GODEBUGCPU
authorMartin Möhrmann <moehrmann@google.com>
Fri, 26 Jan 2018 11:14:27 +0000 (12:14 +0100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 22 May 2018 18:49:31 +0000 (18:49 +0000)
commitf045ddc624dea292257249a618e4ad1bd2bd5c6e
tree24569109aedd91e0c6540b8f2af723c0fe9c0a03
parent3d15f768814e8b06ae159b4da8f34a0c702a4cf1
internal/cpu: add experiment to disable CPU features with GODEBUGCPU

Needs the go compiler to be build with GOEXPERIMENT=debugcpu to be active.

The GODEBUGCPU environment variable can be used to disable usage of
specific processor features in the Go standard library.
This is useful for testing and benchmarking different code paths that
are guarded by internal/cpu variable checks.

Use of processor features can not be enabled through GODEBUGCPU.

To disable usage of AVX and SSE41 cpu features on GOARCH amd64 use:
GODEBUGCPU=avx=0,sse41=0

The special "all" option can be used to disable all options:
GODEBUGCPU=all=0

Updates #12805
Updates #15403

Change-Id: I699c2e6f74d98472b6fb4b1e5ffbf29b15697aab
Reviewed-on: https://go-review.googlesource.com/91737
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
15 files changed:
src/cmd/internal/objabi/util.go
src/internal/cpu/cpu.go
src/internal/cpu/cpu_386.go [new file with mode: 0644]
src/internal/cpu/cpu_amd64.go [new file with mode: 0644]
src/internal/cpu/cpu_amd64p32.go [new file with mode: 0644]
src/internal/cpu/cpu_arm64.go
src/internal/cpu/cpu_arm64_test.go [new file with mode: 0644]
src/internal/cpu/cpu_no_init.go
src/internal/cpu/cpu_ppc64x.go
src/internal/cpu/cpu_ppc64x_test.go [new file with mode: 0644]
src/internal/cpu/cpu_test.go
src/internal/cpu/cpu_x86.go
src/internal/cpu/cpu_x86_test.go [new file with mode: 0644]
src/internal/cpu/export_test.go [new file with mode: 0644]
src/runtime/proc.go