Commit 1018a80f authored by Ben Shi's avatar Ben Shi Committed by Cherry Zhang

cmd/internal/obj/arm64: support more atomic instructions

LDADDALD(64-bit) and LDADDALW(32-bit) are already supported.
This CL adds supports of LDADDALH(16-bit) and LDADDALB(8-bit).

Change-Id: I4eac61adcec226d618dfce88618a2b98f5f1afe7
Reviewed-on: https://go-review.googlesource.com/132135
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
parent 55ef4460
......@@ -79,7 +79,7 @@ func IsARM64STLXR(op obj.As) bool {
arm64.ALDANDB, arm64.ALDANDH, arm64.ALDANDW, arm64.ALDANDD,
arm64.ALDEORB, arm64.ALDEORH, arm64.ALDEORW, arm64.ALDEORD,
arm64.ALDORB, arm64.ALDORH, arm64.ALDORW, arm64.ALDORD,
arm64.ALDADDALD, arm64.ALDADDALW:
arm64.ALDADDALD, arm64.ALDADDALW, arm64.ALDADDALH, arm64.ALDADDALB:
return true
}
return false
......
......@@ -622,7 +622,9 @@ again:
LDORB R5, (R6), R7 // c7302538
LDORB R5, (RSP), R7 // e7332538
LDADDALD R2, (R1), R3 // 2300e2f8
LDADDALW R5, (R4), R6 // 8600e5b8
LDADDALW R2, (R1), R3 // 2300e2b8
LDADDALH R2, (R1), R3 // 2300e278
LDADDALB R2, (R1), R3 // 2300e238
// RET
//
......
......@@ -594,8 +594,10 @@ const (
AHVC
AIC
AISB
ALDADDALD
ALDADDALB
ALDADDALH
ALDADDALW
ALDADDALD
ALDADDB
ALDADDH
ALDADDW
......
......@@ -95,8 +95,10 @@ var Anames = []string{
"HVC",
"IC",
"ISB",
"LDADDALD",
"LDADDALB",
"LDADDALH",
"LDADDALW",
"LDADDALD",
"LDADDB",
"LDADDH",
"LDADDW",
......
......@@ -2023,8 +2023,10 @@ func buildop(ctxt *obj.Link) {
oprangeset(ASWPALB, t)
oprangeset(ASWPALH, t)
oprangeset(ASWPALW, t)
oprangeset(ALDADDALD, t)
oprangeset(ALDADDALB, t)
oprangeset(ALDADDALH, t)
oprangeset(ALDADDALW, t)
oprangeset(ALDADDALD, t)
oprangeset(ALDADDB, t)
oprangeset(ALDADDH, t)
oprangeset(ALDADDW, t)
......@@ -3406,9 +3408,9 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
o1 = 3 << 30
case ASWPW, ASWPALW, ALDADDALW, ALDADDW, ALDANDW, ALDEORW, ALDORW: // 32-bit
o1 = 2 << 30
case ASWPH, ASWPALH, ALDADDH, ALDANDH, ALDEORH, ALDORH: // 16-bit
case ASWPH, ASWPALH, ALDADDALH, ALDADDH, ALDANDH, ALDEORH, ALDORH: // 16-bit
o1 = 1 << 30
case ASWPB, ASWPALB, ALDADDB, ALDANDB, ALDEORB, ALDORB: // 8-bit
case ASWPB, ASWPALB, ALDADDALB, ALDADDB, ALDANDB, ALDEORB, ALDORB: // 8-bit
o1 = 0 << 30
default:
c.ctxt.Diag("illegal instruction: %v\n", p)
......@@ -3416,7 +3418,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
switch p.As {
case ASWPD, ASWPW, ASWPH, ASWPB, ASWPALD, ASWPALW, ASWPALH, ASWPALB:
o1 |= 0x20 << 10
case ALDADDALD, ALDADDALW, ALDADDD, ALDADDW, ALDADDH, ALDADDB:
case ALDADDALD, ALDADDALW, ALDADDALH, ALDADDALB, ALDADDD, ALDADDW, ALDADDH, ALDADDB:
o1 |= 0x00 << 10
case ALDANDD, ALDANDW, ALDANDH, ALDANDB:
o1 |= 0x04 << 10
......@@ -3426,7 +3428,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
o1 |= 0x0c << 10
}
switch p.As {
case ALDADDALD, ALDADDALW, ASWPALD, ASWPALW, ASWPALH, ASWPALB:
case ALDADDALD, ALDADDALW, ALDADDALH, ALDADDALB, ASWPALD, ASWPALW, ASWPALH, ASWPALB:
o1 |= 3 << 22
}
o1 |= 0x1c1<<21 | uint32(rs&31)<<16 | uint32(rb&31)<<5 | uint32(rt&31)
......
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