Commit bf6530a2 authored by Balaram Makam's avatar Balaram Makam Committed by Cherry Zhang

cmd/asm: add VSRI instruction on ARM64

This change provides VSRI instruction for ChaCha20Poly1305 implementation.

Change-Id: Ifee727b6f3982b629b44a67cac5bbe87ca59027b
Reviewed-on: https://go-review.googlesource.com/109342
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
parent b4ac0297
......@@ -100,6 +100,13 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8
VSHL $8, V1.H8, V2.H8 // 2254184f
VSHL $2, V1.B8, V2.B8 // 22540a0f
VSHL $2, V1.B16, V2.B16 // 22540a4f
VSRI $56, V1.D2, V2.D2 // 2244486f
VSRI $24, V1.S4, V2.S4 // 2244286f
VSRI $24, V1.S2, V2.S2 // 2244282f
VSRI $8, V1.H4, V2.H4 // 2244182f
VSRI $8, V1.H8, V2.H8 // 2244186f
VSRI $2, V1.B8, V2.B8 // 22440e2f
VSRI $2, V1.B16, V2.B16 // 22440e6f
MOVD (R2)(R6.SXTW), R4 // 44c866f8
MOVD (R3)(R6), R5 // MOVD (R3)(R6*1), R5 // 656866f8
MOVD (R2)(R6), R4 // MOVD (R2)(R6*1), R4 // 446866f8
......
......@@ -897,6 +897,7 @@ const (
AVRBIT
AVUSHR
AVSHL
AVSRI
ALAST
AB = obj.AJMP
ABL = obj.ACALL
......
......@@ -399,5 +399,6 @@ var Anames = []string{
"VRBIT",
"VUSHR",
"VSHL",
"VSRI",
"LAST",
}
......@@ -2386,6 +2386,7 @@ func buildop(ctxt *obj.Link) {
case AVUSHR:
oprangeset(AVSHL, t)
oprangeset(AVSRI, t)
case AVREV32:
oprangeset(AVRBIT, t)
......@@ -4319,18 +4320,19 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
imm := 0
if p.As == AVUSHR {
switch p.As {
case AVUSHR, AVSRI:
imm = esize*2 - shift
if imm < esize || imm > imax {
c.ctxt.Diag("shift out of range: %v", p)
}
}
if p.As == AVSHL {
case AVSHL:
imm = esize + shift
if imm > imax {
c.ctxt.Diag("shift out of range: %v", p)
}
default:
c.ctxt.Diag("invalid instruction %v\n", p)
}
o1 = c.opirr(p, p.As)
......@@ -5310,6 +5312,9 @@ func (c *ctxt7) opirr(p *obj.Prog, a obj.As) uint32 {
case AVSHL:
return 0x1E<<23 | 21<<10
case AVSRI:
return 0x5E<<23 | 17<<10
}
c.ctxt.Diag("%v: bad irr %v", p, a)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment