Implement CLZ, fix BFI and BFC

Now stops on SIMD initialization.
This commit is contained in:
riperiperi 2019-12-25 21:16:56 +00:00 committed by Thog
parent 36787d06dd
commit b1ba16a4d4
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
3 changed files with 15 additions and 3 deletions

View file

@ -22,7 +22,7 @@ namespace ARMeilleure.Decoders
Rn = (opCode >> 0) & 0xf;
Msb = ((opCode >> 16) & 31);
Lsb = ((opCode >> 17) & 31);
Lsb = Msb - ((opCode >> 10) & 31);
}
}
}

View file

@ -616,6 +616,7 @@ namespace ARMeilleure.Decoders
SetA32("<<<<000100101111111111110011xxxx", InstName.Blx, InstEmit32.Blxr, typeof(OpCode32BReg));
SetA32("<<<<000100101111111111110001xxxx", InstName.Bx, InstEmit32.Bx, typeof(OpCode32BReg));
SetT32("xxxxxxxxxxxxxxxx010001110xxxx000", InstName.Bx, InstEmit32.Bx, typeof(OpCodeT16BReg));
SetA32("<<<<000101101111xxxx11110001xxxx", InstName.Clz, InstEmit32.Clz, typeof(OpCode32AluReg));
SetA32("<<<<00110101xxxx0000xxxxxxxxxxxx", InstName.Cmp, InstEmit32.Cmp, typeof(OpCode32AluImm));
SetA32("<<<<00010101xxxx0000xxxxxxx0xxxx", InstName.Cmp, InstEmit32.Cmp, typeof(OpCode32AluRsImm));
//RsReg missing

View file

@ -31,6 +31,16 @@ namespace ARMeilleure.Instructions
EmitAluStore(context, res);
}
public static void Clz(ArmEmitterContext context)
{
IOpCode32AluReg op = (IOpCode32AluReg)context.CurrOp;
Operand m = GetAluM(context, setCarry: false);
Operand res = context.CountLeadingZeros(m);
EmitAluStore(context, res);
}
public static void Cmp(ArmEmitterContext context)
{
IOpCode32Alu op = (IOpCode32Alu)context.CurrOp;
@ -282,7 +292,7 @@ namespace ARMeilleure.Instructions
OpCode32AluBf op = (OpCode32AluBf)context.CurrOp;
Operand d = GetIntOrZR(context, op.Rd);
Operand res = context.BitwiseAnd(d, Const(~op.SourceMask));
Operand res = context.BitwiseAnd(d, Const(~op.DestMask));
SetIntA32(context, op.Rd, res);
}
@ -294,7 +304,8 @@ namespace ARMeilleure.Instructions
Operand n = GetIntOrZR(context, op.Rn);
Operand d = GetIntOrZR(context, op.Rd);
Operand part = context.BitwiseAnd(n, Const(op.SourceMask));
Operand res = context.BitwiseAnd(d, Const(~op.SourceMask));
if (op.Lsb != 0) part = context.ShiftLeft(part, Const(op.Lsb));
Operand res = context.BitwiseAnd(d, Const(~op.DestMask));
res = context.BitwiseOr(res, part);
SetIntA32(context, op.Rd, res);