diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-12-18 07:16:09 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-15 21:54:52 +0100 |
commit | cf4a08d95098370868fb631a0436f2a4968df9af (patch) | |
tree | 201a43fd7dd59d69678716bf941d134b5e2da938 /src/video_core/shader/decode | |
parent | shader_decode: Implement MOV_SYS (diff) | |
download | yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar.gz yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar.bz2 yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar.lz yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar.xz yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.tar.zst yuzu-cf4a08d95098370868fb631a0436f2a4968df9af.zip |
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r-- | src/video_core/shader/decode/arithmetic_half_immediate.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/arithmetic_half_immediate.cpp b/src/video_core/shader/decode/arithmetic_half_immediate.cpp index 8d8a2dad9..5c280a1a6 100644 --- a/src/video_core/shader/decode/arithmetic_half_immediate.cpp +++ b/src/video_core/shader/decode/arithmetic_half_immediate.cpp @@ -16,7 +16,34 @@ u32 ShaderIR::DecodeArithmeticHalfImmediate(BasicBlock& bb, u32 pc) { const Instruction instr = {program_code[pc]}; const auto opcode = OpCode::Decode(instr); - UNIMPLEMENTED(); + if (opcode->get().GetId() == OpCode::Id::HADD2_IMM) { + UNIMPLEMENTED_IF(instr.alu_half_imm.ftz != 0); + } else { + UNIMPLEMENTED_IF(instr.alu_half_imm.precision != Tegra::Shader::HalfPrecision::None); + } + UNIMPLEMENTED_IF_MSG(instr.alu_half_imm.saturate != 0, + "Half float immediate saturation not implemented"); + + Node op_a = GetRegister(instr.gpr8); + op_a = GetOperandAbsNegHalf(op_a, instr.alu_half_imm.abs_a, instr.alu_half_imm.negate_a); + + const Node op_b = UnpackHalfImmediate(instr, true); + + Node value = [&]() { + MetaHalfArithmetic meta{true, {instr.alu_half_imm.type_a}}; + switch (opcode->get().GetId()) { + case OpCode::Id::HADD2_IMM: + return Operation(OperationCode::HAdd, meta, op_a, op_b); + case OpCode::Id::HMUL2_IMM: + return Operation(OperationCode::HMul, meta, op_a, op_b); + default: + UNREACHABLE(); + return Immediate(0); + } + }(); + value = HalfMerge(GetRegister(instr.gpr0), value, instr.alu_half_imm.merge); + + SetRegister(bb, instr.gpr0, value); return pc; } |