diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s index 1dc437830fa..c61d22051d1 100644 --- a/src/cmd/asm/internal/asm/testdata/arm64.s +++ b/src/cmd/asm/internal/asm/testdata/arm64.s @@ -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 diff --git a/src/cmd/internal/obj/arm64/a.out.go b/src/cmd/internal/obj/arm64/a.out.go index 44a912e33f3..af57dfefed7 100644 --- a/src/cmd/internal/obj/arm64/a.out.go +++ b/src/cmd/internal/obj/arm64/a.out.go @@ -897,6 +897,7 @@ const ( AVRBIT AVUSHR AVSHL + AVSRI ALAST AB = obj.AJMP ABL = obj.ACALL diff --git a/src/cmd/internal/obj/arm64/anames.go b/src/cmd/internal/obj/arm64/anames.go index 88300fc8cd6..aee409e94b8 100644 --- a/src/cmd/internal/obj/arm64/anames.go +++ b/src/cmd/internal/obj/arm64/anames.go @@ -399,5 +399,6 @@ var Anames = []string{ "VRBIT", "VUSHR", "VSHL", + "VSRI", "LAST", } diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go index 2b5ee28ddb3..1db61d1a45c 100644 --- a/src/cmd/internal/obj/arm64/asm7.go +++ b/src/cmd/internal/obj/arm64/asm7.go @@ -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)