1. 03 Sep, 2018 4 commits
    • Michael Munday's avatar
      cmd/compile: implement OnesCount{8,16,32,64} intrinsics on s390x · 6f9b94ab
      Michael Munday authored
      This CL implements the math/bits.OnesCount{8,16,32,64} functions
      as intrinsics on s390x using the 'population count' (popcnt)
      instruction. This instruction was released as the 'population-count'
      facility which uses the same facility bit (45) as the
      'distinct-operands' facility which is a pre-requisite for Go on
      s390x. We can therefore use it without a feature check.
      
      The s390x popcnt instruction treats a 64 bit register as a vector
      of 8 bytes, summing the number of ones in each byte individually.
      It then writes the results to the corresponding bytes in the
      output register. Therefore to implement OnesCount{16,32,64} we
      need to sum the individual byte counts using some extra
      instructions. To do this efficiently I've added some additional
      pseudo operations to the s390x SSA backend.
      
      Unlike other architectures the new instruction sequence is faster
      for OnesCount8, so that is implemented using the intrinsic.
      
      name         old time/op  new time/op  delta
      OnesCount    3.21ns ± 1%  1.35ns ± 0%  -58.00%  (p=0.000 n=20+20)
      OnesCount8   0.91ns ± 1%  0.81ns ± 0%  -11.43%  (p=0.000 n=20+20)
      OnesCount16  1.51ns ± 3%  1.21ns ± 0%  -19.71%  (p=0.000 n=20+17)
      OnesCount32  1.91ns ± 0%  1.12ns ± 1%  -41.60%  (p=0.000 n=19+20)
      OnesCount64  3.18ns ± 4%  1.35ns ± 0%  -57.52%  (p=0.000 n=20+20)
      
      Change-Id: Id54f0bd28b6db9a887ad12c0d72fcc168ef9c4e0
      Reviewed-on: https://go-review.googlesource.com/114675
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
      6f9b94ab
    • Iskander Sharipov's avatar
      cmd/compile/internal/gc: better handling of self-assignments in esc.go · ff468a43
      Iskander Sharipov authored
      Teach escape analysis to recognize these assignment patterns
      as not causing the src to leak:
      
      	val.x = val.y
      	val.x[i] = val.y[j]
      	val.x1.x2 = val.x1.y2
      	... etc
      
      Helps to avoid "leaking param" with assignments showed above.
      The implementation is based on somewhat similiar xs=xs[a:b]
      special case that is ignored by the escape analysis.
      
      We may figure out more generalized version of this,
      but this one looks like a safe step into that direction.
      
      Updates #14858
      
      Change-Id: I6fe5bfedec9c03bdc1d7624883324a523bd11fde
      Reviewed-on: https://go-review.googlesource.com/126395
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      ff468a43
    • Charles Kenney's avatar
      runtime/trace: fix syntax errors in NewTask doc example · b794ca64
      Charles Kenney authored
      Fixes #27406
      
      Change-Id: I9c6f5bac5b26558fa7628233c74a62faf676e811
      GitHub-Last-Rev: 29d19f719316b486224a15a50556465811985edf
      GitHub-Pull-Request: golang/go#27437
      Reviewed-on: https://go-review.googlesource.com/132775Reviewed-by: default avatarEmmanuel Odeke <emm.odeke@gmail.com>
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      b794ca64
    • Ankit Goyal's avatar
      strconv: add example for IsGraphic · 860484a1
      Ankit Goyal authored
      Change-Id: I58ba1f5d5c942d6a345c19df1bca80b63fb5abf5
      Reviewed-on: https://go-review.googlesource.com/132777Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      860484a1
  2. 02 Sep, 2018 3 commits
    • Phil Pearl's avatar
      strings: simplify Join using Builder · 317afdc3
      Phil Pearl authored
      The existing implementation has a bunch of special cases and
      suffers an additional allocation for longer arrays. We can replace
      this code with a simple implementation using Builder, improve
      performance and reduce complexity.
      
      name      old time/op    new time/op    delta
      Join/0-8    3.53ns ± 3%    3.72ns ± 2%   +5.56%  (p=0.000 n=10+10)
      Join/1-8    3.94ns ± 4%    3.40ns ± 4%  -13.57%  (p=0.000 n=10+10)
      Join/2-8    57.0ns ± 3%    51.0ns ± 1%  -10.48%  (p=0.000 n=10+9)
      Join/3-8    74.9ns ± 2%    65.5ns ± 4%  -12.60%  (p=0.000 n=10+10)
      Join/4-8     105ns ± 0%      79ns ± 4%  -24.63%  (p=0.000 n=6+10)
      Join/5-8     116ns ± 2%      91ns ± 4%  -21.95%  (p=0.000 n=10+10)
      Join/6-8     131ns ± 1%     104ns ± 1%  -20.66%  (p=0.000 n=10+10)
      Join/7-8     141ns ± 0%     114ns ± 4%  -18.82%  (p=0.000 n=9+10)
      
      name      old alloc/op   new alloc/op   delta
      Join/0-8     0.00B          0.00B          ~     (all equal)
      Join/1-8     0.00B          0.00B          ~     (all equal)
      Join/2-8     16.0B ± 0%     16.0B ± 0%     ~     (all equal)
      Join/3-8     32.0B ± 0%     32.0B ± 0%     ~     (all equal)
      Join/4-8     96.0B ± 0%     48.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/5-8     96.0B ± 0%     48.0B ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/6-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/7-8      128B ± 0%       64B ± 0%  -50.00%  (p=0.000 n=10+10)
      
      name      old allocs/op  new allocs/op  delta
      Join/0-8      0.00           0.00          ~     (all equal)
      Join/1-8      0.00           0.00          ~     (all equal)
      Join/2-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      Join/3-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
      Join/4-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/5-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/6-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      Join/7-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
      
      Change-Id: I866a50e809c398512cb87648c955eaa4bf4d8606
      Reviewed-on: https://go-review.googlesource.com/132895Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      317afdc3
    • Giovanni Bajo's avatar
      cmd/compile: add testcase for #24876 · dd5e9b32
      Giovanni Bajo authored
      This is still not fixed, the testcase reflects that there are still
      a few boundchecks. Let's fix the good alternative with an explicit
      test though.
      
      Updates #24876
      
      Change-Id: I4da35eb353e19052bd7b69ea6190a69ced8b9b3d
      Reviewed-on: https://go-review.googlesource.com/107355Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Giovanni Bajo <rasky@develer.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dd5e9b32
    • Giovanni Bajo's avatar
      test: relax whitespaces matching in codegen tests · f02cc88f
      Giovanni Bajo authored
      The codegen testsuite uses regexp to parse the syntax, but it doesn't
      have a way to tell line comments containing checks from line comments
      containing English sentences. This means that any syntax error (that
      is, non-matching regexp) is currently ignored and not reported.
      
      There were some tests in memcombine.go that had an extraneous space
      and were thus effectively disabled. It would be great if we could
      report it as a syntax error, but for now we just punt and swallow the
      spaces as a workaround, to avoid the same mistake again.
      
      Fixes #25452
      
      Change-Id: Ic7747a2278bc00adffd0c199ce40937acbbc9cf0
      Reviewed-on: https://go-review.googlesource.com/113835
      Run-TryBot: Giovanni Bajo <rasky@develer.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      f02cc88f
  3. 01 Sep, 2018 2 commits
  4. 31 Aug, 2018 11 commits
  5. 30 Aug, 2018 20 commits