diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-05 09:58:02 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:21 +0200 |
commit | e81739493a0cacc1efe3295f9d287d5d31b1a989 (patch) | |
tree | 11a3d04ce9def535414a00226030798f337c053c /src/shader_recompiler/frontend/ir/ir_emitter.cpp | |
parent | shader: Initial instruction support (diff) | |
download | yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar.gz yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar.bz2 yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar.lz yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar.xz yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.tar.zst yuzu-e81739493a0cacc1efe3295f9d287d5d31b1a989.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/ir/ir_emitter.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 87b253c9a..1c5ae0109 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp @@ -504,6 +504,20 @@ U32U64 IREmitter::IAdd(const U32U64& a, const U32U64& b) { } } +U32U64 IREmitter::ISub(const U32U64& a, const U32U64& b) { + if (a.Type() != b.Type()) { + throw InvalidArgument("Mismatching types {} and {}", a.Type(), b.Type()); + } + switch (a.Type()) { + case Type::U32: + return Inst<U32>(Opcode::ISub32, a, b); + case Type::U64: + return Inst<U64>(Opcode::ISub64, a, b); + default: + ThrowInvalidType(a.Type()); + } +} + U32 IREmitter::IMul(const U32& a, const U32& b) { return Inst<U32>(Opcode::IMul32, a, b); } @@ -679,8 +693,8 @@ U32U64 IREmitter::ConvertFToI(size_t bitsize, bool is_signed, const U16U32U64& v } } -U32U64 IREmitter::ConvertU(size_t bitsize, const U32U64& value) { - switch (bitsize) { +U32U64 IREmitter::ConvertU(size_t result_bitsize, const U32U64& value) { + switch (result_bitsize) { case 32: switch (value.Type()) { case Type::U32: @@ -703,7 +717,7 @@ U32U64 IREmitter::ConvertU(size_t bitsize, const U32U64& value) { break; } } - throw NotImplementedException("Conversion from {} to {} bits", value.Type(), bitsize); + throw NotImplementedException("Conversion from {} to {} bits", value.Type(), result_bitsize); } } // namespace Shader::IR |