Adding/removing saturate checks where required.

This commit is contained in:
Ben Vanik 2015-12-30 09:31:03 -08:00
parent 76ed07cfff
commit 3c332ef1f5
1 changed files with 14 additions and 3 deletions

View File

@ -392,7 +392,6 @@ int InstrEmit_vaddsws(PPCHIRBuilder& f, const InstrData& i) {
int InstrEmit_vaddubm(PPCHIRBuilder& f, const InstrData& i) {
Value* v = f.VectorAdd(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT8_TYPE,
ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -408,7 +407,6 @@ int InstrEmit_vaddubs(PPCHIRBuilder& f, const InstrData& i) {
int InstrEmit_vadduhm(PPCHIRBuilder& f, const InstrData& i) {
Value* v = f.VectorAdd(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT16_TYPE,
ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -424,7 +422,6 @@ int InstrEmit_vadduhs(PPCHIRBuilder& f, const InstrData& i) {
int InstrEmit_vadduwm(PPCHIRBuilder& f, const InstrData& i) {
Value* v = f.VectorAdd(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT32_TYPE,
ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -548,6 +545,7 @@ int InstrEmit_vctsxs_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
Value* v =
f.Mul(f.LoadVR(vb), f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
v = f.VectorConvertF2I(v, ARITHMETIC_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -565,6 +563,7 @@ int InstrEmit_vctuxs_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
Value* v =
f.Mul(f.LoadVR(vb), f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
v = f.VectorConvertF2I(v, ARITHMETIC_UNSIGNED | ARITHMETIC_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1666,6 +1665,7 @@ int InstrEmit_vsubsbs(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTS(VA) + ¬EXTS(VB) + 1, -128, 127)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT8_TYPE,
ARITHMETIC_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1674,6 +1674,7 @@ int InstrEmit_vsubshs(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTS(VA) + ¬EXTS(VB) + 1, -2^15, 2^15-1)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT16_TYPE,
ARITHMETIC_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1682,6 +1683,7 @@ int InstrEmit_vsubsws(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTS(VA) + ¬EXTS(VB) + 1, -2^31, 2^31-1)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT32_TYPE,
ARITHMETIC_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1714,6 +1716,7 @@ int InstrEmit_vsububs(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTZ(VA) + ¬EXTZ(VB) + 1, 0, 256)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT8_TYPE,
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1722,6 +1725,7 @@ int InstrEmit_vsubuhs(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTZ(VA) + ¬EXTZ(VB) + 1, 0, 2^16-1)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT16_TYPE,
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1730,6 +1734,7 @@ int InstrEmit_vsubuws(PPCHIRBuilder& f, const InstrData& i) {
// (VD) <- clamp(EXTZ(VA) + ¬EXTZ(VB) + 1, 0, 2^32-1)
Value* v = f.VectorSub(f.LoadVR(i.VX.VA), f.LoadVR(i.VX.VB), INT32_TYPE,
ARITHMETIC_SATURATE | ARITHMETIC_UNSIGNED);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(i.VX.VD, v);
return 0;
}
@ -1775,6 +1780,7 @@ int InstrEmit_vpkshss_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_8_IN_16 | PACK_TYPE_IN_SIGNED |
PACK_TYPE_OUT_SIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1796,6 +1802,7 @@ int InstrEmit_vpkswss_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_16_IN_32 | PACK_TYPE_IN_SIGNED |
PACK_TYPE_OUT_SIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1817,6 +1824,7 @@ int InstrEmit_vpkswus_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_16_IN_32 | PACK_TYPE_IN_SIGNED |
PACK_TYPE_OUT_UNSIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1858,6 +1866,7 @@ int InstrEmit_vpkuhus_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_8_IN_16 | PACK_TYPE_IN_UNSIGNED |
PACK_TYPE_OUT_UNSIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1879,6 +1888,7 @@ int InstrEmit_vpkshus_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_8_IN_16 | PACK_TYPE_IN_SIGNED |
PACK_TYPE_OUT_UNSIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}
@ -1920,6 +1930,7 @@ int InstrEmit_vpkuwus_(PPCHIRBuilder& f, uint32_t vd, uint32_t va,
Value* v = f.Pack(f.LoadVR(va), f.LoadVR(vb),
PACK_TYPE_16_IN_32 | PACK_TYPE_IN_UNSIGNED |
PACK_TYPE_OUT_UNSIGNED | PACK_TYPE_OUT_SATURATE);
f.StoreSAT(f.DidSaturate(v));
f.StoreVR(vd, v);
return 0;
}