• 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
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...