1. 16 Aug, 2016 26 commits
  2. 15 Aug, 2016 5 commits
  3. 11 Aug, 2016 3 commits
  4. 10 Aug, 2016 4 commits
    • Cherry Zhang's avatar
      [dev.ssa] cmd/internal/obj/arm64: fix encoding constant into some instructions · 748aa844
      Cherry Zhang authored
      When a constant can be encoded in a logical instruction (BITCON), do
      it this way instead of using the constant pool. The BITCON testing
      code runs faster than table lookup (using map):
      
      (on AMD64 machine, with pseudo random input)
      BenchmarkIsBitcon-4   	300000000	         4.04 ns/op
      BenchmarkTable-4      	50000000	        27.3 ns/op
      
      The equivalent C code of BITCON testing is formally verified with
      model checker CBMC against linear search of the lookup table.
      
      Also handle cases when a constant can be encoded in a MOV instruction.
      In this case, materializa the constant into REGTMP without using the
      constant pool.
      
      When constants need to be added to the constant pool, make sure to
      check whether it fits in 32-bit. If not, store 64-bit.
      
      Both legacy and SSA compiler backends are happy with this.
      
      Fixes #16226.
      
      Change-Id: I883e3069dee093a1cdc40853c42221a198a152b0
      Reviewed-on: https://go-review.googlesource.com/26631
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      748aa844
    • Josh Bleecher Snyder's avatar
      testing: respect benchtime on very fast benchmarks · 31ad583a
      Josh Bleecher Snyder authored
      When ns/op dropped below 1, the old code
      ignored benchtime and reverted to 1s.
      
      Change-Id: I59752cef88d8d73bfd5b085f5400ae657f78504e
      Reviewed-on: https://go-review.googlesource.com/26664
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: 's avatarMarcel van Lohuizen <mpvl@golang.org>
      31ad583a
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: implement GO386=387 · c069bc49
      Keith Randall authored
      Last part of the 386 SSA port.
      
      Modify the x86 backend to simulate SSE registers and
      instructions with 387 registers and instructions.
      The simulation isn't terribly performant, but it works,
      and the old implementation wasn't very performant either.
      Leaving to people who care about 387 to optimize if they want.
      
      Turn on SSA backend for 386 by default.
      
      Fixes #16358
      
      Change-Id: I678fb59132620b2c47e993c1c10c4c21135f70c0
      Reviewed-on: https://go-review.googlesource.com/25271
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      c069bc49
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: more fixes for 386 shared libraries · 77ef597f
      Keith Randall authored
      Use the destination register for materializing the pc
      for GOT references also. See https://go-review.googlesource.com/c/25442/
      The SSA backend assumes CX does not get clobbered for these instructions.
      
      Mark duffzero as clobbering CX. The linker needs to clobber CX
      to materialize the address to call. (This affects the non-shared-library
      duffzero also, but hopefully forbidding one register across duffzero
      won't be a big deal.)
      
      Hopefully this is all the cases where the linker is clobbering CX
      under the hood and SSA assumes it isn't.
      
      Change-Id: I080c938170193df57cd5ce1f2a956b68a34cc886
      Reviewed-on: https://go-review.googlesource.com/26611
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarMichael Hudson-Doyle <michael.hudson@canonical.com>
      77ef597f
  5. 09 Aug, 2016 2 commits
    • David Chase's avatar
      [dev.ssa] cmd/compile: PPC: FP load/store/const/cmp/neg; div/mod · ff37d0e6
      David Chase authored
      FP<->int conversions remain.
      
      Updates #16010.
      
      Change-Id: I38d7a4923e34d0a489935fffc4c96c020cafdba2
      Reviewed-on: https://go-review.googlesource.com/25589
      Run-TryBot: David Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      ff37d0e6
    • Keith Randall's avatar
      [dev.ssa] cmd/compile: fix PIC for SSA-generated code · 2cbdd55d
      Keith Randall authored
      Access to globals requires a 2-instruction sequence on PIC 386.
      
          MOVL foo(SB), AX
      
      is translated by the obj package into:
      
          CALL getPCofNextInstructionInTempRegister(SB)
          MOVL (&foo-&thisInstruction)(tmpReg), AX
      
      The call returns the PC of the next instruction in a register.
      The next instruction then offsets from that register to get the
      address required.  The tricky part is the allocation of the
      temp register.  The legacy compiler always used CX, and forbid
      the register allocator from allocating CX when in PIC mode.
      We can't easily do that in SSA because CX is actually a required
      register for shift instructions. (I think the old backend got away
      with this because the register allocator never uses CX, only
      codegen knows that shifts must use CX.)
      
      Instead, we allow the temp register to be anything.  When the
      destination of the MOV (or LEA) is an integer register, we can
      use that register.  Otherwise, we make sure to compile the
      operation using an LEA to reference the global.  So
      
          MOVL AX, foo(SB)
      
      is never generated directly.  Instead, SSA generates:
      
          LEAL foo(SB), DX
          MOVL AX, (DX)
      
      which is then rewritten by the obj package to:
      
          CALL getPcInDX(SB)
          LEAL (&foo-&thisInstruction)(DX), AX
          MOVL AX, (DX)
      
      So this CL modifies the obj package to use different thunks
      to materialize the pc into different registers.  We use the
      registers that regalloc chose so that SSA can still allocate
      the full set of registers.
      
      Change-Id: Ie095644f7164a026c62e95baf9d18a8bcaed0bba
      Reviewed-on: https://go-review.googlesource.com/25442
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarDavid Chase <drchase@google.com>
      2cbdd55d