cmp/cmpi/cmpl/cmpli.

May not be right.
This commit is contained in:
Ben Vanik 2013-05-24 19:52:00 -07:00
parent 6cd8495ea2
commit 1ad0bb7843
1 changed files with 25 additions and 35 deletions

View File

@ -468,7 +468,6 @@ XEEMITTER(subfzex, 0x7C000190, XO )(X64Emitter& e, X86Compiler& c, InstrDat
// Integer compare (A-4) // Integer compare (A-4)
#if 0
XEEMITTER(cmp, 0x7C000000, X )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(cmp, 0x7C000000, X )(X64Emitter& e, X86Compiler& c, InstrData& i) {
// if L = 0 then // if L = 0 then
// a <- EXTS((RA)[32:63]) // a <- EXTS((RA)[32:63])
@ -487,23 +486,21 @@ XEEMITTER(cmp, 0x7C000000, X )(X64Emitter& e, X86Compiler& c, InstrDat
uint32_t BF = i.X.RT >> 2; uint32_t BF = i.X.RT >> 2;
uint32_t L = i.X.RT & 1; uint32_t L = i.X.RT & 1;
jit_value_t lhs = e.gpr_value(i.X.RA); GpVar lhs(c.newGpVar());
jit_value_t rhs = e.gpr_value(i.X.RB); GpVar rhs(c.newGpVar());
c.mov(lhs, e.gpr_value(i.X.RA));
c.mov(rhs, e.gpr_value(i.X.RB));
if (!L) { if (!L) {
// 32-bit - truncate and sign extend. // 32-bit - truncate and sign extend.
lhs = e.trunc_to_int(lhs); c.cdqe(lhs);
lhs = e.sign_extend(lhs, jit_type_nint); c.cdqe(rhs);
rhs = e.trunc_to_int(rhs);
rhs = e.sign_extend(rhs, jit_type_nint);
} }
e.update_cr_with_cond(BF, lhs, rhs); e.update_cr_with_cond(BF, lhs, rhs);
return 0; return 0;
} }
#endif
#if 0
XEEMITTER(cmpi, 0x2C000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(cmpi, 0x2C000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) {
// if L = 0 then // if L = 0 then
// a <- EXTS((RA)[32:63]) // a <- EXTS((RA)[32:63])
@ -520,21 +517,18 @@ XEEMITTER(cmpi, 0x2C000000, D )(X64Emitter& e, X86Compiler& c, InstrDat
uint32_t BF = i.D.RT >> 2; uint32_t BF = i.D.RT >> 2;
uint32_t L = i.D.RT & 1; uint32_t L = i.D.RT & 1;
jit_value_t lhs = e.gpr_value(i.D.RA); GpVar lhs(c.newGpVar());
c.mov(lhs, e.gpr_value(i.D.RA));
if (!L) { if (!L) {
// 32-bit - truncate and sign extend. // 32-bit - truncate and sign extend.
lhs = e.trunc_to_int(lhs); c.cdqe(lhs);
lhs = e.sign_extend(lhs, jit_type_nint);
} }
jit_value_t rhs = e.get_int64(XEEXTS16(i.D.DS)); e.update_cr_with_cond(BF, lhs, e.get_uint64(XEEXTS16(i.D.DS)));
e.update_cr_with_cond(BF, lhs, rhs);
return 0; return 0;
} }
#endif
#if 0
XEEMITTER(cmpl, 0x7C000040, X )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(cmpl, 0x7C000040, X )(X64Emitter& e, X86Compiler& c, InstrData& i) {
// if L = 0 then // if L = 0 then
// a <- i32.0 || (RA)[32:63] // a <- i32.0 || (RA)[32:63]
@ -553,23 +547,21 @@ XEEMITTER(cmpl, 0x7C000040, X )(X64Emitter& e, X86Compiler& c, InstrDat
uint32_t BF = i.X.RT >> 2; uint32_t BF = i.X.RT >> 2;
uint32_t L = i.X.RT & 1; uint32_t L = i.X.RT & 1;
jit_value_t lhs = e.gpr_value(i.X.RA); GpVar lhs(c.newGpVar());
jit_value_t rhs = e.gpr_value(i.X.RB); GpVar rhs(c.newGpVar());
c.mov(lhs, e.gpr_value(i.X.RA));
c.mov(rhs, e.gpr_value(i.X.RB));
if (!L) { if (!L) {
// 32-bit - truncate and zero extend. // 32-bit - truncate and zero extend.
lhs = e.trunc_to_int(lhs); c.mov(lhs.r32(), lhs.r32());
lhs = e.zero_extend(lhs, jit_type_nint); c.mov(rhs.r32(), rhs.r32());
rhs = e.trunc_to_int(rhs);
rhs = e.zero_extend(rhs, jit_type_nint);
} }
e.update_cr_with_cond(BF, lhs, rhs, false); e.update_cr_with_cond(BF, lhs, rhs);
return 0; return 0;
} }
#endif
#if 0
XEEMITTER(cmpli, 0x28000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) { XEEMITTER(cmpli, 0x28000000, D )(X64Emitter& e, X86Compiler& c, InstrData& i) {
// if L = 0 then // if L = 0 then
// a <- i32.0 || (RA)[32:63] // a <- i32.0 || (RA)[32:63]
@ -586,19 +578,17 @@ XEEMITTER(cmpli, 0x28000000, D )(X64Emitter& e, X86Compiler& c, InstrDat
uint32_t BF = i.D.RT >> 2; uint32_t BF = i.D.RT >> 2;
uint32_t L = i.D.RT & 1; uint32_t L = i.D.RT & 1;
jit_value_t lhs = e.gpr_value(i.D.RA); GpVar lhs(c.newGpVar());
c.mov(lhs, e.gpr_value(i.D.RA));
if (!L) { if (!L) {
// 32-bit - truncate and zero extend. // 32-bit - truncate and zero extend.
lhs = e.trunc_to_int(lhs); c.mov(lhs.r32(), lhs.r32());
lhs = e.zero_extend(lhs, jit_type_nint);
} }
jit_value_t rhs = e.get_int64(i.D.DS); e.update_cr_with_cond(BF, lhs, e.get_uint64(i.D.DS));
e.update_cr_with_cond(BF, lhs, rhs, false);
return 0; return 0;
} }
#endif
// Integer logical (A-5) // Integer logical (A-5)
@ -1098,10 +1088,10 @@ void X64RegisterEmitCategoryALU() {
XEREGISTERINSTR(subfex, 0x7C000110); XEREGISTERINSTR(subfex, 0x7C000110);
XEREGISTERINSTR(subfmex, 0x7C0001D0); XEREGISTERINSTR(subfmex, 0x7C0001D0);
XEREGISTERINSTR(subfzex, 0x7C000190); XEREGISTERINSTR(subfzex, 0x7C000190);
// XEREGISTERINSTR(cmp, 0x7C000000); XEREGISTERINSTR(cmp, 0x7C000000);
// XEREGISTERINSTR(cmpi, 0x2C000000); XEREGISTERINSTR(cmpi, 0x2C000000);
// XEREGISTERINSTR(cmpl, 0x7C000040); XEREGISTERINSTR(cmpl, 0x7C000040);
// XEREGISTERINSTR(cmpli, 0x28000000); XEREGISTERINSTR(cmpli, 0x28000000);
XEREGISTERINSTR(andx, 0x7C000038); XEREGISTERINSTR(andx, 0x7C000038);
XEREGISTERINSTR(andcx, 0x7C000078); XEREGISTERINSTR(andcx, 0x7C000078);
XEREGISTERINSTR(andix, 0x70000000); XEREGISTERINSTR(andix, 0x70000000);