summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-04-14 03:42:40 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:28 +0200
commit881b33da3ba16fc105c6ccd20f6fbc9c4552ead9 (patch)
tree956fc4c9ab164b960893e6214825f6320cb4cba4
parentshader: Implement IADD3.CC/.X (diff)
downloadyuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.gz
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.bz2
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.lz
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.xz
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.zst
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.zip
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_floating_point.cpp30
1 files changed, 28 insertions, 2 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 ce2cf470d..61484df57 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
@@ -179,7 +179,33 @@ void TranslatorVisitor::F2F_cbuf(u64 insn) {
}
void TranslatorVisitor::F2F_imm([[maybe_unused]] u64 insn) {
- throw NotImplementedException("Instruction");
-}
+ union {
+ u64 insn;
+ BitField<49, 1, u64> abs;
+ BitField<10, 2, FloatFormat> src_size;
+ BitField<41, 1, u64> selector;
+ BitField<20, 20, u64> imm;
+
+ } 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)};
+ break;
+ }
+ case FloatFormat::F32:
+ src_a = GetFloatImm20(insn);
+ break;
+ case FloatFormat::F64:
+ src_a = GetDoubleImm20(insn);
+ break;
+ default:
+ throw NotImplementedException("Invalid dest format {}", f2f.src_size.Value());
+ }
+ F2F(*this, insn, src_a, f2f.abs != 0);
+} // namespace Shader::Maxwell
} // namespace Shader::Maxwell