2.4.1.5 Binary Operations

C Function: gcc_jit_rvalue *gcc_jit_context_new_binary_op (gcc_jit_context *ctxt, gcc_jit_location *loc, enum gcc_jit_binary_op op, gcc_jit_type *result_type, gcc_jit_rvalue *a, gcc_jit_rvalue *b)

Build a binary operation out of two constituent rvalues.

The parameter result_type must be a numeric type.

C Type: enum gcc_jit_binary_op

The available binary operations are:

Binary OperationC equivalent
GCC_JIT_BINARY_OP_PLUSx + y
GCC_JIT_BINARY_OP_MINUSx - y
GCC_JIT_BINARY_OP_MULTx * y
GCC_JIT_BINARY_OP_DIVIDEx / y
GCC_JIT_BINARY_OP_MODULOx % y
GCC_JIT_BINARY_OP_BITWISE_ANDx & y
GCC_JIT_BINARY_OP_BITWISE_XORx ^ y
GCC_JIT_BINARY_OP_BITWISE_ORx | y
GCC_JIT_BINARY_OP_LOGICAL_ANDx && y
GCC_JIT_BINARY_OP_LOGICAL_ORx || y
GCC_JIT_BINARY_OP_LSHIFTx << y
GCC_JIT_BINARY_OP_RSHIFTx >> y
C Macro: GCC_JIT_BINARY_OP_PLUS

Addition of arithmetic values; analogous to:

(EXPR_A) + (EXPR_B)

in C.

For pointer addition, use gcc_jit_context_new_array_access().

C Macro: GCC_JIT_BINARY_OP_MINUS

Subtraction of arithmetic values; analogous to:

(EXPR_A) - (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_MULT

Multiplication of a pair of arithmetic values; analogous to:

(EXPR_A) * (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_DIVIDE

Quotient of division of arithmetic values; analogous to:

(EXPR_A) / (EXPR_B)

in C.

The result type affects the kind of division: if the result type is integer-based, then the result is truncated towards zero, whereas a floating-point result type indicates floating-point division.

C Macro: GCC_JIT_BINARY_OP_MODULO

Remainder of division of arithmetic values; analogous to:

(EXPR_A) % (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_BITWISE_AND

Bitwise AND; analogous to:

(EXPR_A) & (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_BITWISE_XOR

Bitwise exclusive OR; analogous to:

(EXPR_A) ^ (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_BITWISE_OR

Bitwise inclusive OR; analogous to:

(EXPR_A) | (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_LOGICAL_AND

Logical AND; analogous to:

(EXPR_A) && (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_LOGICAL_OR

Logical OR; analogous to:

(EXPR_A) || (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_LSHIFT

Left shift; analogous to:

(EXPR_A) << (EXPR_B)

in C.

C Macro: GCC_JIT_BINARY_OP_RSHIFT

Right shift; analogous to:

(EXPR_A) >> (EXPR_B)

in C.