summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/maxwell/translate
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-04-18 10:08:22 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:28 +0200
commit29990289767c41c162473c9775ad3ba08e7ee9ea (patch)
treea5e098aa66472e033bb946d17843f2b5f701244f /src/shader_recompiler/frontend/maxwell/translate
parentshader: Implement F2F (Imm) (diff)
downloadyuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar.gz
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar.bz2
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar.lz
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar.xz
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.tar.zst
yuzu-29990289767c41c162473c9775ad3ba08e7ee9ea.zip
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp15
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp
index 61484df57..02ab023c1 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp
@@ -184,16 +184,19 @@ void TranslatorVisitor::F2F_imm([[maybe_unused]] u64 insn) {
BitField<49, 1, u64> abs;
BitField<10, 2, FloatFormat> src_size;
BitField<41, 1, u64> selector;
- BitField<20, 20, u64> imm;
-
+ BitField<20, 19, u64> imm;
+ BitField<56, 1, u64> imm_neg;
} const f2f{insn};
IR::F16F32F64 src_a;
switch (f2f.src_size) {
case FloatFormat::F16: {
- const u32 imm{static_cast<u32>(f2f.imm & 0x00ffff)};
- IR::Value vector{ir.UnpackFloat2x16(ir.Imm32(imm | (imm << 16)))};
- src_a = IR::F16{ir.CompositeExtract(vector, 0)};
+ const u32 imm{static_cast<u32>(f2f.imm & 0x0000ffff)};
+ const IR::Value vector{ir.UnpackFloat2x16(ir.Imm32(imm | (imm << 16)))};
+ src_a = IR::F16{ir.CompositeExtract(vector, f2f.selector != 0 ? 0 : 1)};
+ if (f2f.imm_neg != 0) {
+ throw NotImplementedException("Neg bit on F16");
+ }
break;
}
case FloatFormat::F32:
@@ -206,6 +209,6 @@ void TranslatorVisitor::F2F_imm([[maybe_unused]] u64 insn) {
throw NotImplementedException("Invalid dest format {}", f2f.src_size.Value());
}
F2F(*this, insn, src_a, f2f.abs != 0);
-} // namespace Shader::Maxwell
+}
} // namespace Shader::Maxwell
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
index e88c0ffb6..15da90365 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/integer_add_three_input.cpp
@@ -83,7 +83,7 @@ void IADD3(TranslatorVisitor& v, u64 insn, IR::U32 op_b, IR::U32 op_c) {
lhs = v.ir.IAdd(lhs, carry);
}
if (iadd3.cc != 0 && iadd3.shift == Shift::Left) {
- IR::U32 high_bits{v.ir.ShiftRightLogical(lhs, v.ir.Imm32(16))};
+ const IR::U32 high_bits{v.ir.ShiftRightLogical(lhs, v.ir.Imm32(16))};
of_1 = v.ir.LogicalOr(of_1, v.ir.INotEqual(v.ir.Imm32(0), high_bits));
}
lhs = IntegerShift(v.ir, lhs, iadd3.shift);