• Keith Randall's avatar
    cmd/compile: define high bits of AuxInt · 7fc56219
    Keith Randall authored
    Previously if we were only using the low bits of AuxInt,
    the high bits were ignored and could be junk.  This CL
    changes that behavior to define the high bits to be the
    sign-extended version of the low bits for all cases.
    
    There are 2 main benefits:
    - Deterministic representation.  This helps with CSE.
      (Const8 [0x1]) and (Const8 [0x101]) used to be the same "value"
      but CSE couldn't see them as such.
    - Testability.  We can check that all ops leave AuxInt in a state
      consistent with the new rule.  In the old scheme, it was hard
      to check whether a rule correctly used only the low-order bits.
    Side benefits:
    - ==0 and !=0 tests are easier.
    
    Drawbacks:
    - This differs from the runtime representation in registers,
      where it is important that we allow upper bits to be undefined
      (so we're not sign/zero-extending all the time).
    - Ops that treat AuxInt as unsigned (shifts, mostly) need to be
      a bit more careful.
    
    Change-Id: I9a685ff27e36dc03287c9ab1cecd6c0b4045c819
    Reviewed-on: https://go-review.googlesource.com/21256Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    7fc56219
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...