• Keith Randall's avatar
    [dev.ssa] cmd/compile/internal/ssa: redo how sign extension is handled · 2a5e6c47
    Keith Randall authored
    For integer types less than a machine register, we have to decide
    what the invariants are for the high bits of the register.  We used
    to set the high bits to the correct extension (sign or zero, as
    determined by the type) of the low bits.
    
    This CL makes the compiler ignore the high bits of the register
    altogether (they are junk).
    
    On this plus side, this means ops that generate subword results don't
    have to worry about correctly extending them.  On the minus side,
    ops that consume subword arguments have to deal with the input
    registers not being correctly extended.
    
    For x86, this tradeoff is probably worth it.  Almost all opcodes
    have versions that use only the correct subword piece of their
    inputs.  (The one big exception is array indexing.)  Not many opcodes
    can correctly sign extend on output.
    
    For other architectures, the tradeoff is probably not so clear, as
    they don't have many subword-safe opcodes (e.g. 16-bit compare,
    ignoring the high 16/48 bits).  Fortunately we can decide whether
    we do this per-architecture.
    
    For the machine-independent opcodes, we pretend that the "register"
    size is equal to the type width, so sign extension is immaterial.
    Opcodes that care about the signedness of the input (e.g. compare,
    right shift) have two different variants.
    
    Change-Id: I465484c5734545ee697afe83bc8bf4b53bd9df8d
    Reviewed-on: https://go-review.googlesource.com/12600Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    2a5e6c47
Name
Last commit
Last update
..
builtin Loading commit data...
testdata Loading commit data...
align.go Loading commit data...
builtin.go Loading commit data...
bv.go Loading commit data...
cgen.go Loading commit data...
closure.go Loading commit data...
const.go Loading commit data...
cplx.go Loading commit data...
dcl.go Loading commit data...
esc.go Loading commit data...
export.go Loading commit data...
fmt.go Loading commit data...
gen.go Loading commit data...
go.go Loading commit data...
go.y Loading commit data...
gsubr.go Loading commit data...
init.go Loading commit data...
inl.go Loading commit data...
lex.go Loading commit data...
mkbuiltin.go Loading commit data...
mparith2.go Loading commit data...
mparith3.go Loading commit data...
obj.go Loading commit data...
opnames.go Loading commit data...
order.go Loading commit data...
pgen.go Loading commit data...
plive.go Loading commit data...
popt.go Loading commit data...
racewalk.go Loading commit data...
range.go Loading commit data...
reflect.go Loading commit data...
reg.go Loading commit data...
select.go Loading commit data...
sinit.go Loading commit data...
ssa.go Loading commit data...
ssa_test.go Loading commit data...
subr.go Loading commit data...
swt.go Loading commit data...
syntax.go Loading commit data...
type.go Loading commit data...
typecheck.go Loading commit data...
unsafe.go Loading commit data...
util.go Loading commit data...
walk.go Loading commit data...
y.go Loading commit data...