drc: handle a corner case with SLT
authornotaz <notasas@gmail.com>
Sun, 14 Nov 2021 22:23:06 +0000 (00:23 +0200)
committernotaz <notasas@gmail.com>
Sun, 14 Nov 2021 22:23:06 +0000 (00:23 +0200)
libpcsxcore/new_dynarec/new_dynarec.c

index ef9bec7..ceba0e7 100644 (file)
@@ -2157,10 +2157,11 @@ static void alu_assemble(int i,struct regstat *i_regs)
           s2l=get_reg(i_regs->regmap,rs2[i]);
           if(rs2[i]==0) // rx<r0
           {
           s2l=get_reg(i_regs->regmap,rs2[i]);
           if(rs2[i]==0) // rx<r0
           {
-            assert(s1l>=0);
-            if(opcode2[i]==0x2a) // SLT
+            if(opcode2[i]==0x2a&&rs1[i]!=0) { // SLT
+              assert(s1l>=0);
               emit_shrimm(s1l,31,t);
               emit_shrimm(s1l,31,t);
-            else // SLTU (unsigned can not be less than zero)
+            }
+            else // SLTU (unsigned can not be less than zero, 0<0)
               emit_zeroreg(t);
           }
           else if(rs1[i]==0) // r0<rx
               emit_zeroreg(t);
           }
           else if(rs1[i]==0) // r0<rx