The curve25519 assembly routines do very non-Go-ABI SP adjustments. These would thoroughly confuse traceback if it were to fire in one of these functions (say, because of a signal). Plus, we're about to make the assembler track SP balance through more operations (which it should have done all along), and the SP alignment performed by these functions is going to make the assembler think the SP is out of balance. Fix this by eliminating the SP alignment prologue from all four assembly functions. They don't do any operations that care about SP alignment, so this is simply unnecessary. square and freeze don't even use the stack for anything other that saving what were presumably "callee save" registers in some other ABI, so for these we can eliminate the stack frame entirely. Change-Id: If9dbb2fb6800d9cd733daa91f483eb2937e95f0f Reviewed-on: https://go-review.googlesource.com/31579 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Adam Langley <agl@golang.org>
131 lines
2.0 KiB
ArmAsm
131 lines
2.0 KiB
ArmAsm
// Copyright 2012 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// This code was translated into a form compatible with 6a from the public
|
|
// domain sources in SUPERCOP: http://bench.cr.yp.to/supercop.html
|
|
|
|
// +build amd64,!gccgo,!appengine
|
|
|
|
// func square(out, in *[5]uint64)
|
|
TEXT ·square(SB),7,$0-16
|
|
MOVQ out+0(FP), DI
|
|
MOVQ in+8(FP), SI
|
|
|
|
MOVQ 0(SI),AX
|
|
MULQ 0(SI)
|
|
MOVQ AX,CX
|
|
MOVQ DX,R8
|
|
MOVQ 0(SI),AX
|
|
SHLQ $1,AX
|
|
MULQ 8(SI)
|
|
MOVQ AX,R9
|
|
MOVQ DX,R10
|
|
MOVQ 0(SI),AX
|
|
SHLQ $1,AX
|
|
MULQ 16(SI)
|
|
MOVQ AX,R11
|
|
MOVQ DX,R12
|
|
MOVQ 0(SI),AX
|
|
SHLQ $1,AX
|
|
MULQ 24(SI)
|
|
MOVQ AX,R13
|
|
MOVQ DX,R14
|
|
MOVQ 0(SI),AX
|
|
SHLQ $1,AX
|
|
MULQ 32(SI)
|
|
MO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