golang/go

math/big: optimize amd64 asm shlVU and shrVU for shift==0 case

Open

#31,097 opened on Mar 28, 2019

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsFixPerformancehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

When shift == 0, shlVU and shrVU reduce to a memcopy. When z.ptr == x.ptr, it further reduces to a no-op. The pure Go implementation has these optimizations, as of https://go-review.googlesource.com/c/go/+/164967. The arm64 implementation has one of them (see https://github.com/golang/go/issues/31084#issuecomment-477406354). We should add both to the amd64 implementation.

cc @griesemer

Contributor guide