mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
float2 fixes
This commit is contained in:
parent
7e28a71437
commit
b2078b10fe
2 changed files with 59 additions and 24 deletions
|
@ -11904,13 +11904,27 @@ BeMCInstForm BeMCContext::GetInstForm(BeMCInst* inst)
|
||||||
if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
||||||
((arg0Type->IsVector()) || (arg1Type->IsVector())))
|
((arg0Type->IsVector()) || (arg1Type->IsVector())))
|
||||||
{
|
{
|
||||||
if (arg0.IsNativeReg())
|
if ((arg0Type->mSize == 8) || (arg1Type->mSize == 8))
|
||||||
{
|
{
|
||||||
return BeMCInstForm_XMM128_RM128;
|
if (arg0.IsNativeReg())
|
||||||
|
{
|
||||||
|
return BeMCInstForm_XMM64_RM64;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BeMCInstForm_FRM64_XMM64;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return BeMCInstForm_FRM128_XMM128;
|
if (arg0.IsNativeReg())
|
||||||
|
{
|
||||||
|
return BeMCInstForm_XMM128_RM128;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BeMCInstForm_FRM128_XMM128;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
else if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
||||||
|
@ -12355,9 +12369,13 @@ bool BeMCContext::EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 op
|
||||||
case BeMCInstForm_XMM64_IMM:
|
case BeMCInstForm_XMM64_IMM:
|
||||||
case BeMCInstForm_XMM64_FRM64:
|
case BeMCInstForm_XMM64_FRM64:
|
||||||
case BeMCInstForm_XMM32_FRM64:
|
case BeMCInstForm_XMM32_FRM64:
|
||||||
Emit(0xF2); EmitREX(inst->mArg0, inst->mArg1, is64Bit);
|
{
|
||||||
Emit(0x0F); Emit(opcode);
|
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||||
EmitModRM(inst->mArg0, inst->mArg1);
|
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||||
|
Emit(0xF2); EmitREX(arg0, arg1, is64Bit);
|
||||||
|
Emit(0x0F); Emit(opcode);
|
||||||
|
EmitModRM(arg0, arg1);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case BeMCInstForm_XMM128_RM128:
|
case BeMCInstForm_XMM128_RM128:
|
||||||
{
|
{
|
||||||
|
@ -12411,14 +12429,22 @@ bool BeMCContext::EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 op
|
||||||
switch (instForm)
|
switch (instForm)
|
||||||
{
|
{
|
||||||
case BeMCInstForm_FRM32_XMM32:
|
case BeMCInstForm_FRM32_XMM32:
|
||||||
Emit(0xF3); EmitREX(inst->mArg1, inst->mArg0, is64Bit);
|
{
|
||||||
Emit(0x0F); Emit(opcode_dest_frm);
|
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||||
EmitModRM(inst->mArg1, inst->mArg0);
|
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||||
|
Emit(0xF3); EmitREX(arg1, arg0, is64Bit);
|
||||||
|
Emit(0x0F); Emit(opcode_dest_frm);
|
||||||
|
EmitModRM(arg1, arg0);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case BeMCInstForm_FRM64_XMM64:
|
case BeMCInstForm_FRM64_XMM64:
|
||||||
Emit(0xF2); EmitREX(inst->mArg1, inst->mArg0, is64Bit);
|
{
|
||||||
Emit(0x0F); Emit(opcode_dest_frm);
|
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||||
EmitModRM(inst->mArg1, inst->mArg0);
|
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||||
|
Emit(0xF2); EmitREX(arg1, arg0, is64Bit);
|
||||||
|
Emit(0x0F); Emit(opcode_dest_frm);
|
||||||
|
EmitModRM(arg1, arg0);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return EmitStdXMMInst(instForm, inst, opcode);
|
return EmitStdXMMInst(instForm, inst, opcode);
|
||||||
|
@ -13845,17 +13871,7 @@ void BeMCContext::DoCodeEmission()
|
||||||
// CVTSI2SD - use zero-extended 64-bit register
|
// CVTSI2SD - use zero-extended 64-bit register
|
||||||
EmitStdXMMInst(BeMCInstForm_XMM64_RM64, inst, 0x2A);
|
EmitStdXMMInst(BeMCInstForm_XMM64_RM64, inst, 0x2A);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BeMCInstForm_XMM64_RM64:
|
|
||||||
case BeMCInstForm_XMM32_RM64:
|
|
||||||
{
|
|
||||||
// uint64->xmm Not implemented
|
|
||||||
// We do a signed transform instead
|
|
||||||
|
|
||||||
// CVTSI2SS / CVTSI2SD
|
|
||||||
EmitStdXMMInst(instForm, inst, 0x2A);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BeMCInstForm_XMM64_FRM32:
|
case BeMCInstForm_XMM64_FRM32:
|
||||||
case BeMCInstForm_XMM32_FRM64:
|
case BeMCInstForm_XMM32_FRM64:
|
||||||
{
|
{
|
||||||
|
@ -13930,6 +13946,24 @@ void BeMCContext::DoCodeEmission()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BeMCInstForm_XMM64_RM64:
|
||||||
|
case BeMCInstForm_XMM32_RM64:
|
||||||
|
{
|
||||||
|
if ((arg0Type->IsVector()) && (arg1Type->IsVector()))
|
||||||
|
{
|
||||||
|
// Fall through
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// uint64->xmm Not implemented
|
||||||
|
// We do a signed transform instead
|
||||||
|
|
||||||
|
// CVTSI2SS / CVTSI2SD
|
||||||
|
EmitStdXMMInst(instForm, inst, 0x2A);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fall through
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// MOVSS/MOVSD
|
// MOVSS/MOVSD
|
||||||
|
|
|
@ -918,9 +918,10 @@ enum BeMCInstForm
|
||||||
BeMCInstForm_R32,
|
BeMCInstForm_R32,
|
||||||
BeMCInstForm_R64,
|
BeMCInstForm_R64,
|
||||||
|
|
||||||
|
// FRM32 = float, FRM64 = double
|
||||||
BeMCInstForm_XMM32_IMM,
|
BeMCInstForm_XMM32_IMM,
|
||||||
BeMCInstForm_XMM64_IMM,
|
BeMCInstForm_XMM64_IMM,
|
||||||
BeMCInstForm_XMM32_FRM32,
|
BeMCInstForm_XMM32_FRM32,
|
||||||
BeMCInstForm_XMM64_FRM32,
|
BeMCInstForm_XMM64_FRM32,
|
||||||
BeMCInstForm_XMM32_FRM64,
|
BeMCInstForm_XMM32_FRM64,
|
||||||
BeMCInstForm_XMM64_FRM64,
|
BeMCInstForm_XMM64_FRM64,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue