Reformating lambdas to make vs happier.
This commit is contained in:
parent
6e35b6efa3
commit
ae6c903173
|
@ -1311,9 +1311,7 @@ table->AddSequence(OPCODE_LOAD, [](X64Emitter& e, Instr*& i) {
|
|||
if (cbs->handles(cbs->context, address)) {
|
||||
// Eh, hacking lambdas.
|
||||
i->src3.offset = (uint64_t)cbs;
|
||||
IntUnaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
IntUnaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
auto cbs = (RegisterAccessCallbacks*)i.src3.offset;
|
||||
e.mov(e.rcx, (uint64_t)cbs->context);
|
||||
e.mov(e.rdx, i.src1.value->AsUint64());
|
||||
|
@ -1774,12 +1772,9 @@ table->AddSequence(OPCODE_VECTOR_COMPARE_UGE, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_ADD, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
e.add(dest_src, src);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.add(dest_src, src);
|
||||
});
|
||||
} else if (IsFloatType(i->dest->type)) {
|
||||
|
@ -1796,9 +1791,7 @@ table->AddSequence(OPCODE_ADD, [](X64Emitter& e, Instr*& i) {
|
|||
table->AddSequence(OPCODE_ADD_CARRY, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
// dest = src1 + src2 + src3.i8
|
||||
IntTernaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src2, const Operand& src3) {
|
||||
IntTernaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src2, const Operand& src3) {
|
||||
Reg8 src3_8(src3.getIdx());
|
||||
if (src3.getIdx() <= 4) {
|
||||
e.mov(e.ah, src3_8);
|
||||
|
@ -1808,14 +1801,12 @@ table->AddSequence(OPCODE_ADD_CARRY, [](X64Emitter& e, Instr*& i) {
|
|||
}
|
||||
e.sahf();
|
||||
e.adc(dest_src, src2);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src2, uint32_t src3) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src2, uint32_t src3) {
|
||||
e.mov(e.eax, src3);
|
||||
e.mov(e.ah, e.al);
|
||||
e.sahf();
|
||||
e.adc(dest_src, src2);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src2, const Operand& src3) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src2, const Operand& src3) {
|
||||
Reg8 src3_8(src3.getIdx());
|
||||
if (src3.getIdx() <= 4) {
|
||||
e.mov(e.ah, src3_8);
|
||||
|
@ -1855,12 +1846,9 @@ table->AddSequence(OPCODE_VECTOR_ADD, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_SUB, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
e.sub(dest_src, src);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.sub(dest_src, src);
|
||||
});
|
||||
} else if (IsFloatType(i->dest->type)) {
|
||||
|
@ -1878,9 +1866,7 @@ table->AddSequence(OPCODE_SUB, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_MUL, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -1891,8 +1877,7 @@ table->AddSequence(OPCODE_MUL, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(src);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -1919,9 +1904,7 @@ table->AddSequence(OPCODE_MUL, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_MUL_HI, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -1933,8 +1916,7 @@ table->AddSequence(OPCODE_MUL_HI, [](X64Emitter& e, Instr*& i) {
|
|||
e.imul(src);
|
||||
}
|
||||
e.mov(dest_src, Ndx);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -1957,9 +1939,7 @@ table->AddSequence(OPCODE_MUL_HI, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_DIV, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -1970,8 +1950,7 @@ table->AddSequence(OPCODE_DIV, [](X64Emitter& e, Instr*& i) {
|
|||
e.idiv(src);
|
||||
}
|
||||
e.mov(dest_src, Nax);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
// RAX = value, RDX = clobbered
|
||||
// TODO(benvanik): make the register allocator put dest_src in RAX?
|
||||
auto Nax = LIKE_REG(e.rax, dest_src);
|
||||
|
@ -2122,12 +2101,9 @@ table->AddSequence(OPCODE_DOT_PRODUCT_4, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_AND, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
e.and(dest_src, src);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.and(dest_src, src);
|
||||
});
|
||||
} else if (IsVecType(i->dest->type)) {
|
||||
|
@ -2141,12 +2117,9 @@ table->AddSequence(OPCODE_AND, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_OR, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
e.or(dest_src, src);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.or(dest_src, src);
|
||||
});
|
||||
} else if (IsVecType(i->dest->type)) {
|
||||
|
@ -2160,12 +2133,9 @@ table->AddSequence(OPCODE_OR, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_XOR, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
e.xor(dest_src, src);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.xor(dest_src, src);
|
||||
});
|
||||
} else if (IsVecType(i->dest->type)) {
|
||||
|
@ -2179,9 +2149,7 @@ table->AddSequence(OPCODE_XOR, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_NOT, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntUnaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
IntUnaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
e.not(dest_src);
|
||||
});
|
||||
} else if (IsVecType(i->dest->type)) {
|
||||
|
@ -2196,9 +2164,7 @@ table->AddSequence(OPCODE_NOT, [](X64Emitter& e, Instr*& i) {
|
|||
table->AddSequence(OPCODE_SHL, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
// TODO(benvanik): use shlx if available.
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// Can only shl by cl. Eww x86.
|
||||
Reg8 shamt(src.getIdx());
|
||||
e.mov(e.rax, e.rcx);
|
||||
|
@ -2210,8 +2176,7 @@ table->AddSequence(OPCODE_SHL, [](X64Emitter& e, Instr*& i) {
|
|||
Reg32e src_e(src.getIdx(), MAX(dest_src.getBit(), 32));
|
||||
e.and(src_e, 0x3F);
|
||||
e.shlx(dest_src_e, dest_src_e, src_e);*/
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.shl(dest_src, src);
|
||||
});
|
||||
} else {
|
||||
|
@ -2224,17 +2189,14 @@ table->AddSequence(OPCODE_SHL, [](X64Emitter& e, Instr*& i) {
|
|||
table->AddSequence(OPCODE_SHR, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
// TODO(benvanik): use shrx if available.
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// Can only sar by cl. Eww x86.
|
||||
Reg8 shamt(src.getIdx());
|
||||
e.mov(e.rax, e.rcx);
|
||||
e.mov(e.cl, shamt);
|
||||
e.shr(dest_src, e.cl);
|
||||
e.mov(e.rcx, e.rax);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.shr(dest_src, src);
|
||||
});
|
||||
} else {
|
||||
|
@ -2247,17 +2209,14 @@ table->AddSequence(OPCODE_SHR, [](X64Emitter& e, Instr*& i) {
|
|||
table->AddSequence(OPCODE_SHA, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
// TODO(benvanik): use sarx if available.
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// Can only sar by cl. Eww x86.
|
||||
Reg8 shamt(src.getIdx());
|
||||
e.mov(e.rax, e.rcx);
|
||||
e.mov(e.cl, shamt);
|
||||
e.sar(dest_src, e.cl);
|
||||
e.mov(e.rcx, e.rax);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.sar(dest_src, src);
|
||||
});
|
||||
} else {
|
||||
|
@ -2323,17 +2282,14 @@ table->AddSequence(OPCODE_VECTOR_SHA, [](X64Emitter& e, Instr*& i) {
|
|||
|
||||
table->AddSequence(OPCODE_ROTATE_LEFT, [](X64Emitter& e, Instr*& i) {
|
||||
if (IsIntType(i->dest->type)) {
|
||||
IntBinaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
IntBinaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src, const Operand& src) {
|
||||
// Can only rol by cl. Eww x86.
|
||||
Reg8 shamt(src.getIdx());
|
||||
e.mov(e.rax, e.rcx);
|
||||
e.mov(e.cl, shamt);
|
||||
e.rol(dest_src, e.cl);
|
||||
e.mov(e.rcx, e.rax);
|
||||
},
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
}, [](X64Emitter& e, Instr& i, const Reg& dest_src, uint32_t src) {
|
||||
e.rol(dest_src, src);
|
||||
});
|
||||
} else {
|
||||
|
@ -2584,9 +2540,7 @@ table->AddSequence(OPCODE_UNPACK, [](X64Emitter& e, Instr*& i) {
|
|||
// Load source, move from tight pack of X16Y16.... to X16...Y16...
|
||||
// Also zero out the high end.
|
||||
// TODO(benvanik): special case constant unpacks that just get 0/1/etc.
|
||||
IntUnaryOp(
|
||||
e, i,
|
||||
[](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
IntUnaryOp(e, i, [](X64Emitter& e, Instr& i, const Reg& dest_src) {
|
||||
// sx = src.iw >> 16;
|
||||
// sy = src.iw & 0xFFFF;
|
||||
// dest = { 3.0 + (sx / float(1 << 22)),
|
||||
|
|
Loading…
Reference in New Issue