mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
float2 fixes
This commit is contained in:
parent
7e28a71437
commit
b2078b10fe
2 changed files with 59 additions and 24 deletions
|
@ -11903,6 +11903,19 @@ BeMCInstForm BeMCContext::GetInstForm(BeMCInst* inst)
|
|||
|
||||
if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
||||
((arg0Type->IsVector()) || (arg1Type->IsVector())))
|
||||
{
|
||||
if ((arg0Type->mSize == 8) || (arg1Type->mSize == 8))
|
||||
{
|
||||
if (arg0.IsNativeReg())
|
||||
{
|
||||
return BeMCInstForm_XMM64_RM64;
|
||||
}
|
||||
else
|
||||
{
|
||||
return BeMCInstForm_FRM64_XMM64;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arg0.IsNativeReg())
|
||||
{
|
||||
|
@ -11913,6 +11926,7 @@ BeMCInstForm BeMCContext::GetInstForm(BeMCInst* inst)
|
|||
return BeMCInstForm_FRM128_XMM128;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((arg0Type != NULL) && (arg1Type != NULL) &&
|
||||
((arg0Type->IsFloat()) || (arg1Type->IsFloat())))
|
||||
{
|
||||
|
@ -12355,9 +12369,13 @@ bool BeMCContext::EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 op
|
|||
case BeMCInstForm_XMM64_IMM:
|
||||
case BeMCInstForm_XMM64_FRM64:
|
||||
case BeMCInstForm_XMM32_FRM64:
|
||||
Emit(0xF2); EmitREX(inst->mArg0, inst->mArg1, is64Bit);
|
||||
{
|
||||
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||
Emit(0xF2); EmitREX(arg0, arg1, is64Bit);
|
||||
Emit(0x0F); Emit(opcode);
|
||||
EmitModRM(inst->mArg0, inst->mArg1);
|
||||
EmitModRM(arg0, arg1);
|
||||
}
|
||||
return true;
|
||||
case BeMCInstForm_XMM128_RM128:
|
||||
{
|
||||
|
@ -12411,14 +12429,22 @@ bool BeMCContext::EmitStdXMMInst(BeMCInstForm instForm, BeMCInst* inst, uint8 op
|
|||
switch (instForm)
|
||||
{
|
||||
case BeMCInstForm_FRM32_XMM32:
|
||||
Emit(0xF3); EmitREX(inst->mArg1, inst->mArg0, is64Bit);
|
||||
{
|
||||
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||
Emit(0xF3); EmitREX(arg1, arg0, is64Bit);
|
||||
Emit(0x0F); Emit(opcode_dest_frm);
|
||||
EmitModRM(inst->mArg1, inst->mArg0);
|
||||
EmitModRM(arg1, arg0);
|
||||
}
|
||||
return true;
|
||||
case BeMCInstForm_FRM64_XMM64:
|
||||
Emit(0xF2); EmitREX(inst->mArg1, inst->mArg0, is64Bit);
|
||||
{
|
||||
auto arg0 = GetFixedOperand(inst->mArg0);
|
||||
auto arg1 = GetFixedOperand(inst->mArg1);
|
||||
Emit(0xF2); EmitREX(arg1, arg0, is64Bit);
|
||||
Emit(0x0F); Emit(opcode_dest_frm);
|
||||
EmitModRM(inst->mArg1, inst->mArg0);
|
||||
EmitModRM(arg1, arg0);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return EmitStdXMMInst(instForm, inst, opcode);
|
||||
|
@ -13846,16 +13872,6 @@ void BeMCContext::DoCodeEmission()
|
|||
EmitStdXMMInst(BeMCInstForm_XMM64_RM64, inst, 0x2A);
|
||||
}
|
||||
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_XMM32_FRM64:
|
||||
{
|
||||
|
@ -13930,6 +13946,24 @@ void BeMCContext::DoCodeEmission()
|
|||
}
|
||||
}
|
||||
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:
|
||||
{
|
||||
// MOVSS/MOVSD
|
||||
|
|
|
@ -918,6 +918,7 @@ enum BeMCInstForm
|
|||
BeMCInstForm_R32,
|
||||
BeMCInstForm_R64,
|
||||
|
||||
// FRM32 = float, FRM64 = double
|
||||
BeMCInstForm_XMM32_IMM,
|
||||
BeMCInstForm_XMM64_IMM,
|
||||
BeMCInstForm_XMM32_FRM32,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue