1 #!/bin/bash
2
3 # This is an end-to-end test of Go SIMD. It updates all generated
4 # files in this repo and then runs several tests.
5
6 XEDDATA="${XEDDATA:-xeddata}"
7 if [[ ! -d "$XEDDATA" ]]; then
8 echo >&2 "Must either set \$XEDDATA or symlink xeddata/ to the XED obj/dgen directory."
9 exit 1
10 fi
11
12 # Ensure that goroot is the appropriate ancestor of this directory
13 which go >/dev/null || exit 1
14 goroot="$(go env GOROOT)"
15 ancestor="../../../../.."
16 if [[ ! $ancestor -ef "$goroot" ]]; then
17 # We might be able to make this work but it's SO CONFUSING.
18 echo >&2 "go command in path has GOROOT $goroot instead of" `(cd $ancestor; pwd)`
19 exit 1
20 fi
21
22 set -ex
23
24 # Regenerate SIMD files
25 go run . -o godefs -goroot "$goroot" -xedPath "$XEDDATA" go.yaml types.yaml categories.yaml
26 # Regenerate SSA files from SIMD rules
27 go run -C "$goroot"/src/cmd/compile/internal/ssa/_gen .
28
29 # Rebuild compiler
30 cd "$goroot"/src
31 go install cmd/compile
32
33 # Tests
34 # Set the GOEXPERIMENT explicitly.
35 GOEXPERIMENT=simd GOARCH=amd64 go run -C simd/archsimd/testdata .
36 GOEXPERIMENT=simd GOARCH=amd64 go test -v simd/archsimd
37 GOEXPERIMENT=simd GOARCH=amd64 go test go/doc go/build
38 GOEXPERIMENT=simd GOARCH=amd64 go test cmd/api -v -check -run ^TestCheck$
39 GOEXPERIMENT=simd GOARCH=amd64 go test cmd/compile/internal/ssagen -simd=0
40
41 # Check tests without the GOEXPERIMENT
42 GOEXPERIMENT= go test go/doc go/build
43 GOEXPERIMENT= go test cmd/api -v -check -run ^TestCheck$
44 GOEXPERIMENT= go test cmd/compile/internal/ssagen -simd=0
45
46 # TODO: Add some tests of SIMD itself
47
View as plain text