Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/compile: enable const division for arm64
performance: benchmark old ns/op new ns/op delta BenchmarkDivconstI64-8 8.28 2.70 -67.39% BenchmarkDivconstU64-8 8.28 4.69 -43.36% BenchmarkDivconstI32-8 8.28 6.39 -22.83% BenchmarkDivconstU32-8 8.28 4.43 -46.50% BenchmarkDivconstI16-8 5.17 5.17 +0.00% BenchmarkDivconstU16-8 5.33 5.34 +0.19% BenchmarkDivconstI8-8 3.50 3.50 +0.00% BenchmarkDivconstU8-8 3.51 3.50 -0.28% Fixes #15382 Change-Id: Ibce7b28f0586d593b33c4d4ecc5d5e7e7c905d13 Reviewed-on: https://go-review.googlesource.com/22292 Reviewed-by: Michael Munday <munday@ca.ibm.com> Reviewed-by: David Chase <drchase@google.com>
- Loading branch information
Showing
11 changed files
with
202 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 go1 | ||
|
||
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 | ||
} | ||
} |