summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-14 03:42:40 +0200
committerGravatar ameerj2021-07-22 21:51:28 -0400
commit881b33da3ba16fc105c6ccd20f6fbc9c4552ead9 (patch)
tree956fc4c9ab164b960893e6214825f6320cb4cba4 /src/shader_recompiler/frontend
parentshader: Implement IADD3.CC/.X (diff)
downloadyuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.gz
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.tar.xz
yuzu-881b33da3ba16fc105c6ccd20f6fbc9c4552ead9.zip
shader: Implement F2F (Imm)
Diffstat (limited to 'src/shader_recompiler/frontend')
-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) {
179} 179}
180 180
181void TranslatorVisitor::F2F_imm([[maybe_unused]] u64 insn) { 181void TranslatorVisitor::F2F_imm([[maybe_unused]] u64 insn) {
182 throw NotImplementedException("Instruction"); 182 union {
183} 183 u64 insn;
184 BitField<49, 1, u64> abs;
185 BitField<10, 2, FloatFormat> src_size;
186 BitField<41, 1, u64> selector;
187 BitField<20, 20, u64> imm;
188
189 } const f2f{insn};
190
191 IR::F16F32F64 src_a;
192 switch (f2f.src_size) {
193 case FloatFormat::F16: {
194 const u32 imm{static_cast<u32>(f2f.imm & 0x00ffff)};
195 IR::Value vector{ir.UnpackFloat2x16(ir.Imm32(imm | (imm << 16)))};
196 src_a = IR::F16{ir.CompositeExtract(vector, 0)};
197 break;
198 }
199 case FloatFormat::F32:
200 src_a = GetFloatImm20(insn);
201 break;
202 case FloatFormat::F64:
203 src_a = GetDoubleImm20(insn);
204 break;
205 default:
206 throw NotImplementedException("Invalid dest format {}", f2f.src_size.Value());
207 }
208 F2F(*this, insn, src_a, f2f.abs != 0);
209} // namespace Shader::Maxwell
184 210
185} // namespace Shader::Maxwell 211} // namespace Shader::Maxwell