diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 20:40:55 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 20:50:28 +0000 |
commit | 0975d924938a3500380b22395b3262053f720ee2 (patch) | |
tree | af284af75e63950aacce4b45d216f42b311254b5 /vm/inst.h | |
parent | 7ca8f2c6445a902c681f4b871d15e0eda3724895 (diff) | |
download | ovm-0975d924938a3500380b22395b3262053f720ee2.tar.gz ovm-0975d924938a3500380b22395b3262053f720ee2.tar.bz2 ovm-0975d924938a3500380b22395b3262053f720ee2.zip |
Introduced new instructions for comparison
Comparing signed and unsigned versions of numbers. Same for EQ as
well.
Notice the irregular pattern of BYTE, CHAR, INT, HWORD,LONG,WORD as
OPCODE_IS_TYPE requires the subcodes to be surrounded by BYTE and
WORD.
Diffstat (limited to 'vm/inst.h')
-rw-r--r-- | vm/inst.h | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -62,17 +62,44 @@ typedef enum OP_XOR_WORD, OP_EQ_BYTE, + OP_EQ_CHAR, OP_EQ_HWORD, + OP_EQ_INT, + OP_EQ_LONG, OP_EQ_WORD, // Mathematical operations + OP_LT_BYTE, + OP_LT_CHAR, + OP_LT_HWORD, + OP_LT_INT, + OP_LT_LONG, + OP_LT_WORD, + OP_LTE_BYTE, + OP_LTE_CHAR, + OP_LTE_HWORD, + OP_LTE_INT, + OP_LTE_LONG, + OP_LTE_WORD, + OP_GT_BYTE, + OP_GT_CHAR, + OP_GT_HWORD, + OP_GT_INT, + OP_GT_LONG, + OP_GT_WORD, + OP_GTE_BYTE, + OP_GTE_CHAR, + OP_GTE_HWORD, + OP_GTE_INT, + OP_GTE_LONG, + OP_GTE_WORD, OP_PLUS_BYTE, OP_PLUS_HWORD, OP_PLUS_WORD, // Simple I/O - OP_PRINT_CHAR, OP_PRINT_BYTE, + OP_PRINT_CHAR, OP_PRINT_INT, OP_PRINT_HWORD, OP_PRINT_LONG, @@ -143,6 +170,10 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_AND(TYPE) ((inst_t){.opcode = OP_AND_##TYPE}) #define INST_XOR(TYPE) ((inst_t){.opcode = OP_XOR_##TYPE}) #define INST_EQ(TYPE) ((inst_t){.opcode = OP_EQ_##TYPE}) +#define INST_LT(TYPE) ((inst_t){.opcode = OP_LT_##TYPE}) +#define INST_LTE(TYPE) ((inst_t){.opcode = OP_LTE_##TYPE}) +#define INST_GT(TYPE) ((inst_t){.opcode = OP_GT_##TYPE}) +#define INST_GTE(TYPE) ((inst_t){.opcode = OP_GTE_##TYPE}) #define INST_PLUS(TYPE) ((inst_t){.opcode = OP_PLUS_##TYPE}) #define INST_JUMP_ABS(OP) \ |