backend/x64: Change V flag testing to cmp instead of add
Prefer a non-destructive read to a destructive read.
This commit is contained in:
parent
f35d98c923
commit
510862e50c
2 changed files with 12 additions and 12 deletions
|
@ -219,11 +219,11 @@ Xbyak::Label EmitX64::EmitCond(IR::Cond cond) {
|
||||||
code.jns(pass);
|
code.jns(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::VS: //v
|
case IR::Cond::VS: //v
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.jo(pass);
|
code.jo(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::VC: //!v
|
case IR::Cond::VC: //!v
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.jno(pass);
|
code.jno(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::HI: //c & !z
|
case IR::Cond::HI: //c & !z
|
||||||
|
@ -237,22 +237,22 @@ Xbyak::Label EmitX64::EmitCond(IR::Cond cond) {
|
||||||
code.jna(pass);
|
code.jna(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::GE: // n == v
|
case IR::Cond::GE: // n == v
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.jge(pass);
|
code.jge(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::LT: // n != v
|
case IR::Cond::LT: // n != v
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.jl(pass);
|
code.jl(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::GT: // !z & (n == v)
|
case IR::Cond::GT: // !z & (n == v)
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.jg(pass);
|
code.jg(pass);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::LE: // z | (n != v)
|
case IR::Cond::LE: // z | (n != v)
|
||||||
code.add(al, 0x7F);
|
code.cmp(al, 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.jle(pass);
|
code.jle(pass);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -171,11 +171,11 @@ static void EmitConditionalSelect(BlockOfCode& code, EmitContext& ctx, IR::Inst*
|
||||||
code.cmovns(else_, then_);
|
code.cmovns(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::VS: //v
|
case IR::Cond::VS: //v
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.cmovo(else_, then_);
|
code.cmovo(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::VC: //!v
|
case IR::Cond::VC: //!v
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.cmovno(else_, then_);
|
code.cmovno(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::HI: //c & !z
|
case IR::Cond::HI: //c & !z
|
||||||
|
@ -189,22 +189,22 @@ static void EmitConditionalSelect(BlockOfCode& code, EmitContext& ctx, IR::Inst*
|
||||||
code.cmovna(else_, then_);
|
code.cmovna(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::GE: // n == v
|
case IR::Cond::GE: // n == v
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.cmovge(else_, then_);
|
code.cmovge(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::LT: // n != v
|
case IR::Cond::LT: // n != v
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.cmovl(else_, then_);
|
code.cmovl(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::GT: // !z & (n == v)
|
case IR::Cond::GT: // !z & (n == v)
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.cmovg(else_, then_);
|
code.cmovg(else_, then_);
|
||||||
break;
|
break;
|
||||||
case IR::Cond::LE: // z | (n != v)
|
case IR::Cond::LE: // z | (n != v)
|
||||||
code.add(nzcv.cvt8(), 0x7F);
|
code.cmp(nzcv.cvt8(), 0x81);
|
||||||
code.sahf();
|
code.sahf();
|
||||||
code.cmovle(else_, then_);
|
code.cmovle(else_, then_);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue