diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-04-17 06:48:35 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:28 +0200 |
commit | be431f5ed080955cce358e9750347229b2bc9a04 (patch) | |
tree | 6980191ce828379c3a0a16418539be676722de67 /src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp | |
parent | shader: Implement SampleMask (diff) | |
download | yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar.gz yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar.bz2 yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar.lz yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar.xz yuzu-be431f5ed080955cce358e9750347229b2bc9a04.tar.zst yuzu-be431f5ed080955cce358e9750347229b2bc9a04.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp index fb7f821e6..1e1ec2119 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/bitfield_insert.cpp @@ -16,18 +16,14 @@ void BFI(TranslatorVisitor& v, u64 insn, const IR::U32& src_a, const IR::U32& ba BitField<47, 1, u64> cc; } const bfi{insn}; - if (bfi.cc != 0) { - throw NotImplementedException("BFI CC"); - } - - const IR::U32 offset{v.ir.BitFieldExtract(src_a, v.ir.Imm32(0), v.ir.Imm32(8), false)}; + const IR::U32 zero{v.ir.Imm32(0)}; + const IR::U32 offset{v.ir.BitFieldExtract(src_a, zero, v.ir.Imm32(8), false)}; const IR::U32 unsafe_count{v.ir.BitFieldExtract(src_a, v.ir.Imm32(8), v.ir.Imm32(8), false)}; const IR::U32 max_size{v.ir.Imm32(32)}; // Edge case conditions - const IR::U1 zero_offset{v.ir.IEqual(offset, v.ir.Imm32(0))}; const IR::U1 exceed_offset{v.ir.IGreaterThanEqual(offset, max_size, false)}; - const IR::U1 exceed_count{v.ir.IGreaterThanEqual(unsafe_count, max_size, false)}; + const IR::U1 exceed_count{v.ir.IGreaterThan(unsafe_count, max_size, false)}; const IR::U32 remaining_size{v.ir.ISub(max_size, offset)}; const IR::U32 safe_count{v.ir.Select(exceed_count, remaining_size, unsafe_count)}; @@ -36,9 +32,14 @@ void BFI(TranslatorVisitor& v, u64 insn, const IR::U32& src_a, const IR::U32& ba IR::U32 result{v.ir.BitFieldInsert(base, insert, offset, safe_count)}; result = IR::U32{v.ir.Select(exceed_offset, base, result)}; - result = IR::U32{v.ir.Select(zero_offset, base, result)}; v.X(bfi.dest_reg, result); + if (bfi.cc != 0) { + v.SetZFlag(v.ir.IEqual(result, zero)); + v.SetSFlag(v.ir.ILessThan(result, zero, true)); + v.ResetCFlag(); + v.ResetOFlag(); + } } } // Anonymous namespace |