mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-08 02:48:34 +00:00
Add sign and zero extension opcodes.
This commit is contained in:
parent
4684cd5bac
commit
9006e61d65
@ -253,7 +253,9 @@ namespace sp {
|
|||||||
_(NE_F32, "ne.f32") \
|
_(NE_F32, "ne.f32") \
|
||||||
_(EQ_F32, "eq.f32") \
|
_(EQ_F32, "eq.f32") \
|
||||||
_(NOT_F32, "not.f32") \
|
_(NOT_F32, "not.f32") \
|
||||||
_(AND_C, "and.c")
|
_(AND_C, "and.c") \
|
||||||
|
_(ZEX_PRI, "zex.pri") \
|
||||||
|
_(ZEX_ALT, "zex.alt")
|
||||||
|
|
||||||
enum OPCODE {
|
enum OPCODE {
|
||||||
#define _(op, text) OP_##op,
|
#define _(op, text) OP_##op,
|
||||||
|
|||||||
@ -1015,6 +1015,33 @@ Compiler::emitOp(OPCODE op)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Zero-extend an [8,16] bit value to a 32-bit value, or a 32-bit value
|
||||||
|
// to a 64-bit value.
|
||||||
|
case OP_ZEX_PRI:
|
||||||
|
case OP_ZEX_ALT:
|
||||||
|
{
|
||||||
|
Register reg = (op == OP_SIGN_PRI) ? pri : alt;
|
||||||
|
size_t bits = readCell();
|
||||||
|
switch (bits) {
|
||||||
|
case 8:
|
||||||
|
__ movzxb(reg, reg);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
__ movzxw(reg, reg);
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
// Address is in |reg|.
|
||||||
|
__ lea(tmp, Operand(reg, 4));
|
||||||
|
emitCheckAddress(tmp);
|
||||||
|
__ movl(Operand(reg, 4), 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
error_= SP_ERROR_INVALID_INSTRUCTION;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case OP_ABS_F32:
|
case OP_ABS_F32:
|
||||||
__ movl(pri, Operand(stk, 0));
|
__ movl(pri, Operand(stk, 0));
|
||||||
__ andl(pri, 0x7fffffff);
|
__ andl(pri, 0x7fffffff);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user