An error occurred fetching the project authors.
  1. 29 Mar, 2017 1 commit
    • Keith Randall's avatar
      cmd/compile: automatically handle commuting ops in rewrite rules · 041ecb69
      Keith Randall authored
      We have lots of rewrite rules that vary only in the fact that
      we have 2 versions for the 2 different orderings of various
      commuting ops. For example:
      
      (ADDL x (MOVLconst [c])) -> (ADDLconst [c] x)
      (ADDL (MOVLconst [c]) x) -> (ADDLconst [c] x)
      
      It can get unwieldly quickly, especially when there is more than
      one commuting op in a rule.
      
      Our existing "fix" for this problem is to have rules that
      canonicalize the operations first. For example:
      
      (Eq64 x (Const64 <t> [c])) && x.Op != OpConst64 -> (Eq64 (Const64 <t> [c]) x)
      
      Subsequent rules can then assume if there is a constant arg to Eq64,
      it will be the first one. This fix kinda works, but it is fragile and
      only works when we remember to include the required extra rules.
      
      The fundamental problem is that the rule matcher doesn't
      know anything about commuting ops. This CL fixes that fact.
      
      We already have information about which ops commute. (The register
      allocator takes advantage of commutivity.)  The rule generator now
      automatically generates multiple rules for a single source rule when
      there are commutative ops in the rule. We can now drop all of our
      almost-duplicate source-level rules and the canonicalization rules.
      
      I have some CLs in progress that will be a lot less verbose when
      the rule generator handles commutivity for me.
      
      I had to reorganize the load-combining rules a bit. The 8-way OR rules
      generated 128 different reorderings, which was causing the generator
      to put too much code in the rewrite*.go files (the big ones were going
      from 25K lines to 132K lines). Instead I reorganized the rules to
      combine pairs of loads at a time. The generated rule files are now
      actually a bit (5%) smaller.
      [Note to reviewers: check these carefully. Most of the other rule
      changes are trivial.]
      
      Make.bash times are ~unchanged.
      
      Compiler benchmarks are not observably different. Probably because
      we don't spend much compiler time in rule matching anyway.
      
      I've also done a pass over all of our ops adding commutative markings
      for ops which hadn't had them previously.
      
      Fixes #18292
      
      Change-Id: I999b1307272e91965b66754576019dedcbe7527a
      Reviewed-on: https://go-review.googlesource.com/38666
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      041ecb69
  2. 19 Mar, 2017 1 commit
    • Josh Bleecher Snyder's avatar
      cmd/compile: separate ssa.Frontend and ssa.TypeSource · aea3aff6
      Josh Bleecher Snyder authored
      Prior to this CL, the ssa.Frontend field was responsible
      for providing types to the backend during compilation.
      However, the types needed by the backend are few and static.
      It makes more sense to use a struct for them
      and to hang that struct off the ssa.Config,
      which is the correct home for readonly data.
      Now that Types is a struct, we can clean up the names a bit as well.
      
      This has the added benefit of allowing early construction
      of all types needed by the backend.
      This will be useful for concurrent backend compilation.
      
      Passes toolstash-check -all. No compiler performance change.
      
      Updates #15756
      
      Change-Id: I021658c8cf2836d6a22bbc20cc828ac38c7da08a
      Reviewed-on: https://go-review.googlesource.com/38336Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      aea3aff6
  3. 17 Mar, 2017 2 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: move Frontend field from ssa.Config to ssa.Func · 2cdb7f11
      Josh Bleecher Snyder authored
      Suggested by mdempsky in CL 38232.
      This allows us to use the Frontend field
      to associate frontend state and information
      with a function.
      See the following CL in the series for examples.
      
      This is a giant CL, but it is almost entirely routine refactoring.
      
      The ssa test API is starting to feel a bit unwieldy.
      I will clean it up separately, once the dust has settled.
      
      Passes toolstash -cmp.
      
      Updates #15756
      
      Change-Id: I71c573bd96ff7251935fce1391b06b1f133c3caf
      Reviewed-on: https://go-review.googlesource.com/38327
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      2cdb7f11
    • Josh Bleecher Snyder's avatar
      cmd/compile: evaluate config as needed in rewrite rules · 193510f2
      Josh Bleecher Snyder authored
      Prior to this CL, config was an explicit argument
      to the SSA rewrite rules, and rules that needed
      a Frontend got at it via config.
      An upcoming CL moves Frontend from Config to Func,
      so rules can no longer reach Frontend via Config.
      Passing a Frontend as an argument to the rewrite rules
      causes a 2-3% regression in compile times.
      This CL takes a different approach:
      It treats the variable names "config" and "fe"
      as special and calculates them as needed.
      The "as needed part" is also important to performance:
      If they are calculated eagerly, the nilchecks themselves
      cause a regression.
      
      This introduces a little bit of magic into the rewrite
      generator. However, from the perspective of the rules,
      the config variable was already more or less magic.
      And it makes the upcoming changes much clearer.
      
      Passes toolstash -cmp.
      
      Change-Id: I173f2bcc124cba43d53138bfa3775e21316a9107
      Reviewed-on: https://go-review.googlesource.com/38326
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
      193510f2
  4. 16 Mar, 2017 1 commit
  5. 13 Mar, 2017 1 commit
  6. 03 Mar, 2017 1 commit
  7. 28 Feb, 2017 1 commit
    • Michael Munday's avatar
      cmd/compile: emit fused multiply-{add,subtract} instructions on s390x · bd8a39b6
      Michael Munday authored
      Explcitly block fused multiply-add pattern matching when a cast is used
      after the multiplication, for example:
      
          - (a * b) + c        // can emit fused multiply-add
          - float64(a * b) + c // cannot emit fused multiply-add
      
      float{32,64} and complex{64,128} casts of matching types are now kept
      as OCONV operations rather than being replaced with OCONVNOP operations
      because they now imply a rounding operation (and therefore aren't a
      no-op anymore).
      
      Operations (for example, multiplication) on complex types may utilize
      fused multiply-add and -subtract instructions internally. There is no
      way to disable this behavior at the moment.
      
      Improves the performance of the floating point implementation of
      poly1305:
      
      name         old speed     new speed     delta
      64           246MB/s ± 0%  275MB/s ± 0%  +11.48%   (p=0.000 n=10+8)
      1K           312MB/s ± 0%  357MB/s ± 0%  +14.41%  (p=0.000 n=10+10)
      64Unaligned  246MB/s ± 0%  274MB/s ± 0%  +11.43%  (p=0.000 n=10+10)
      1KUnaligned  312MB/s ± 0%  357MB/s ± 0%  +14.39%   (p=0.000 n=10+8)
      
      Updates #17895.
      
      Change-Id: Ia771d275bb9150d1a598f8cc773444663de5ce16
      Reviewed-on: https://go-review.googlesource.com/36963
      Run-TryBot: Michael Munday <munday@ca.ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      bd8a39b6
  8. 17 Feb, 2017 1 commit
  9. 02 Feb, 2017 1 commit
  10. 08 Dec, 2016 1 commit
  11. 27 Oct, 2016 1 commit
    • Keith Randall's avatar
      cmd/compile: use masks instead of branches for slicing · deb4177c
      Keith Randall authored
      When we do
      
        var x []byte = ...
        y := x[i:]
      
      We can't just use y.ptr = x.ptr + i, as the new pointer may point to the
      next object in memory after the backing array.
      We used to fix this by doing:
      
        y.cap = x.cap - i
        delta := i
        if y.cap == 0 {
          delta = 0
        }
        y.ptr = x.ptr + delta
      
      That generates a branch in what is otherwise straight-line code.
      
      Better to do:
      
        y.cap = x.cap - i
        mask := (y.cap - 1) >> 63 // -1 if y.cap==0, 0 otherwise
        y.ptr = x.ptr + i &^ mask
      
      It's about the same number of instructions (~4, depending on what
      parts are constant, and the target architecture), but it is all
      inline. It plays nicely with CSE, and the mask can be computed
      in parallel with the index (in cases where a multiply is required).
      
      It is a minor win in both speed and space.
      
      Change-Id: Ied60465a0b8abb683c02208402e5bb7ac0e8370f
      Reviewed-on: https://go-review.googlesource.com/32022
      Run-TryBot: Keith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      deb4177c
  12. 30 Aug, 2016 1 commit
  13. 26 Aug, 2016 1 commit
  14. 25 Aug, 2016 1 commit
    • Cherry Zhang's avatar
      cmd/compile: get MIPS64 SSA working · e71e1fe8
      Cherry Zhang authored
      - implement *, /, %, shifts, Zero, Move.
      - fix mistakes in comparison.
      - fix floating point rounding.
      - handle RetJmp in assembler (which was not handled, as a consequence
        Duff's device was disabled in the old backend.)
      
      all.bash now passes with SSA on.
      
      Updates #16359.
      
      Change-Id: Ia14eed0ed1176b5d800592080c8f53dded7fe73f
      Reviewed-on: https://go-review.googlesource.com/27592Reviewed-by: default avatarDavid Chase <drchase@google.com>
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e71e1fe8
  15. 22 Aug, 2016 1 commit