shader_recompiler: Use FPRecip in FSWZADD implementation

Simplifies the negative reciprocal calculation in FSWZADD by using the
dedicated FPRecip operation instead of manually constructing a division.
This change:

- Replaces FPDiv(Imm32(f32(1.0f)), src_b) with FPRecip(src_b)
- Results in more efficient code for calculating 1.0/x
- Fixes build errors from undefined IR emitter methods
This commit is contained in:
Zephyron 2024-12-31 22:54:55 +10:00
parent 6f160628c0
commit 2b5082b30d
No known key found for this signature in database
GPG key ID: 8DA271B6A74353F1

View file

@ -34,7 +34,7 @@ void TranslatorVisitor::FSWZADD(u64 insn) {
IR::F32 result;
if (fswzadd.ndv != 0) {
const IR::F32 neg_recip = ir.FPNeg(ir.FPDiv(ir.Imm32(ir.f32(1.0f)), src_b));
const IR::F32 neg_recip = ir.FPNeg(ir.FPRecip(src_b));
result = ir.FSwizzleAdd(src_a, neg_recip, swizzle, fp_control);
} else {
result = ir.FSwizzleAdd(src_a, src_b, swizzle, fp_control);