//     OPCODE        negated   swaped    sign   float  arity, flags

OPCODE(BADOP,        BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)

/* Entry */
OPCODE(ENTRY,        BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)

/* Terminator */
OPCODE(RET,          BADOP,    BADOP,    BADOP, BADOP, 1, OPF_NONE)
OPCODE(BR,           BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(CBR,          BADOP,    BADOP,    BADOP, BADOP, 1, OPF_NONE)
OPCODE(SWITCH,       BADOP,    BADOP,    BADOP, BADOP, 1, OPF_NONE)
OPCODE(UNREACH,      BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(COMPUTEDGOTO, BADOP,    BADOP,    BADOP, BADOP, 1, OPF_NONE)
OPCODE_RANGE(TERMINATOR, RET, COMPUTEDGOTO)

/* Binary */
OPCODE(ADD,          BADOP,    BADOP,    BADOP, FADD,  2, OPF_TARGET|OPF_COMMU|OPF_ASSOC|OPF_BINOP)
OPCODE(MUL,          BADOP,    BADOP,    BADOP, FMUL,  2, OPF_TARGET|OPF_COMMU|OPF_ASSOC|OPF_BINOP)
OPCODE(SUB,          BADOP,    BADOP,    BADOP, FSUB,  2, OPF_TARGET|OPF_BINOP)
OPCODE(DIVU,         BADOP,    BADOP,    DIVS,  FDIV,  2, OPF_TARGET|OPF_BINOP)
OPCODE(DIVS,         BADOP,    BADOP,    DIVU,  FDIV,  2, OPF_TARGET|OPF_BINOP)
OPCODE(MODU,         BADOP,    BADOP,    MODS,  BADOP, 2, OPF_TARGET|OPF_BINOP)
OPCODE(MODS,         BADOP,    BADOP,    MODU,  BADOP, 2, OPF_TARGET|OPF_BINOP)
OPCODE(LSR,          BADOP,    BADOP,    ASR,   BADOP, 2, OPF_TARGET|OPF_BINOP)
OPCODE(ASR,          BADOP,    BADOP,    LSR,   BADOP, 2, OPF_TARGET|OPF_BINOP)
OPCODE(SHL,          BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET|OPF_BINOP)

/* Floating-point binops */
OPCODE(FADD,         BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FSUB,         BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FMUL,         BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FDIV,         BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET)

/* Logical */
OPCODE(AND,          BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET|OPF_COMMU|OPF_ASSOC|OPF_BINOP)
OPCODE(OR,           BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET|OPF_COMMU|OPF_ASSOC|OPF_BINOP)
OPCODE(XOR,          BADOP,    BADOP,    BADOP, BADOP, 2, OPF_TARGET|OPF_COMMU|OPF_ASSOC|OPF_BINOP)
OPCODE_RANGE(BINARY, ADD, XOR)

/* floating-point comparison */
OPCODE(FCMP_ORD,     FCMP_UNO, FCMP_ORD, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_OEQ,     FCMP_UNE, FCMP_OEQ, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_ONE,     FCMP_UEQ, FCMP_ONE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_UEQ,     FCMP_ONE, FCMP_UEQ, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_UNE,     FCMP_OEQ, FCMP_UNE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_OLT,     FCMP_UGE, FCMP_OGT, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_OLE,     FCMP_UGT, FCMP_OGE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_OGE,     FCMP_ULT, FCMP_OLE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_OGT,     FCMP_ULE, FCMP_OLT, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_ULT,     FCMP_OGE, FCMP_UGT, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_ULE,     FCMP_OGT, FCMP_UGE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_UGE,     FCMP_OLT, FCMP_ULE, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_UGT,     FCMP_OLE, FCMP_ULT, BADOP, BADOP, 2, OPF_TARGET)
OPCODE(FCMP_UNO,     FCMP_ORD, FCMP_UNO, BADOP, BADOP, 2, OPF_TARGET)
OPCODE_RANGE(FPCMP, FCMP_ORD, FCMP_UNO)

/* Binary comparison */
OPCODE(SET_EQ,       SET_NE,   SET_EQ,  SET_EQ, FCMP_OEQ, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_COMMU)
OPCODE(SET_LT,       SET_GE,   SET_GT,  SET_B,  FCMP_OLT, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_SIGNED)
OPCODE(SET_LE,       SET_GT,   SET_GE,  SET_BE, FCMP_OLE, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_SIGNED)
OPCODE(SET_GE,       SET_LT,   SET_LE,  SET_AE, FCMP_OGE, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_SIGNED)
OPCODE(SET_GT,       SET_LE,   SET_LT,  SET_A,  FCMP_OGT, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_SIGNED)
OPCODE(SET_B,        SET_AE,   SET_A,   SET_LT, FCMP_OLT, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_UNSIGNED)
OPCODE(SET_BE,       SET_A,    SET_AE,  SET_LE, FCMP_OLE, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_UNSIGNED)
OPCODE(SET_AE,       SET_B,    SET_BE,  SET_GE, FCMP_OGE, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_UNSIGNED)
OPCODE(SET_A,        SET_BE,   SET_B,   SET_GT, FCMP_OGT, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_UNSIGNED)
OPCODE(SET_NE,       SET_EQ,   SET_NE,  SET_NE, FCMP_UNE, 2, OPF_TARGET|OPF_BINOP|OPF_COMPARE|OPF_COMMU)
OPCODE_RANGE(BINCMP, SET_EQ, SET_NE)

/* Uni */
OPCODE(NOT,          BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET|OPF_UNOP)
OPCODE(NEG,          BADOP,    BADOP,    BADOP, FNEG,  1, OPF_TARGET|OPF_UNOP)
OPCODE(FNEG,         BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(TRUNC,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(ZEXT,         BADOP,    BADOP,    SEXT,  BADOP, 1, OPF_TARGET)
OPCODE(SEXT,         BADOP,    BADOP,    ZEXT,  BADOP, 1, OPF_TARGET)
OPCODE(FCVTU,        BADOP,    BADOP,    FCVTS, BADOP, 1, OPF_TARGET)
OPCODE(FCVTS,        BADOP,    BADOP,    FCVTU, BADOP, 1, OPF_TARGET)
OPCODE(UCVTF,        BADOP,    BADOP,    SCVTF, BADOP, 1, OPF_TARGET)
OPCODE(SCVTF,        BADOP,    BADOP,    UCVTF, BADOP, 1, OPF_TARGET)
OPCODE(FCVTF,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(UTPTR,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(PTRTU,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(PTRCAST,      BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE_RANGE(UNOP, NOT, PTRCAST)
OPCODE(SYMADDR,      BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(SLICE,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)

/* Select - three input values */
OPCODE(SEL,          BADOP,    BADOP,    BADOP, BADOP, 3, OPF_TARGET)
OPCODE(FMADD,        BADOP,    BADOP,    BADOP, BADOP, 3, OPF_TARGET)

/* Memory */
OPCODE(LOAD,         BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(STORE,        BADOP,    BADOP,    BADOP, BADOP, 1, OPF_NONE)

/* Other */
OPCODE(PHISOURCE,    BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(PHI,          BADOP,    BADOP,    BADOP, BADOP, 0, OPF_TARGET)
OPCODE(LABEL,        BADOP,    BADOP,    BADOP, BADOP, 0, OPF_TARGET)
OPCODE(SETVAL,       BADOP,    BADOP,    BADOP, BADOP, 0, OPF_TARGET)
OPCODE(SETFVAL,      BADOP,    BADOP,    BADOP, BADOP, 0, OPF_TARGET)
OPCODE(CALL,         BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
OPCODE(INLINED_CALL, BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(NOP,          BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(DEATHNOTE,    BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(ASM,          BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)

/* Sparse tagging (line numbers, context, whatever) */
OPCODE(CONTEXT,      BADOP,    BADOP,    BADOP, BADOP, 0, OPF_NONE)
OPCODE(RANGE,        BADOP,    BADOP,    BADOP, BADOP, 3, OPF_NONE)

/* Needed to translate SSA back to normal form */
OPCODE(COPY,         BADOP,    BADOP,    BADOP, BADOP, 1, OPF_TARGET)
