# RV64A  Standard Extension (in addition to RV32A)

# amoadd.d d,t,0(s) 0000302f fe00707f QWORD|DREF (64, 8) 
:amoadd.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x0 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	tmp = tmp + tmprs2;
	*[ram]:8 tmprs1 = tmp;
}


# amoand.d d,t,0(s) 6000302f fe00707f QWORD|DREF (64, 8) 
:amoand.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0xc & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	tmp = tmp & tmprs2;
	*[ram]:8 tmprs1 = tmp;
}


# amomax.d d,t,0(s) a000302f fe00707f QWORD|DREF (64, 8) 
:amomax.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x14 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	if (tmprs2 s<= tmp) goto inst_next;
	*[ram]:8 tmprs1 = tmprs2;
}


# amomaxu.d d,t,0(s) e000302f fe00707f QWORD|DREF (64, 8) 
:amomaxu.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x1c & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	if (tmprs2 <= tmp) goto inst_next;
	*[ram]:8 tmprs1 = tmprs2;
}


# amomin.d d,t,0(s) 8000302f fe00707f QWORD|DREF (64, 8) 
:amomin.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x10 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	if (tmprs2 s>= tmp) goto inst_next;
	*[ram]:8 tmprs1 = tmprs2;
}


# amominu.d d,t,0(s) c000302f fe00707f QWORD|DREF (64, 8) 
:amominu.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x18 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	if (tmprs2 >= tmp) goto inst_next;
	*[ram]:8 tmprs1 = tmprs2;
}


# amoor.d d,t,0(s) 4000302f fe00707f QWORD|DREF (64, 8) 
:amoor.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x8 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	tmp = tmp | tmprs2;
	*[ram]:8 tmprs1 = tmp;
}


# amoswap.d d,t,0(s) 0800302f fe00707f QWORD|DREF (64, 8) 
:amoswap.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x1 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	*[ram]:8 tmprs1 = tmprs2;
}


# amoxor.d d,t,0(s) 2000302f fe00707f QWORD|DREF (64, 8) 
:amoxor.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x4 & aqrl
{
	local tmprs1 = rs1;
	local tmprs2 = rs2L;
	local tmp:8 = *[ram]:8 tmprs1;
	rdL = tmp;
	tmp = tmp ^ tmprs2;
	*[ram]:8 tmprs1 = tmp;
}


# lr.d d,0(s) 1000302f fff0707f QWORD|DREF (64, 8) 
:lr.d^aqrl rdL,(rs1) is rs1 & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x2 & op2024=0x0 & aqrl
{
	RESERVE_ADDRESS = rs1;
	RESERVE = 1;
	RESERVE_LENGTH = 8;
	rdL = *[ram]:8 rs1;
}


# sc.d d,t,0(s) 1800302f fe00707f QWORD|DREF (64, 8) 
:sc.d^aqrl rdL,rs2L,(rs1) is rs1 & rs2L & rdL & op0001=0x3 & op0204=0x3 & op0506=0x1 & funct3=0x3 & op2731=0x3 & aqrl
{
	local tmprs2 = rs2L;
	local tmprs1 = rs1;
	rdL = 1;
	if ((RESERVE == 0)||(RESERVE_ADDRESS != tmprs1)||(RESERVE_LENGTH != 8)) goto inst_next;
	*[ram]:8 tmprs1 = tmprs2;
	rdL = 0;
	RESERVE_ADDRESS = 0;
	RESERVE = 0;
	RESERVE_LENGTH = 0;
}
