MOVV FCC0, R4 // 04dc1401
MOVV R4, FCC0 // 80d81401
+ // LDPTR.{W/D} and STPTR.{W/D} instructions
+ MOVWP R5, -32768(R4) // 85008025
+ MOVWP R5, 32764(R4) // 85fc7f25
+ MOVWP R5, 32(R4) // 85200025
+ MOVWP R5, 4(R4) // 85040025
+ MOVWP R5, (R4) // 85000025
+ MOVVP R5, -32768(R4) // 85008027
+ MOVVP R5, 32764(R4) // 85fc7f27
+ MOVVP R5, 32(R4) // 85200027
+ MOVVP R5, 4(R4) // 85040027
+ MOVVP R5, (R4) // 85000027
+ MOVWP -32768(R5), R4 // a4008024
+ MOVWP 32764(R5), R4 // a4fc7f24
+ MOVWP 32(R5), R4 // a4200024
+ MOVWP 4(R5), R4 // a4040024
+ MOVWP (R5), R4 // a4000024
+ MOVVP -32768(R5), R4 // a4008026
+ MOVVP 32764(R5), R4 // a4fc7f26
+ MOVVP 32(R5), R4 // a4200026
+ MOVVP 4(R5), R4 // a4040026
+ MOVVP (R5), R4 // a4000026
+
// Loong64 atomic memory access instructions
AMSWAPB R14, (R13), R12 // ac395c38
AMSWAPH R14, (R13), R12 // acb95c38
{AMOVV, C_REG, C_NONE, C_NONE, C_TLS_LE, C_NONE, 53, 16, 0, 0},
{AMOVB, C_REG, C_NONE, C_NONE, C_TLS_LE, C_NONE, 53, 16, 0, 0},
{AMOVBU, C_REG, C_NONE, C_NONE, C_TLS_LE, C_NONE, 53, 16, 0, 0},
+ {AMOVWP, C_REG, C_NONE, C_NONE, C_SOREG, C_NONE, 73, 4, 0, 0},
+ {AMOVWP, C_REG, C_NONE, C_NONE, C_LOREG, C_NONE, 73, 4, 0, 0},
{AMOVW, C_LAUTO, C_NONE, C_NONE, C_REG, C_NONE, 36, 12, REGSP, 0},
{AMOVWU, C_LAUTO, C_NONE, C_NONE, C_REG, C_NONE, 36, 12, REGSP, 0},
{AMOVV, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0},
{AMOVB, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0},
{AMOVBU, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0},
+ {AMOVWP, C_SOREG, C_NONE, C_NONE, C_REG, C_NONE, 74, 4, 0, 0},
+ {AMOVWP, C_LOREG, C_NONE, C_NONE, C_REG, C_NONE, 74, 4, 0, 0},
{AMOVW, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0},
{AMOVV, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0},
case AMOVBU:
opset(AMOVHU, r0)
+ case AMOVWP:
+ opset(AMOVVP, r0)
+
case AMUL:
opset(AMULU, r0)
opset(AMULH, r0)
return op | (i&0xFFFF)<<10 | (r2&0x1F)<<5 | (r3&0x1F)<<0
}
+func OP_14IRR(op uint32, i uint32, r2 uint32, r3 uint32) uint32 {
+ return op | (i&0x3FFF)<<10 | (r2&0x1F)<<5 | (r3&0x1F)<<0
+}
+
func OP_12IR_5I(op uint32, i1 uint32, r2 uint32, i2 uint32) uint32 {
return op | (i1&0xFFF)<<10 | (r2&0x1F)<<5 | (i2&0x1F)<<0
}
o3 = OP_12IRR(c.opirr(ALU52ID), uint32(v>>52), uint32(REGTMP), uint32(REGTMP))
}
o4 = OP_RRR(c.oprrr(p.As), uint32(REGTMP), uint32(r), uint32(p.To.Reg))
+
+ case 73:
+ v := c.regoff(&p.To)
+ if v&3 != 0 {
+ c.ctxt.Diag("%v: offset must be a multiple of 4.\n", p)
+ }
+ o1 = OP_14IRR(c.opirr(p.As), uint32(v>>2), uint32(p.To.Reg), uint32(p.From.Reg))
+
+ case 74:
+ v := c.regoff(&p.From)
+ if v&3 != 0 {
+ c.ctxt.Diag("%v: offset must be a multiple of 4.\n", p)
+ }
+ o1 = OP_14IRR(c.opirr(-p.As), uint32(v>>2), uint32(p.From.Reg), uint32(p.To.Reg))
}
out[0] = o1
return 0x0ad << 22
case AMOVD:
return 0x0af << 22
+ case AMOVVP:
+ return 0x27 << 24 // stptr.d
+ case AMOVWP:
+ return 0x25 << 24 // stptr.w
case -AMOVB:
return 0x0a0 << 22
case -AMOVBU:
return 0x0ac << 22
case -AMOVD:
return 0x0ae << 22
+ case -AMOVVP:
+ return 0x26 << 24 // ldptr.d
+ case -AMOVWP:
+ return 0x24 << 24 // ldptr.w
case -AVMOVQ:
return 0x0b0 << 22 // vld
case -AXVMOVQ:
Go assembly | instruction Encoding
ALSLV $4, r4, r5, R6 | 002d9486
+
+5. Note of special memory access instructions
+ Instruction format:
+ MOVWP offset(Rj), Rd
+ MOVVP offset(Rj), Rd
+ MOVWP Rd, offset(Rj)
+ MOVVP Rd, offset(Rj)
+
+ Mapping between Go and platform assembly:
+ Go assembly | platform assembly
+ MOVWP offset(Rj), Rd | ldptr.w rd, rj, si14
+ MOVVP offset(Rj), Rd | ldptr.d rd, rj, si14
+ MOVWP Rd, offset(Rj) | stptr.w rd, rj, si14
+ MOVVP Rd, offset(Rj) | stptr.d rd, rj, si14
+
+ note: In Go assembly, for ease of understanding, offset is a 16-bit immediate number representing
+ the actual address offset, but in platform assembly, it need a 14-bit immediate number.
+ si14 = offset>>2
+
+ The addressing calculation for the above instruction involves logically left-shifting the 14-bit
+ immediate number si14 by 2 bits, then sign-extending it, and finally adding it to the value in the
+ general-purpose register rj to obtain the sum.
+
+ For example:
+
+ Go assembly | platform assembly
+ MOVWP 8(R4), R5 | ldptr.w r5, r4, $2
+
*/
package loong64