• Martin Möhrmann's avatar
    cmd/compile: add intrinsics for runtime/internal/math on 386 and amd64 · a1ca4893
    Martin Möhrmann authored
    Add generic, 386 and amd64 specific ops and SSA rules for multiplication
    with overflow and branching based on overflow flags. Use these to intrinsify
    runtime/internal/math.MulUinptr.
    
    On amd64
      mul, overflow := math.MulUintptr(a, b)
      if overflow {
    is lowered to two instructions:
      MULQ SI
      JO 0x10ee35c
    
    No codegen tests as codegen can not currently test unexported internal runtime
    functions.
    
    amd64:
    name              old time/op  new time/op  delta
    MulUintptr/small  1.16ns ± 5%  0.88ns ± 6%  -24.36%  (p=0.000 n=19+20)
    MulUintptr/large  10.7ns ± 1%   1.1ns ± 1%  -89.28%  (p=0.000 n=17+19)
    
    Change-Id: If60739a86f820e5044d677276c21df90d3c7a86a
    Reviewed-on: https://go-review.googlesource.com/c/141820
    Run-TryBot: Martin Möhrmann <moehrmann@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    a1ca4893
Name
Last commit
Last update
..
math.go Loading commit data...
math_test.go Loading commit data...