[PPC] vcfsx/vcfux: Only mul if needed
This commit is contained in:
parent
cb93ddf873
commit
d0b849aad7
|
@ -519,9 +519,11 @@ int InstrEmit_vavguw(PPCHIRBuilder& f, const InstrData& i) {
|
||||||
int InstrEmit_vcfsx_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
|
int InstrEmit_vcfsx_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
|
||||||
uint32_t uimm) {
|
uint32_t uimm) {
|
||||||
// (VD) <- float(VB as signed) / 2^uimm
|
// (VD) <- float(VB as signed) / 2^uimm
|
||||||
float fuimm = std::ldexp(1.0f, -int32_t(uimm));
|
Value* v = f.VectorConvertI2F(f.LoadVR(vb));
|
||||||
Value* v = f.Mul(f.VectorConvertI2F(f.LoadVR(vb)),
|
if (uimm) {
|
||||||
f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
|
float fuimm = std::ldexp(1.0f, -int(uimm));
|
||||||
|
v = f.Mul(v, f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
|
||||||
|
}
|
||||||
f.StoreVR(vd, v);
|
f.StoreVR(vd, v);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -535,9 +537,11 @@ int InstrEmit_vcsxwfp128(PPCHIRBuilder& f, const InstrData& i) {
|
||||||
int InstrEmit_vcfux_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
|
int InstrEmit_vcfux_(PPCHIRBuilder& f, uint32_t vd, uint32_t vb,
|
||||||
uint32_t uimm) {
|
uint32_t uimm) {
|
||||||
// (VD) <- float(VB as unsigned) / 2^uimm
|
// (VD) <- float(VB as unsigned) / 2^uimm
|
||||||
float fuimm = std::ldexp(1.0f, -int32_t(uimm));
|
Value* v = f.VectorConvertI2F(f.LoadVR(vb), ARITHMETIC_UNSIGNED);
|
||||||
Value* v = f.Mul(f.VectorConvertI2F(f.LoadVR(vb), ARITHMETIC_UNSIGNED),
|
if (uimm) {
|
||||||
f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
|
float fuimm = std::ldexp(1.0f, -int(uimm));
|
||||||
|
v = f.Mul(v, f.Splat(f.LoadConstantFloat32(fuimm), VEC128_TYPE));
|
||||||
|
}
|
||||||
f.StoreVR(vd, v);
|
f.StoreVR(vd, v);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue