summaryrefslogtreecommitdiff
path: root/test/loopbce.go
diff options
context:
space:
mode:
authorJakub Ciolek <jakub@ciolek.dev>2022-10-03 18:08:29 +0200
committerKeith Randall <khr@golang.org>2023-01-23 18:10:40 +0000
commitbb5ff5342d31723ecf245e8e53b79bce23b88839 (patch)
tree4e8cb4c2a64b9b2c64b2727c735c4f38dbbbd1a9 /test/loopbce.go
parent9411075748e305d0b31372cab48bc4ca2dd745fb (diff)
downloadgo-git-bb5ff5342d31723ecf245e8e53b79bce23b88839.tar.gz
cmd/compile: make loopbce handle 8, 16 and 32 bit induction variables
Compute limits and increment values for all integer widths. Resolves 2 TODO's in loopbce.go compilecmp linux/amd64: compress/flate compress/flate.(*huffmanEncoder).bitCounts 1235 -> 1207 (-2.27%) cmd/internal/obj/wasm cmd/internal/obj/wasm.assemble 7443 -> 7303 (-1.88%) cmd/internal/obj/wasm.assemble.func1 165 -> 138 (-16.36%) cmd/link/internal/ld cmd/link/internal/ld.(*Link).findfunctab.func1 1646 -> 1627 (-1.15%) Change-Id: I2d79b7376eb67d6bcc8fdaf0c197c11e631562d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/435258 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test/loopbce.go')
-rw-r--r--test/loopbce.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/loopbce.go b/test/loopbce.go
index db830daf5c..fcf0d8d90d 100644
--- a/test/loopbce.go
+++ b/test/loopbce.go
@@ -63,6 +63,30 @@ func f5(a [10]int) int {
return x
}
+func f5_int32(a [10]int) int {
+ x := 0
+ for i := int32(-10); i < int32(len(a)); i += 2 { // ERROR "Induction variable: limits \[-10,8\], increment 2$"
+ x += a[i]
+ }
+ return x
+}
+
+func f5_int16(a [10]int) int {
+ x := 0
+ for i := int16(-10); i < int16(len(a)); i += 2 { // ERROR "Induction variable: limits \[-10,8\], increment 2$"
+ x += a[i]
+ }
+ return x
+}
+
+func f5_int8(a [10]int) int {
+ x := 0
+ for i := int8(-10); i < int8(len(a)); i += 2 { // ERROR "Induction variable: limits \[-10,8\], increment 2$"
+ x += a[i]
+ }
+ return x
+}
+
func f6(a []int) {
for i := range a { // ERROR "Induction variable: limits \[0,\?\), increment 1$"
b := a[0:i] // ERROR "(\([0-9]+\) )?Proved IsSliceInBounds$"