]> Cypherpunks repositories - gostls13.git/commit
crypto/md5: Avo port of md5block_amd64.s
authorGarrett Bodley <garrett.bodley@gmail.com>
Sun, 21 Jul 2024 05:00:56 +0000 (01:00 -0400)
committerRoland Shoemaker <roland@golang.org>
Wed, 4 Sep 2024 20:36:18 +0000 (20:36 +0000)
commit1e0cba8ee19206a6f76acb18b1f2de1c9375de05
treeb9026b5d07245b40efb819f6bd14169cdd227dfa
parent3b78ca06262988992ac3427a0acb4e1c7ac482ac
crypto/md5: Avo port of md5block_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

Metadata not found in the reference assembly file has been added to one
parameter symbol, resulting in a single line diff.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/md5/md5block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

3c3
< MOVQ p+8(FP), SI
---
> MOVQ p_base+8(FP), SI

Change-Id: Ifecc84fd0f5a39a88350e6eaffb45ed3fdacf2fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/599935
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/cmd/compile/internal/types2/stdlib_test.go
src/crypto/md5/_asm/go.mod [new file with mode: 0644]
src/crypto/md5/_asm/go.sum [new file with mode: 0644]
src/crypto/md5/_asm/md5block_amd64_asm.go [new file with mode: 0644]
src/crypto/md5/md5block_amd64.s
src/go/types/stdlib_test.go