summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-05-08 19:21:32 -0400
committerGravatar ameerj2021-07-22 21:51:30 -0400
commit934d3002462e27bcc289c1edb4959896cb23beb0 (patch)
treec28a4192fc0968f2197e9cfdbca6f4864679c56d /src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
parentglasm: Implement more logical ops (diff)
downloadyuzu-934d3002462e27bcc289c1edb4959896cb23beb0.tar.gz
yuzu-934d3002462e27bcc289c1edb4959896cb23beb0.tar.xz
yuzu-934d3002462e27bcc289c1edb4959896cb23beb0.zip
glasm: Use CMP.S for Select32
also fixes ADD and SUB to use U modifier
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm_select.cpp')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_select.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
index 636cbe8a0..16f6c33f3 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_select.cpp
@@ -24,12 +24,7 @@ void EmitSelectU16(EmitContext&, std::string_view, std::string_view, std::string
24 24
25void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, 25void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
26 std::string_view true_value, std::string_view false_value) { 26 std::string_view true_value, std::string_view false_value) {
27 ctx.Add("MOV.U.CC RC,{};", cond); 27 ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
28 ctx.Add("IF NE.x;");
29 ctx.Add("MOV.U {},{};", inst, true_value);
30 ctx.Add("ELSE;");
31 ctx.Add("MOV.U {},{};", inst, false_value);
32 ctx.Add("ENDIF;");
33} 28}
34 29
35void EmitSelectU64(EmitContext&, std::string_view, std::string_view, std::string_view) { 30void EmitSelectU64(EmitContext&, std::string_view, std::string_view, std::string_view) {
@@ -40,8 +35,9 @@ void EmitSelectF16(EmitContext&, std::string_view, std::string_view, std::string
40 throw NotImplementedException("GLASM instruction"); 35 throw NotImplementedException("GLASM instruction");
41} 36}
42 37
43void EmitSelectF32(EmitContext&, std::string_view, std::string_view, std::string_view) { 38void EmitSelectF32(EmitContext& ctx, IR::Inst& inst, std::string_view cond,
44 throw NotImplementedException("GLASM instruction"); 39 std::string_view true_value, std::string_view false_value) {
40 ctx.Add("CMP.S {},{},{},{};", inst, cond, true_value, false_value);
45} 41}
46 42
47void EmitSelectF64(EmitContext&, std::string_view, std::string_view, std::string_view) { 43void EmitSelectF64(EmitContext&, std::string_view, std::string_view, std::string_view) {