Branch: master
Find file History
randall77 cmd/compile: implement shifts by signed amounts
Allow shifts by signed amounts. Panic if the shift amount is negative.

TODO: We end up doing two compares per shift, see Ian's comment
#19113 (comment) that
we could do it with a single comparison in the normal case.

The prove pass mostly handles this code well. For instance, it removes the
<0 check for cases like this:
    if s >= 0 { _ = x << s }
    _ = x << len(a)

This case isn't handled well yet:
    _ = x << (y & 0xf)
I'll do followon CLs for unhandled cases as needed.

Update #19113

R=go1.13

Change-Id: I839a5933d94b54ab04deb9dd5149f32c51c90fa1
Reviewed-on: https://go-review.googlesource.com/c/158719
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Latest commit 585c9e8 Jan 20, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
builtin cmd/compile: implement shifts by signed amounts Feb 15, 2019
testdata cmd/compile: use proved bounds to remove signed division fix-ups Oct 23, 2018
alg.go cmd/compile: bulk rename Nov 19, 2018
align.go cmd/compile: better documentation around checkwidth Oct 31, 2018
bexport.go cmd/compile: merge TPTR32 and TPTR64 as TPTR Oct 4, 2018
bimport.go cmd/compile/internal/gc: remove binary package export format Oct 3, 2018
bitset.go cmd/compile: inline calls to local closures Oct 11, 2017
bootstrap.go cmd/compile: add mutex profiling support Apr 5, 2017
builtin.go
builtin_test.go
bv.go cmd/compile/internal/gc: various minor cleanups Aug 20, 2018
class_string.go
closure.go cmd/compile: fix line number for implicitly declared method expressions Dec 22, 2018
const.go cmd/compile: fix constant index bounds check and error message Nov 30, 2018
constFold_test.go
dcl.go cmd/compile: bulk rename Nov 19, 2018
dump.go cmd/compile/internal/gc: add alternative node dumper for debugging Oct 1, 2018
dwinl.go cmd/compile/internal/gc: don't print "internal error" twice Nov 3, 2018
esc.go cmd/compile: fix unnamed parameter handling in escape analysis Dec 4, 2018
export.go cmd/compile: do not export float or complex constants with -asmhdr Feb 11, 2019
fixedbugs_test.go cmd/compile: move Issue 16214 test, delete asm_test file Apr 16, 2018
float_test.go cmd/compile: skip float32 constant folding test on 387 builder Sep 14, 2018
fmt.go cmd/compile,runtime: redo mid-stack inlining tracebacks Dec 28, 2018
gen.go cmd/compile, cmd/link: separate stable and internal ABIs Nov 12, 2018
global_test.go cmd/compile: use innermost line number for -S Dec 11, 2018
go.go cmd/compile: implement shifts by signed amounts Feb 15, 2019
gsubr.go cmd/compile: fix TestFormats Nov 12, 2018
iexport.go cmd/compile: increase nesting depth limit for type descriptors Dec 18, 2018
iface_test.go cmd/compile: inline convT2{I,E} when result doesn't escape Sep 19, 2016
iimport.go cmd/compile: increase nesting depth limit for type descriptors Dec 18, 2018
init.go cmd/compile: hide init functions in tracebacks Jan 27, 2019
inl.go cmd/compile,runtime: redo mid-stack inlining tracebacks Dec 28, 2018
inl_test.go cmd/compile: add Buffer.Grow to TestIntendedInlining Dec 1, 2018
lang_test.go cmd/compile: correct check for valid -lang version Nov 13, 2018
lex.go cmd/compile/internal/gc: update cgo_import_dynamic for AIX Nov 6, 2018
lex_test.go cmd/compile/internal/gc: update cgo_import_dynamic for AIX Nov 6, 2018
logic_test.go cmd/compile: add tests for logical simplification rewrite rules May 26, 2016
main.go cmd/compile: separate data and function LSyms Jan 11, 2019
mapfile_mmap.go
mapfile_read.go
mkbuiltin.go cmd/compile: factor out Pkg, Sym, and Type into package types Apr 7, 2017
mpfloat.go cmd/compile: accept new Go2 number literals Feb 11, 2019
mpint.go cmd/compile: accept new Go2 number literals Feb 11, 2019
noder.go cmd/compile: avoid multiple errors regarding misuse of ... in signatures Dec 5, 2018
norace.go cmd/compile: randomize compilation order when race-enabled Apr 27, 2017
obj.go cmd/internal/obj: don't dedup symbols in WriteObjFile Nov 3, 2018
op_string.go cmd/compile: bulk rename Nov 19, 2018
order.go
pgen.go
pgen_test.go cmd/compile: merge TPTR32 and TPTR64 as TPTR Oct 4, 2018
phi.go all: update comment URLs from HTTP to HTTPS, where possible Jun 1, 2018
plive.go cmd/compile: don't combine load+op if the op has SymAddr arguments Dec 12, 2018
pprof.go cmd/compile: add mutex profiling support Apr 5, 2017
race.go
racewalk.go cmd,runtime: enable race detector on arm64 Nov 13, 2018
range.go
reflect.go runtime: panic on uncomparable map key, even if map is empty Dec 29, 2018
reproduciblebuilds_test.go cmd/compile: add a test for reproducible build with anonymous interfaces Aug 28, 2018
scope.go
scope_test.go cmd/compile/internal/gc: various minor cleanups Aug 20, 2018
select.go
shift_test.go cmd/compile: test non-constant shifts Jun 1, 2016
sinit.go cmd/compile: fix static initializer Dec 3, 2018
sizeof_test.go cmd/compile: extract inline related fields into separate Inline type Apr 5, 2018
ssa.go cmd/compile: implement shifts by signed amounts Feb 15, 2019
ssa_test.go cmd/compile: move last compile tests to new test infrastructure Aug 24, 2018
subr.go
swt.go cmd/compile: modify swt.go to skip repeated walks of switch Jan 4, 2019
swt_test.go cmd/compile: reduce reliance on implementation details of Mpint Apr 7, 2017
syntax.go cmd/compile,runtime: redo mid-stack inlining tracebacks Dec 28, 2018
timings.go cmd/compile: add compiler phase timing Aug 17, 2016
trace.go cmd/compile/internal/gc: add runtime/trace support Oct 12, 2016
truncconst_test.go cmd/compile: diagnose constant division by complex zero Apr 12, 2017
typecheck.go cmd/compile: implement shifts by signed amounts Feb 15, 2019
types.go cmd/compile: merge TPTR32 and TPTR64 as TPTR Oct 4, 2018
types_acc.go cmd/compile: factor out Pkg, Sym, and Type into package types Apr 7, 2017
universe.go cmd/compile: fix ICE due to bad rune width Dec 20, 2018
unsafe.go cmd/compile: bulk rename Nov 19, 2018
util.go cmd/compile: add mutex profiling support Apr 5, 2017
walk.go cmd/compile,runtime: redo mid-stack inlining tracebacks Dec 28, 2018