• 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
AMD64.rules 60.9 KB