2018-02-08 19:26:20 -08:00
|
|
|
using ChocolArm64.Instruction;
|
|
|
|
using ChocolArm64.State;
|
|
|
|
|
|
|
|
namespace ChocolArm64.Decoder
|
|
|
|
{
|
2018-02-14 20:32:25 -08:00
|
|
|
class AOpCodeSimdMemSs : AOpCodeMemReg, IAOpCodeSimd
|
2018-02-08 19:26:20 -08:00
|
|
|
{
|
|
|
|
public int SElems { get; private set; }
|
|
|
|
public int Index { get; private set; }
|
|
|
|
public bool Replicate { get; private set; }
|
|
|
|
public bool WBack { get; private set; }
|
|
|
|
|
2018-02-10 09:20:46 -08:00
|
|
|
public AOpCodeSimdMemSs(AInst Inst, long Position, int OpCode) : base(Inst, Position, OpCode)
|
2018-02-08 19:26:20 -08:00
|
|
|
{
|
|
|
|
int Size = (OpCode >> 10) & 3;
|
|
|
|
int S = (OpCode >> 12) & 1;
|
|
|
|
int SElems = (OpCode >> 12) & 2;
|
|
|
|
int Scale = (OpCode >> 14) & 3;
|
|
|
|
int L = (OpCode >> 22) & 1;
|
|
|
|
int Q = (OpCode >> 30) & 1;
|
2018-03-30 14:06:02 -07:00
|
|
|
|
2018-02-08 19:26:20 -08:00
|
|
|
SElems |= (OpCode >> 21) & 1;
|
|
|
|
|
|
|
|
SElems++;
|
|
|
|
|
|
|
|
int Index = (Q << 3) | (S << 2) | Size;
|
|
|
|
|
|
|
|
switch (Scale)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
2018-02-17 20:57:33 -08:00
|
|
|
if ((Size & 1) != 0)
|
2018-02-08 19:26:20 -08:00
|
|
|
{
|
|
|
|
Inst = AInst.Undefined;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Index >>= 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
{
|
2018-02-17 20:57:33 -08:00
|
|
|
if ((Size & 2) != 0 ||
|
|
|
|
((Size & 1) != 0 && S != 0))
|
2018-02-08 19:26:20 -08:00
|
|
|
{
|
|
|
|
Inst = AInst.Undefined;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-17 20:57:33 -08:00
|
|
|
if ((Size & 1) != 0)
|
2018-02-08 19:26:20 -08:00
|
|
|
{
|
|
|
|
Index >>= 3;
|
2018-02-17 20:57:33 -08:00
|
|
|
|
|
|
|
Scale = 3;
|
2018-02-08 19:26:20 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Index >>= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
if (L == 0 || S != 0)
|
|
|
|
{
|
|
|
|
Inst = AInst.Undefined;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Scale = Size;
|
|
|
|
|
|
|
|
Replicate = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 08:59:23 -07:00
|
|
|
this.Index = Index;
|
2018-02-08 19:26:20 -08:00
|
|
|
this.SElems = SElems;
|
|
|
|
this.Size = Scale;
|
|
|
|
|
2018-02-17 13:06:11 -08:00
|
|
|
Extend64 = false;
|
|
|
|
|
2018-03-30 14:06:02 -07:00
|
|
|
WBack = ((OpCode >> 23) & 1) != 0;
|
2018-02-08 19:26:20 -08:00
|
|
|
|
|
|
|
RegisterSize = Q != 0
|
|
|
|
? ARegisterSize.SIMD128
|
|
|
|
: ARegisterSize.SIMD64;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|