Skip to content

Commit 2783249

Browse files
Xiangdong Jicherrymui
Xiangdong Ji
authored andcommitted
cmd/asm: add asimd instruction 'rev16' on arm64
Add support to the asimd instruction rev16 which reverses elements in 16-bit halfwords. syntax: VREV16 <Vn>.<T>, <Vd>.<T> <T> should be either B8 or B16. Change-Id: I7a7b8e772589c51ca9eb6dca98bab1aac863c6c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/213738 Reviewed-by: Cherry Zhang <[email protected]> Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent fe70838 commit 2783249

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

src/cmd/asm/internal/asm/testdata/arm64enc.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
712712
VPMULL2 V2.B16, V1.B16, V4.H8 // 24e0224e
713713
VRBIT V10.B16, V21.B16 // 5559606e
714714
VREV32 V2.H8, V1.H8 // 4108606e
715+
VREV16 V2.B8, V1.B8 // 4118200e
716+
VREV16 V5.B16, V16.B16 // b018204e
715717
SCVTFWS R6, F17 // d100221e
716718
SCVTFWD R3, F15 // 6f00621e
717719
SCVTFS R20, F25 // 9902229e

src/cmd/asm/internal/asm/testdata/arm64error.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ TEXT errors(SB),$0
106106
VST1.P [V1.B16], (R8)(R9<<1) // ERROR "invalid extended register"
107107
VREV64 V1.H4, V2.H8 // ERROR "invalid arrangement"
108108
VREV64 V1.D1, V2.D1 // ERROR "invalid arrangement"
109+
VREV16 V1.D1, V2.D1 // ERROR "invalid arrangement"
110+
VREV16 V1.B8, V2.B16 // ERROR "invalid arrangement"
111+
VREV16 V1.H4, V2.H4 // ERROR "invalid arrangement"
109112
FLDPD (R0), (R1, R2) // ERROR "invalid register pair"
110113
FLDPD (R1), (F2, F2) // ERROR "constrained unpredictable behavior"
111114
FLDPS (R2), (F3, F3) // ERROR "constrained unpredictable behavior"

src/cmd/internal/obj/arm64/a.out.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ const (
962962
AVLD3R
963963
AVLD4R
964964
AVORR
965+
AVREV16
965966
AVREV32
966967
AVREV64
967968
AVST1

src/cmd/internal/obj/arm64/anames.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/internal/obj/arm64/asm7.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,6 +2719,7 @@ func buildop(ctxt *obj.Link) {
27192719
case AVREV32:
27202720
oprangeset(AVRBIT, t)
27212721
oprangeset(AVREV64, t)
2722+
oprangeset(AVREV16, t)
27222723

27232724
case AVZIP1:
27242725
oprangeset(AVZIP2, t)
@@ -4471,6 +4472,10 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
44714472
c.ctxt.Diag("invalid arrangement: %v", p)
44724473
}
44734474

4475+
if p.As == AVREV16 && af != ARNG_8B && af != ARNG_16B {
4476+
c.ctxt.Diag("invalid arrangement: %v", p)
4477+
}
4478+
44744479
if p.As == AVMOV {
44754480
o1 |= uint32(rf&31) << 16
44764481
}
@@ -5594,6 +5599,9 @@ func (c *ctxt7) oprrr(p *obj.Prog, a obj.As) uint32 {
55945599
case AVORR:
55955600
return 7<<25 | 5<<21 | 7<<10
55965601

5602+
case AVREV16:
5603+
return 3<<26 | 2<<24 | 1<<21 | 3<<11
5604+
55975605
case AVREV32:
55985606
return 11<<26 | 2<<24 | 1<<21 | 1<<11
55995607

0 commit comments

Comments
 (0)