...
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
6XEDDATA="${XEDDATA:-xeddata}"
7if [[ ! -d "$XEDDATA" ]]; then
8 echo >&2 "Must either set \$XEDDATA or symlink xeddata/ to the XED obj/dgen directory."
9 exit 1
10fi
11
12# Ensure that goroot is the appropriate ancestor of this directory
13which go >/dev/null || exit 1
14goroot="$(go env GOROOT)"
15ancestor="../../../../.."
16if [[ ! $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
20fi
21
22set -ex
23
24# Regenerate SIMD files
25go run . -o godefs -goroot "$goroot" -xedPath "$XEDDATA" go.yaml types.yaml categories.yaml
26# Regenerate SSA files from SIMD rules
27go run -C "$goroot"/src/cmd/compile/internal/ssa/_gen .
28
29# Rebuild compiler
30cd "$goroot"/src
31go install cmd/compile
32
33# Tests
34# Set the GOEXPERIMENT explicitly.
35GOEXPERIMENT=simd GOARCH=amd64 go run -C simd/archsimd/testdata .
36GOEXPERIMENT=simd GOARCH=amd64 go test -v simd/archsimd
37GOEXPERIMENT=simd GOARCH=amd64 go test go/doc go/build
38GOEXPERIMENT=simd GOARCH=amd64 go test cmd/api -v -check -run ^TestCheck$
39GOEXPERIMENT=simd GOARCH=amd64 go test cmd/compile/internal/ssagen -simd=0
40
41# Check tests without the GOEXPERIMENT
42GOEXPERIMENT= go test go/doc go/build
43GOEXPERIMENT= go test cmd/api -v -check -run ^TestCheck$
44GOEXPERIMENT= go test cmd/compile/internal/ssagen -simd=0
45
46# TODO: Add some tests of SIMD itself
View as plain text