Merge pull request #705 from unknownbrackets/jit-vfpu

Small VFPU prefix fixes
This commit is contained in:
Henrik Rydgård 2013-02-16 00:15:24 -08:00
commit 61e13e4475
2 changed files with 14 additions and 1 deletions

View File

@ -110,6 +110,11 @@ void ApplyPrefixST(float *v, u32 data, VectorSize size)
if (!constants)
{
// Prefix may say "z, z, z, z" but if this is a pair, we force to x.
// TODO: But some ops seem to use const 0 instead?
if (regnum >= n)
regnum = 0;
v[i] = origV[regnum];
if (abs)
v[i] = fabs(v[i]);
@ -150,7 +155,8 @@ void ApplyPrefixD(float *v, VectorSize size, bool onlyWriteMask = false)
if (sat == 1)
{
if (v[i] > 1.0f) v[i] = 1.0f;
if (v[i] < 0.0f) v[i] = 0.0f;
// This includes -0.0f -> +0.0f.
if (v[i] <= 0.0f) v[i] = 0.0f;
}
else if (sat == 3)
{
@ -1182,6 +1188,7 @@ namespace MIPSInt
ReadVector(s, sz, vs);
ApplySwizzleS(s, sz);
float scale = V(vt);
ApplySwizzleT(&scale, V_Single);
int n = GetNumVectorElements(sz);
for (int i = 0; i < n; i++)
{

View File

@ -87,6 +87,7 @@ void Jit::ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz) {
for (int i = 0; i < n; i++)
{
// TODO: This needs to be the original values, not the original regs. (e.g. [-x, |x|, x])
origV[i] = vregs[i];
}
@ -98,6 +99,11 @@ void Jit::ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz) {
int constants = (prefix >> (12+i)) & 1;
if (!constants) {
// Prefix may say "z, z, z, z" but if this is a pair, we force to x.
// TODO: But some ops seem to use const 0 instead?
if (regnum > n) {
regnum = 0;
}
vregs[i] = origV[regnum];
if (abs) {
ANDPS(fpr.VX(vregs[i]), M((void *)&noSignMask));