MOVVP 4(R5), R4 // a4040026
MOVVP (R5), R4 // a4000026
+ // ADDU16I.D instruction
+ ADDV16 $(-32768<<16), R4, R5 // ADDV16 $-2147483648, R4, R5 // 85000012
+ ADDV16 $(0<<16), R4, R5 // ADDV16 $0, R4, R5 // 85000010
+ ADDV16 $(8<<16), R4, R5 // ADDV16 $524288, R4, R5 // 85200010
+ ADDV16 $(32767<<16), R4, R5 // ADDV16 $2147418112, R4, R5 // 85fcff11
+ ADDV16 $(16<<16), R4 // ADDV16 $1048576, R4 // 84400010
+
// Loong64 atomic memory access instructions
AMSWAPB R14, (R13), R12 // ac395c38
AMSWAPH R14, (R13), R12 // acb95c38
{AADDV, C_U12CON, C_REG, C_NONE, C_REG, C_NONE, 10, 8, 0, 0},
{AADDV, C_U12CON, C_NONE, C_NONE, C_REG, C_NONE, 10, 8, 0, 0},
+ {AADDV16, C_32CON, C_REG, C_NONE, C_REG, C_NONE, 4, 4, 0, 0},
+ {AADDV16, C_32CON, C_NONE, C_NONE, C_REG, C_NONE, 4, 4, 0, 0},
+
{AAND, C_UU12CON, C_REG, C_NONE, C_REG, C_NONE, 4, 4, 0, 0},
{AAND, C_UU12CON, C_NONE, C_NONE, C_REG, C_NONE, 4, 4, 0, 0},
{AAND, C_S12CON, C_REG, C_NONE, C_REG, C_NONE, 10, 8, 0, 0},
APRELD,
APRELDX,
AFSEL,
+ AADDV16,
obj.ANOP,
obj.ATEXT,
obj.AFUNCDATA,
if r == 0 {
r = int(p.To.Reg)
}
- o1 = OP_12IRR(c.opirr(p.As), uint32(v), uint32(r), uint32(p.To.Reg))
+ if p.As == AADDV16 {
+ if v&65535 != 0 {
+ c.ctxt.Diag("%v: the constant must be a multiple of 65536.\n", p)
+ }
+ o1 = OP_16IRR(c.opirr(p.As), uint32(v>>16), uint32(r), uint32(p.To.Reg))
+ } else {
+ o1 = OP_12IRR(c.opirr(p.As), uint32(v), uint32(r), uint32(p.To.Reg))
+ }
case 5: // syscall
v := c.regoff(&p.From)
return 0x00b << 22
case AADDVU:
return 0x00b << 22
+ case AADDV16:
+ return 0x4 << 26
case AJMP:
return 0x14 << 26
Go assembly | platform assembly
MOVWP 8(R4), R5 | ldptr.w r5, r4, $2
+6. Note of special add instrction
+ Mapping between Go and platform assembly:
+ Go assembly | platform assembly
+ ADDV16 si16<<16, Rj, Rd | addu16i.d rd, rj, si16
+
+ note: si16 is a 16-bit immediate number, and si16<<16 is the actual operand.
+
+ The addu16i.d instruction logically left-shifts the 16-bit immediate number si16 by 16 bits, then
+ sign-extends it. The resulting data is added to the [63:0] bits of data in the general-purpose register
+ rj, and the sum is written into the general-purpose register rd.
+ The addu16i.d instruction is used in conjunction with the ldptr.w/d and stptr.w/d instructions to
+ accelerate access based on the GOT table in position-independent code.
*/
package loong64