summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glasm
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-25 07:48:03 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:33 +0200
commit70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac (patch)
treee4d98cb3a8f7dbd77ab9d13105729ea2b244e73b /src/shader_recompiler/backend/glasm
parentglasm: Remove unnecessary value types (diff)
downloadyuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar.gz
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar.bz2
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar.lz
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar.xz
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.tar.zst
yuzu-70c9281fbffbf5f68a267ba85f6e4b3c122fa3ac.zip
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
index e9d1bae05..cea45a3e0 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_integer.cpp
@@ -67,7 +67,11 @@ void EmitIMul32(EmitContext& ctx, IR::Inst& inst, ScalarS32 a, ScalarS32 b) {
}
void EmitINeg32(EmitContext& ctx, IR::Inst& inst, ScalarS32 value) {
- ctx.Add("MOV.S {},-{};", inst, value);
+ if (value.type != Type::Register && static_cast<s32>(value.imm_u32) < 0) {
+ ctx.Add("MOV.S {},{};", inst, -static_cast<s32>(value.imm_u32));
+ } else {
+ ctx.Add("MOV.S {},-{};", inst, value);
+ }
}
void EmitINeg64(EmitContext& ctx, IR::Inst& inst, Register value) {