summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-21 06:05:52 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:51 +0100
commita2819c204f1a72a63ee5e8cc9a9830cd27fb6853 (patch)
treea4637138bf7506ce120388b7740729e614056178 /src/video_core/shader/decode
parentshader_decode: Implement LOP32I (diff)
downloadyuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar.gz
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar.bz2
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar.lz
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar.xz
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.tar.zst
yuzu-a2819c204f1a72a63ee5e8cc9a9830cd27fb6853.zip
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/shift.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/shift.cpp b/src/video_core/shader/decode/shift.cpp
index 41f5b8cb0..76938fa05 100644
--- a/src/video_core/shader/decode/shift.cpp
+++ b/src/video_core/shader/decode/shift.cpp
@@ -16,7 +16,32 @@ u32 ShaderIR::DecodeShift(BasicBlock& bb, u32 pc) {
const Instruction instr = {program_code[pc]};
const auto opcode = OpCode::Decode(instr);
- UNIMPLEMENTED();
+ const Node op_a = GetRegister(instr.gpr8);
+ const Node op_b = [&]() {
+ if (instr.is_b_imm) {
+ return Immediate(instr.alu.GetSignedImm20_20());
+ } else if (instr.is_b_gpr) {
+ return GetRegister(instr.gpr20);
+ } else {
+ return GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset);
+ }
+ }();
+
+ switch (opcode->get().GetId()) {
+ case OpCode::Id::SHR_C:
+ case OpCode::Id::SHR_R:
+ case OpCode::Id::SHR_IMM: {
+ UNIMPLEMENTED_IF_MSG(instr.generates_cc,
+ "Condition codes generation in SHR is not implemented");
+
+ const Node value = SignedOperation(OperationCode::IArithmeticShiftRight,
+ instr.shift.is_signed, PRECISE, op_a, op_b);
+ SetRegister(bb, instr.gpr0, value);
+ break;
+ }
+ default:
+ UNIMPLEMENTED_MSG("Unhandled shift instruction: {}", opcode->get().GetName());
+ }
return pc;
}