diff options
author | David Chase <drchase@google.com> | 2016-04-29 11:15:16 -0400 |
---|---|---|
committer | David Chase <drchase@google.com> | 2016-04-29 16:20:18 +0000 |
commit | d8d33514f9e8c80d504ab4a61ef96621afc3647d (patch) | |
tree | 284f809787f4edd590418738824fcc3da423de59 /src/cmd/compile/internal/test | |
parent | fa9435cdff443d12c526b0436435925dd52e8503 (diff) | |
download | go-d8d33514f9e8c80d504ab4a61ef96621afc3647d.tar.gz go-d8d33514f9e8c80d504ab4a61ef96621afc3647d.zip |
cmd/compile: Move divconst_test out of test/bench/go1
This is necessary to avoid disrupting the go1 suite and gives
us a place to put other tests of basic compiler function and
correctness.
Change-Id: I36933819ff2bfe6a2121fff2be9a98efd2123d9a
Reviewed-on: https://go-review.googlesource.com/22597
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/test')
-rw-r--r-- | src/cmd/compile/internal/test/README | 4 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/divconst_test.go | 73 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/test.go | 1 |
3 files changed, 78 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/test/README b/src/cmd/compile/internal/test/README new file mode 100644 index 0000000000..242ff794cb --- /dev/null +++ b/src/cmd/compile/internal/test/README @@ -0,0 +1,4 @@ +This directory holds small tests and benchmarks of code +generated by the compiler. This code is not for importing, +and the tests are intended to verify that specific optimzations +are applied and correct. diff --git a/src/cmd/compile/internal/test/divconst_test.go b/src/cmd/compile/internal/test/divconst_test.go new file mode 100644 index 0000000000..f585a5b51f --- /dev/null +++ b/src/cmd/compile/internal/test/divconst_test.go @@ -0,0 +1,73 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package test + +import ( + "testing" +) + +var i64res int64 + +func BenchmarkDivconstI64(b *testing.B) { + for i := 0; i < b.N; i++ { + i64res = int64(i) / 7 + } +} + +var u64res uint64 + +func BenchmarkDivconstU64(b *testing.B) { + for i := 0; i < b.N; i++ { + u64res = uint64(i) / 7 + } +} + +var i32res int32 + +func BenchmarkDivconstI32(b *testing.B) { + for i := 0; i < b.N; i++ { + i32res = int32(i) / 7 + } +} + +var u32res uint32 + +func BenchmarkDivconstU32(b *testing.B) { + for i := 0; i < b.N; i++ { + u32res = uint32(i) / 7 + } +} + +var i16res int16 + +func BenchmarkDivconstI16(b *testing.B) { + for i := 0; i < b.N; i++ { + i16res = int16(i) / 7 + } +} + +var u16res uint16 + +func BenchmarkDivconstU16(b *testing.B) { + for i := 0; i < b.N; i++ { + u16res = uint16(i) / 7 + } +} + +var i8res int8 + +func BenchmarkDivconstI8(b *testing.B) { + for i := 0; i < b.N; i++ { + i8res = int8(i) / 7 + } +} + +var u8res uint8 + +func BenchmarkDivconstU8(b *testing.B) { + for i := 0; i < b.N; i++ { + u8res = uint8(i) / 7 + } +} diff --git a/src/cmd/compile/internal/test/test.go b/src/cmd/compile/internal/test/test.go new file mode 100644 index 0000000000..56e5404079 --- /dev/null +++ b/src/cmd/compile/internal/test/test.go @@ -0,0 +1 @@ +package test |