NIR ALU Instructions

ALU instructions represent simple operations, such as addition, multiplication, comparison, etc., that take a certain number of arguments and return a result that only depends on the arguments. ALU instructions in NIR must be pure in the sense that they have no side effect and that identical inputs yields an identical output. A good rule of thumb is that only things which can be constant folded should be ALU operations. If it can’t be constant folded, then it should probably be an intrinsic instead.

Each ALU instruction has an opcode, which is a member of the nir_op enum, that describes what it does as well as how many arguments it takes. Associated with each opcode is an metadata structure, nir_op_info, which shows how many arguments the opcode takes, information about data types, and algebraic properties such as associativity and commutativity. The info structure for each opcode may be accessed through a global nir_op_infos array that’s indexed by the opcode.

ALU operations are typeless, meaning that they’re only defined to convert a certain bit-pattern input to another bit-pattern output. The only concrete notion of types for a NIR SSA value or register is that each value has a number of vector components and a bit-size. How that data is interpreted is entirely controlled by the opcode. NIR doesn’t have opcodes for intBitsToFloat() and friends because they are implicit.

Even though ALU operations are typeless, each opcode also has an “ALU type” metadata for each of the sources and the destination which can be floating-point, boolean, integer, or unsigned integer. The ALU type mainly helps back-ends which want to handle all conversion instructions, for instance, in a single switch case. They’re also important when a back-end requests the absolute value, negate, and saturate modifiers (not used by core NIR). In that case, modifiers are interpreted with respect to the ALU type on the source or destination of the instruction. In addition, if an operation takes a boolean argument, then the argument may be assumed to be either 0 for false or ~0 (a.k.a -1) for true even if it is not a 1-bit value. If an operation’s result has a boolean type, then it may only produce only 0 or ~0.

Most of the common ALU ops in NIR operate per-component, meaning that the operation is defined by what it does on a single scalar value and, when performed on vectors, it performs the same operation on each component. Things like add, multiply, etc. fall into this category. Per-component operations naturally scale to as many components as necessary. Non-per-component ALU ops are things like vec4 or pack_64_2x32 where any given component in the result value may be a combination of any component in any source. These ops have a number of destination components and a number of components required by each source which is fixed by the opcode.

While most instruction types in NIR require vector sizes to perfectly match on inputs and outputs, ALU instruction sources have an additional nir_alu_src.swizzle field which allows them to act on vectors which are not the native vector size of the instruction. This is ideal for hardware with a native data type of vec4 but also means that ALU instructions are often used (and required) for packing/unpacking vectors for use in other instruction types like intrinsics or texture ops.

struct nir_op_info
const char *name

Name of the NIR ALU opcode

uint8_t num_inputs

Number of inputs (sources)

uint8_t output_size

The number of components in the output

If non-zero, this is the size of the output and input sizes are explicitly given; swizzle and writemask are still in effect, but if the output component is masked out, then the input component may still be in use.

If zero, the opcode acts in the standard, per-component manner; the operation is performed on each component (except the ones that are masked out) with the input being taken from the input swizzle for that component.

The size of some of the inputs may be given (i.e. non-zero) even though output_size is zero; in that case, the inputs with a zero size act per-component, while the inputs with non-zero size don’t.

nir_alu_type output_type

The type of vector that the instruction outputs.

uint8_t input_sizes[NIR_ALU_MAX_INPUTS]

The number of components in each input

See nir_op_infos::output_size for more detail about the relationship between input and output sizes.

nir_alu_type input_types[NIR_ALU_MAX_INPUTS]

The type of vector that each input takes.

nir_op_algebraic_property algebraic_properties

Algebraic properties of this opcode

bool is_conversion

Whether this represents a numeric conversion opcode

extern const nir_op_info nir_op_infos[nir_num_opcodes]

Metadata for each nir_op, indexed by opcode

struct nir_alu_instr
nir_instr instr

Base instruction

nir_op op

Opcode

bool exact

Indicates that this ALU instruction generates an exact value

This is kind of a mixture of GLSL “precise” and “invariant” and not really equivalent to either. This indicates that the value generated by this operation is high-precision and any code transformations that touch it must ensure that the resulting value is bit-for-bit identical to the original.

bool no_signed_wrap

Indicates that this instruction doese not cause signed integer wrapping to occur, in the form of overflow or underflow.

bool no_unsigned_wrap

Indicates that this instruction does not cause unsigned integer wrapping to occur, in the form of overflow or underflow.

uint32_t fp_fast_math

The float controls bit float_controls2 cares about. That is, NAN/INF/SIGNED_ZERO_PRESERVE only. Allow{Contract,Reassoc,Transform} are still handled through the exact bit, and the other float controls bits (rounding mode and denorm handling) remain in the execution mode only.

nir_def def

Destination

nir_alu_src src[]

Sources

The size of the array is given by nir_op_info.num_inputs.

struct nir_alu_src
nir_src src

Base source

uint8_t swizzle[NIR_MAX_VEC_COMPONENTS]

For each input component, says which component of the register it is chosen from.

Note that which elements of the swizzle are used and which are ignored are based on the write mask for most opcodes - for example, a statement like “foo.xzw = bar.zyx” would have a writemask of 1101b and a swizzle of {2, 1, x, 0} where x means “don’t care.”

NIR ALU Opcode Reference:

mov(uint[N] src0) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_mov(nir_builder*, nir_def *src0)
ineg(int[N] src0) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 == u_intN_min(bit_size) ? src0 : -src0

Builder function:

nir_def *nir_ineg(nir_builder*, nir_def *src0)
fneg(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

-src0

Builder function:

nir_def *nir_fneg(nir_builder*, nir_def *src0)
inot(int[N] src0) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Invert every bit of the integer

Constant-folding:

~src0

Builder function:

nir_def *nir_inot(nir_builder*, nir_def *src0)
fsign(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Roughly implements the OpenGL / Vulkan rules for sign(float). The GLSL.std.450 FSign instruction is defined as:

Result is 1.0 if x > 0, 0.0 if x = 0, or -1.0 if x < 0.

If the source is equal to zero, there is a preference for the result to have the same sign, but this is not required (it is required by OpenCL). If the source is not a number, there is a preference for the result to be +0.0, but this is not required (it is required by OpenCL). If the source is not a number, and the result is not +0.0, the result should definitely not be NaN.

The values returned for constant folding match the behavior required by OpenCL.

Constant-folding:

bit_size == 64 ? (isnan(src0) ? 0.0  : ((src0 == 0.0 ) ? src0 : (src0 > 0.0 ) ? 1.0  : -1.0 )) : (isnan(src0) ? 0.0f : ((src0 == 0.0f) ? src0 : (src0 > 0.0f) ? 1.0f : -1.0f))

Builder function:

nir_def *nir_fsign(nir_builder*, nir_def *src0)
isign(int[N] src0) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 == 0) ? 0 : ((src0 > 0) ? 1 : -1)

Builder function:

nir_def *nir_isign(nir_builder*, nir_def *src0)
iabs(int[N] src0) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 < 0) ? -src0 : src0

Builder function:

nir_def *nir_iabs(nir_builder*, nir_def *src0)
fabs(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

fabs(src0)

Builder function:

nir_def *nir_fabs(nir_builder*, nir_def *src0)
fsat(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

fmin(fmax(src0, 0.0), 1.0)

Builder function:

nir_def *nir_fsat(nir_builder*, nir_def *src0)
frcp(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? 1.0 / src0 : 1.0f / src0

Builder function:

nir_def *nir_frcp(nir_builder*, nir_def *src0)
frsq(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? 1.0 / sqrt(src0) : 1.0f / sqrtf(src0)

Builder function:

nir_def *nir_frsq(nir_builder*, nir_def *src0)
fsqrt(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? sqrt(src0) : sqrtf(src0)

Builder function:

nir_def *nir_fsqrt(nir_builder*, nir_def *src0)
fexp2(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

exp2f(src0)

Builder function:

nir_def *nir_fexp2(nir_builder*, nir_def *src0)
flog2(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

log2f(src0)

Builder function:

nir_def *nir_flog2(nir_builder*, nir_def *src0)
i2f16(int[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2f16(nir_builder*, nir_def *src0)
i2f32(int[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2f32(nir_builder*, nir_def *src0)
i2f64(int[N] src0) float64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2f64(nir_builder*, nir_def *src0)
i2i1(int[N] src0) int1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2i1(nir_builder*, nir_def *src0)
i2i8(int[N] src0) int8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2i8(nir_builder*, nir_def *src0)
i2i16(int[N] src0) int16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2i16(nir_builder*, nir_def *src0)
i2i32(int[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2i32(nir_builder*, nir_def *src0)
i2i64(int[N] src0) int64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_i2i64(nir_builder*, nir_def *src0)
u2f16(uint[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2f16(nir_builder*, nir_def *src0)
u2f32(uint[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2f32(nir_builder*, nir_def *src0)
u2f64(uint[N] src0) float64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2f64(nir_builder*, nir_def *src0)
u2u1(uint[N] src0) uint1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2u1(nir_builder*, nir_def *src0)
u2u8(uint[N] src0) uint8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2u8(nir_builder*, nir_def *src0)
u2u16(uint[N] src0) uint16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2u16(nir_builder*, nir_def *src0)
u2u32(uint[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2u32(nir_builder*, nir_def *src0)
u2u64(uint[N] src0) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_u2u64(nir_builder*, nir_def *src0)
f2i1(float[N] src0) int1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2i1(nir_builder*, nir_def *src0)
f2i8(float[N] src0) int8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2i8(nir_builder*, nir_def *src0)
f2i16(float[N] src0) int16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2i16(nir_builder*, nir_def *src0)
f2i32(float[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2i32(nir_builder*, nir_def *src0)
f2i64(float[N] src0) int64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2i64(nir_builder*, nir_def *src0)
f2u1(float[N] src0) uint1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2u1(nir_builder*, nir_def *src0)
f2u8(float[N] src0) uint8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2u8(nir_builder*, nir_def *src0)
f2u16(float[N] src0) uint16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2u16(nir_builder*, nir_def *src0)
f2u32(float[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2u32(nir_builder*, nir_def *src0)
f2u64(float[N] src0) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2u64(nir_builder*, nir_def *src0)
f2f16_rtne(float[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

if (bit_size > 32) {
   dst = _mesa_half_to_float(_mesa_double_to_float16_rtne(src0));
} else if (bit_size > 16) {
   dst = _mesa_half_to_float(_mesa_float_to_float16_rtne(src0));
} else {
   dst = src0;
}

Builder function:

nir_def *nir_f2f16_rtne(nir_builder*, nir_def *src0)
f2f16_rtz(float[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

if (bit_size > 32) {
   dst = _mesa_half_to_float(_mesa_double_to_float16_rtz(src0));
} else if (bit_size > 16) {
   dst = _mesa_half_to_float(_mesa_float_to_float16_rtz(src0));
} else {
   dst = src0;
}

Builder function:

nir_def *nir_f2f16_rtz(nir_builder*, nir_def *src0)
f2f16(float[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

if (bit_size > 32) {
   if (nir_is_rounding_mode_rtz(execution_mode, 16))
      dst = _mesa_half_to_float(_mesa_double_to_float16_rtz(src0));
   else
      dst = _mesa_half_to_float(_mesa_double_to_float16_rtne(src0));
} else if (bit_size > 16) {
   if (nir_is_rounding_mode_rtz(execution_mode, 16))
      dst = _mesa_half_to_float(_mesa_float_to_float16_rtz(src0));
   else
      dst = _mesa_half_to_float(_mesa_float_to_float16_rtne(src0));
} else {
   dst = src0;
}

Builder function:

nir_def *nir_f2f16(nir_builder*, nir_def *src0)
f2f32(float[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

if (bit_size > 32 && nir_is_rounding_mode_rtz(execution_mode, 32)) {
   dst = _mesa_double_to_float_rtz(src0);
} else {
   dst = src0;
}

Builder function:

nir_def *nir_f2f32(nir_builder*, nir_def *src0)
f2f64(float[N] src0) float64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_f2f64(nir_builder*, nir_def *src0)
b2f16(bool[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2f16(nir_builder*, nir_def *src0)
b2f32(bool[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2f32(nir_builder*, nir_def *src0)
b2f64(bool[N] src0) float64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2f64(nir_builder*, nir_def *src0)
b2i1(bool[N] src0) int1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2i1(nir_builder*, nir_def *src0)
b2i8(bool[N] src0) int8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2i8(nir_builder*, nir_def *src0)
b2i16(bool[N] src0) int16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2i16(nir_builder*, nir_def *src0)
b2i32(bool[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2i32(nir_builder*, nir_def *src0)
b2i64(bool[N] src0) int64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_b2i64(nir_builder*, nir_def *src0)
b2b1(bool[N] src0) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 != 0

Builder function:

nir_def *nir_b2b1(nir_builder*, nir_def *src0)
b2b8(bool[N] src0) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 != 0

Builder function:

nir_def *nir_b2b8(nir_builder*, nir_def *src0)
b2b16(bool[N] src0) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 != 0

Builder function:

nir_def *nir_b2b16(nir_builder*, nir_def *src0)
b2b32(bool[N] src0) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 != 0

Builder function:

nir_def *nir_b2b32(nir_builder*, nir_def *src0)
f2fmp(float32[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as f2f16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

if (bit_size > 32) {
   if (nir_is_rounding_mode_rtz(execution_mode, 16))
      dst = _mesa_half_to_float(_mesa_double_to_float16_rtz(src0));
   else
      dst = _mesa_half_to_float(_mesa_double_to_float16_rtne(src0));
} else if (bit_size > 16) {
   if (nir_is_rounding_mode_rtz(execution_mode, 16))
      dst = _mesa_half_to_float(_mesa_float_to_float16_rtz(src0));
   else
      dst = _mesa_half_to_float(_mesa_float_to_float16_rtne(src0));
} else {
   dst = src0;
}

Builder function:

nir_def *nir_f2fmp(nir_builder*, nir_def *src0)
i2imp(int32[N] src0) int16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as i2i16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

src0

Builder function:

nir_def *nir_i2imp(nir_builder*, nir_def *src0)
f2imp(float32[N] src0) int16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as f2i16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

src0

Builder function:

nir_def *nir_f2imp(nir_builder*, nir_def *src0)
f2ump(float32[N] src0) uint16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as f2u16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

src0

Builder function:

nir_def *nir_f2ump(nir_builder*, nir_def *src0)
i2fmp(int32[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as i2f16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

src0

Builder function:

nir_def *nir_i2fmp(nir_builder*, nir_def *src0)
u2fmp(uint32[N] src0) float16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Special opcode that is the same as u2f16 except that it is safe to remove it if the result is immediately converted back to 32 bits again. This is generated as part of the precision lowering pass. mp stands for medium precision.

Constant-folding:

src0

Builder function:

nir_def *nir_u2fmp(nir_builder*, nir_def *src0)
ftrunc(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? trunc(src0) : truncf(src0)

Builder function:

nir_def *nir_ftrunc(nir_builder*, nir_def *src0)
fceil(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? ceil(src0) : ceilf(src0)

Builder function:

nir_def *nir_fceil(nir_builder*, nir_def *src0)
ffloor(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? floor(src0) : floorf(src0)

Builder function:

nir_def *nir_ffloor(nir_builder*, nir_def *src0)
ffract(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 - (bit_size == 64 ? floor(src0) : floorf(src0))

Builder function:

nir_def *nir_ffract(nir_builder*, nir_def *src0)
fround_even(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? _mesa_roundeven(src0) : _mesa_roundevenf(src0)

Builder function:

nir_def *nir_fround_even(nir_builder*, nir_def *src0)
fquantize2f16(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(fabs(src0) < ldexpf(1.0, -14)) ? copysignf(0.0f, src0) : _mesa_half_to_float(_mesa_float_to_half(src0))

Builder function:

nir_def *nir_fquantize2f16(nir_builder*, nir_def *src0)
fsin(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? sin(src0) : sinf(src0)

Builder function:

nir_def *nir_fsin(nir_builder*, nir_def *src0)
fcos(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? cos(src0) : cosf(src0)

Builder function:

nir_def *nir_fcos(nir_builder*, nir_def *src0)
frexp_exp(float[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

frexp(src0, &dst);

Builder function:

nir_def *nir_frexp_exp(nir_builder*, nir_def *src0)
frexp_sig(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

int n; dst = frexp(src0, &n);

Builder function:

nir_def *nir_frexp_sig(nir_builder*, nir_def *src0)
pack_snorm_2x16(float[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (uint32_t) pack_snorm_1x16(src0.x);
dst.x |= ((uint32_t) pack_snorm_1x16(src0.y)) << 16;

Builder function:

nir_def *nir_pack_snorm_2x16(nir_builder*, nir_def *src0)
pack_snorm_4x8(float32[4] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (uint32_t) pack_snorm_1x8(src0.x);
dst.x |= ((uint32_t) pack_snorm_1x8(src0.y)) << 8;
dst.x |= ((uint32_t) pack_snorm_1x8(src0.z)) << 16;
dst.x |= ((uint32_t) pack_snorm_1x8(src0.w)) << 24;

Builder function:

nir_def *nir_pack_snorm_4x8(nir_builder*, nir_def *src0)
pack_unorm_2x16(float[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (uint32_t) pack_unorm_1x16(src0.x);
dst.x |= ((uint32_t) pack_unorm_1x16(src0.y)) << 16;

Builder function:

nir_def *nir_pack_unorm_2x16(nir_builder*, nir_def *src0)
pack_unorm_4x8(float32[4] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (uint32_t) pack_unorm_1x8(src0.x);
dst.x |= ((uint32_t) pack_unorm_1x8(src0.y)) << 8;
dst.x |= ((uint32_t) pack_unorm_1x8(src0.z)) << 16;
dst.x |= ((uint32_t) pack_unorm_1x8(src0.w)) << 24;

Builder function:

nir_def *nir_pack_unorm_4x8(nir_builder*, nir_def *src0)
pack_half_2x16(float32[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (uint32_t) pack_half_1x16(src0.x);
dst.x |= ((uint32_t) pack_half_1x16(src0.y)) << 16;

Builder function:

nir_def *nir_pack_half_2x16(nir_builder*, nir_def *src0)
unpack_snorm_2x16(uint32[1] src0) float32[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = unpack_snorm_1x16((uint16_t)(src0.x & 0xffff));
dst.y = unpack_snorm_1x16((uint16_t)(src0.x << 16));

Builder function:

nir_def *nir_unpack_snorm_2x16(nir_builder*, nir_def *src0)
unpack_snorm_4x8(uint32[1] src0) float32[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = unpack_snorm_1x8((uint8_t)(src0.x & 0xff));
dst.y = unpack_snorm_1x8((uint8_t)((src0.x >> 8) & 0xff));
dst.z = unpack_snorm_1x8((uint8_t)((src0.x >> 16) & 0xff));
dst.w = unpack_snorm_1x8((uint8_t)(src0.x >> 24));

Builder function:

nir_def *nir_unpack_snorm_4x8(nir_builder*, nir_def *src0)
unpack_unorm_2x16(uint32[1] src0) float32[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = unpack_unorm_1x16((uint16_t)(src0.x & 0xffff));
dst.y = unpack_unorm_1x16((uint16_t)(src0.x << 16));

Builder function:

nir_def *nir_unpack_unorm_2x16(nir_builder*, nir_def *src0)
unpack_unorm_4x8(uint32[1] src0) float32[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = unpack_unorm_1x8((uint8_t)(src0.x & 0xff));
dst.y = unpack_unorm_1x8((uint8_t)((src0.x >> 8) & 0xff));
dst.z = unpack_unorm_1x8((uint8_t)((src0.x >> 16) & 0xff));
dst.w = unpack_unorm_1x8((uint8_t)(src0.x >> 24));

Builder function:

nir_def *nir_unpack_unorm_4x8(nir_builder*, nir_def *src0)
pack_uint_2x16(uint32[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Convert two unsigned integers into a packed unsigned short (clamp is applied).

Constant-folding:

dst.x = _mesa_unsigned_to_unsigned(src0.x, 16);
dst.x |= _mesa_unsigned_to_unsigned(src0.y, 16) << 16;

Builder function:

nir_def *nir_pack_uint_2x16(nir_builder*, nir_def *src0)
pack_sint_2x16(int32[2] src0) int32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Convert two signed integers into a packed signed short (clamp is applied).

Constant-folding:

dst.x = _mesa_signed_to_signed(src0.x, 16) & 0xffff;
dst.x |= _mesa_signed_to_signed(src0.y, 16) << 16;

Builder function:

nir_def *nir_pack_sint_2x16(nir_builder*, nir_def *src0)
pack_uvec2_to_uint(uint32[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (src0.x & 0xffff) | (src0.y << 16);

Builder function:

nir_def *nir_pack_uvec2_to_uint(nir_builder*, nir_def *src0)
pack_uvec4_to_uint(uint32[4] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = (src0.x <<  0) |
        (src0.y <<  8) |
        (src0.z << 16) |
        (src0.w << 24);

Builder function:

nir_def *nir_pack_uvec4_to_uint(nir_builder*, nir_def *src0)
pack_32_4x8(uint8[4] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x | ((uint32_t)src0.y << 8) | ((uint32_t)src0.z << 16) | ((uint32_t)src0.w << 24);

Builder function:

nir_def *nir_pack_32_4x8(nir_builder*, nir_def *src0)
pack_32_2x16(uint16[2] src0) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x | ((uint32_t)src0.y << 16);

Builder function:

nir_def *nir_pack_32_2x16(nir_builder*, nir_def *src0)
pack_64_2x32(uint32[2] src0) uint64[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x | ((uint64_t)src0.y << 32);

Builder function:

nir_def *nir_pack_64_2x32(nir_builder*, nir_def *src0)
pack_64_4x16(uint16[4] src0) uint64[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x | ((uint64_t)src0.y << 16) | ((uint64_t)src0.z << 32) | ((uint64_t)src0.w << 48);

Builder function:

nir_def *nir_pack_64_4x16(nir_builder*, nir_def *src0)
unpack_64_2x32(uint64[1] src0) uint32[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x; dst.y = src0.x >> 32;

Builder function:

nir_def *nir_unpack_64_2x32(nir_builder*, nir_def *src0)
unpack_64_4x16(uint64[1] src0) uint16[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x; dst.y = src0.x >> 16; dst.z = src0.x >> 32; dst.w = src0.x >> 48;

Builder function:

nir_def *nir_unpack_64_4x16(nir_builder*, nir_def *src0)
unpack_32_2x16(uint32[1] src0) uint16[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x; dst.y = src0.x >> 16;

Builder function:

nir_def *nir_unpack_32_2x16(nir_builder*, nir_def *src0)
unpack_32_4x8(uint32[1] src0) uint8[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x; dst.y = src0.x >> 8; dst.z = src0.x >> 16; dst.w = src0.x >> 24;

Builder function:

nir_def *nir_unpack_32_4x8(nir_builder*, nir_def *src0)
unpack_half_2x16(uint32[1] src0) float32[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = unpack_half_1x16((uint16_t)(src0.x & 0xffff), nir_is_denorm_flush_to_zero(execution_mode, 16));
dst.y = unpack_half_1x16((uint16_t)(src0.x >> 16), nir_is_denorm_flush_to_zero(execution_mode, 16));

Builder function:

nir_def *nir_unpack_half_2x16(nir_builder*, nir_def *src0)
unpack_half_2x16_split_x(uint32[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

unpack_half_1x16((uint16_t)(src0 & 0xffff), nir_is_denorm_flush_to_zero(execution_mode, 16))

Builder function:

nir_def *nir_unpack_half_2x16_split_x(nir_builder*, nir_def *src0)
unpack_half_2x16_split_y(uint32[N] src0) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

unpack_half_1x16((uint16_t)(src0 >> 16), nir_is_denorm_flush_to_zero(execution_mode, 16))

Builder function:

nir_def *nir_unpack_half_2x16_split_y(nir_builder*, nir_def *src0)
unpack_32_2x16_split_x(uint32[N] src0) uint16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_unpack_32_2x16_split_x(nir_builder*, nir_def *src0)
unpack_32_2x16_split_y(uint32[N] src0) uint16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >> 16

Builder function:

nir_def *nir_unpack_32_2x16_split_y(nir_builder*, nir_def *src0)
unpack_64_2x32_split_x(uint64[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0

Builder function:

nir_def *nir_unpack_64_2x32_split_x(nir_builder*, nir_def *src0)
unpack_64_2x32_split_y(uint64[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >> 32

Builder function:

nir_def *nir_unpack_64_2x32_split_y(nir_builder*, nir_def *src0)
bitfield_reverse(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

/* we're not winning any awards for speed here, but that's ok */
dst = 0;
for (unsigned bit = 0; bit < 32; bit++)
   dst |= ((src0 >> bit) & 1) << (31 - bit);

Builder function:

nir_def *nir_bitfield_reverse(nir_builder*, nir_def *src0)
bit_count(uint[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = 0;
for (unsigned bit = 0; bit < bit_size; bit++) {
   if ((src0 >> bit) & 1)
      dst++;
}

Builder function:

nir_def *nir_bit_count(nir_builder*, nir_def *src0)
ufind_msb(uint[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = -1;
for (int bit = bit_size - 1; bit >= 0; bit--) {
   if ((src0 >> bit) & 1) {
      dst = bit;
      break;
   }
}

Builder function:

nir_def *nir_ufind_msb(nir_builder*, nir_def *src0)
ufind_msb_rev(uint[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = -1;
for (int bit = 0; bit < bit_size; bit++) {
   if ((src0 << bit) & 0x80000000) {
      dst = bit;
      break;
   }
}

Builder function:

nir_def *nir_ufind_msb_rev(nir_builder*, nir_def *src0)
uclz(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

int bit;
for (bit = bit_size - 1; bit >= 0; bit--) {
   if ((src0 & (1u << bit)) != 0)
      break;
}
dst = (unsigned)(bit_size - bit - 1);

Builder function:

nir_def *nir_uclz(nir_builder*, nir_def *src0)
ifind_msb(int32[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = -1;
for (int bit = bit_size - 1; bit >= 0; bit--) {
   /* If src0 < 0, we're looking for the first 0 bit.
    * if src0 >= 0, we're looking for the first 1 bit.
    */
   if ((((src0 >> bit) & 1) && (src0 >= 0)) ||
      (!((src0 >> bit) & 1) && (src0 < 0))) {
      dst = bit;
      break;
   }
}

Builder function:

nir_def *nir_ifind_msb(nir_builder*, nir_def *src0)
ifind_msb_rev(int32[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = -1;
/* We are looking for the highest bit that's not the same as the sign bit. */
uint32_t sign = src0 & 0x80000000u;
for (int bit = 0; bit < 32; bit++) {
   if (((src0 << bit) & 0x80000000u) != sign) {
      dst = bit;
      break;
   }
}

Builder function:

nir_def *nir_ifind_msb_rev(nir_builder*, nir_def *src0)
find_lsb(int[N] src0) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = -1;
for (unsigned bit = 0; bit < bit_size; bit++) {
   if ((src0 >> bit) & 1) {
      dst = bit;
      break;
   }
}

Builder function:

nir_def *nir_find_lsb(nir_builder*, nir_def *src0)
fsum2(float[2] src0) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Sum of vector components

Constant-folding:

((src0.x) + (src0.y))

Builder function:

nir_def *nir_fsum2(nir_builder*, nir_def *src0)
fsum3(float[3] src0) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Sum of vector components

Constant-folding:

((src0.x) + (src0.y) + (src0.z))

Builder function:

nir_def *nir_fsum3(nir_builder*, nir_def *src0)
fsum4(float[4] src0) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Sum of vector components

Constant-folding:

((src0.x) + (src0.y) + (src0.z) + (src0.w))

Builder function:

nir_def *nir_fsum4(nir_builder*, nir_def *src0)
fadd(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) {
   if (bit_size == 64)
      dst = _mesa_double_add_rtz(src0, src1);
   else
      dst = _mesa_double_to_float_rtz((double)src0 + (double)src1);
} else {
   dst = src0 + src1;
}

Builder function:

nir_def *nir_fadd(nir_builder*, nir_def *src0, nir_def *src1)
iadd(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

(uint64_t)src0 + (uint64_t)src1

Builder function:

nir_def *nir_iadd(nir_builder*, nir_def *src0, nir_def *src1)
iadd_sat(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src1 > 0 ?
   (src0 + src1 < src0 ? u_intN_max(bit_size) : src0 + src1) :
   (src0 < src0 + src1 ? u_intN_min(bit_size) : src0 + src1)

Builder function:

nir_def *nir_iadd_sat(nir_builder*, nir_def *src0, nir_def *src1)
uadd_sat(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 + src1) < src0 ? u_uintN_max(sizeof(src0) * 8) : (src0 + src1)

Builder function:

nir_def *nir_uadd_sat(nir_builder*, nir_def *src0, nir_def *src1)
isub_sat(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 < 0 ?
   (src0 - src1 < src0 ? u_intN_max(bit_size) : src0 - src1) :
   (src0 < src0 - src1 ? u_intN_min(bit_size) : src0 - src1)

Builder function:

nir_def *nir_isub_sat(nir_builder*, nir_def *src0, nir_def *src1)
usub_sat(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1 ? 0 : src0 - src1

Builder function:

nir_def *nir_usub_sat(nir_builder*, nir_def *src0, nir_def *src1)
fsub(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) {
   if (bit_size == 64)
      dst = _mesa_double_sub_rtz(src0, src1);
   else
      dst = _mesa_double_to_float_rtz((double)src0 - (double)src1);
} else {
   dst = src0 - src1;
}

Builder function:

nir_def *nir_fsub(nir_builder*, nir_def *src0, nir_def *src1)
isub(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 - src1

Builder function:

nir_def *nir_isub(nir_builder*, nir_def *src0, nir_def *src1)
uabs_isub(int[N] src0, int[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 > src0 ? (uint64_t) src1 - (uint64_t) src0
            : (uint64_t) src0 - (uint64_t) src1

Builder function:

nir_def *nir_uabs_isub(nir_builder*, nir_def *src0, nir_def *src1)
uabs_usub(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src1 > src0) ? (src1 - src0) : (src0 - src1)

Builder function:

nir_def *nir_uabs_usub(nir_builder*, nir_def *src0, nir_def *src1)
fmul(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) {
   if (bit_size == 64)
      dst = _mesa_double_mul_rtz(src0, src1);
   else
      dst = _mesa_double_to_float_rtz((double)src0 * (double)src1);
} else {
   dst = src0 * src1;
}

Builder function:

nir_def *nir_fmul(nir_builder*, nir_def *src0, nir_def *src1)
fmulz(float32[N] src0, float32[N] src1) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Unlike fmul, anything (even infinity or NaN) multiplied by zero is always zero. fmulz(0.0, inf) and fmulz(0.0, nan) must be +/-0.0, even if INF_PRESERVE/NAN_PRESERVE is not used. If SIGNED_ZERO_PRESERVE is used, then the result must be a positive zero if either operand is zero.

Constant-folding:

if (src0 == 0.0 || src1 == 0.0)
   dst = 0.0;
else if (nir_is_rounding_mode_rtz(execution_mode, 32))
   dst = _mesa_double_to_float_rtz((double)src0 * (double)src1);
else
   dst = src0 * src1;

Builder function:

nir_def *nir_fmulz(nir_builder*, nir_def *src0, nir_def *src1)
imul(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Low 32-bits of signed/unsigned integer multiply

Constant-folding:

/* Use 64-bit multiplies to prevent overflow of signed arithmetic */
dst = (uint64_t)src0 * (uint64_t)src1;

Builder function:

nir_def *nir_imul(nir_builder*, nir_def *src0, nir_def *src1)
imul_2x32_64(int32[N] src0, int32[N] src1) int64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: Multiply signed 32-bit integers, 64-bit result

Constant-folding:

(int64_t)src0 * (int64_t)src1

Builder function:

nir_def *nir_imul_2x32_64(nir_builder*, nir_def *src0, nir_def *src1)
umul_2x32_64(uint32[N] src0, uint32[N] src1) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: Multiply unsigned 32-bit integers, 64-bit result

Constant-folding:

(uint64_t)src0 * (uint64_t)src1

Builder function:

nir_def *nir_umul_2x32_64(nir_builder*, nir_def *src0, nir_def *src1)
imul_high(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: High 32-bits of signed integer multiply

Constant-folding:

if (bit_size == 64) {
   /* We need to do a full 128-bit x 128-bit multiply in order for the sign
    * extension to work properly.  The casts are kind-of annoying but needed
    * to prevent compiler warnings.
    */
   uint32_t src0_u32[4] = {
      src0,
      (int64_t)src0 >> 32,
      (int64_t)src0 >> 63,
      (int64_t)src0 >> 63,
   };
   uint32_t src1_u32[4] = {
      src1,
      (int64_t)src1 >> 32,
      (int64_t)src1 >> 63,
      (int64_t)src1 >> 63,
   };
   uint32_t prod_u32[4];
   ubm_mul_u32arr(prod_u32, src0_u32, src1_u32);
   dst = (uint64_t)prod_u32[2] | ((uint64_t)prod_u32[3] << 32);
} else {
   /* First, sign-extend to 64-bit, then convert to unsigned to prevent
    * potential overflow of signed multiply */
   dst = ((uint64_t)(int64_t)src0 * (uint64_t)(int64_t)src1) >> bit_size;
}

Builder function:

nir_def *nir_imul_high(nir_builder*, nir_def *src0, nir_def *src1)
umul_high(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: High 32-bits of unsigned integer multiply

Constant-folding:

if (bit_size == 64) {
   /* The casts are kind-of annoying but needed to prevent compiler warnings. */
   uint32_t src0_u32[2] = { src0, (uint64_t)src0 >> 32 };
   uint32_t src1_u32[2] = { src1, (uint64_t)src1 >> 32 };
   uint32_t prod_u32[4];
   ubm_mul_u32arr(prod_u32, src0_u32, src1_u32);
   dst = (uint64_t)prod_u32[2] | ((uint64_t)prod_u32[3] << 32);
} else {
   dst = ((uint64_t)src0 * (uint64_t)src1) >> bit_size;
}

Builder function:

nir_def *nir_umul_high(nir_builder*, nir_def *src0, nir_def *src1)
umul_low(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: Low 32-bits of unsigned integer multiply

Constant-folding:

uint64_t mask = (1 << (bit_size / 2)) - 1;
dst = ((uint64_t)src0 & mask) * ((uint64_t)src1 & mask);

Builder function:

nir_def *nir_umul_low(nir_builder*, nir_def *src0, nir_def *src1)
imul_32x16(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Multiply 32-bits with low 16-bits, with sign extension

Constant-folding:

src0 * (int16_t) src1

Builder function:

nir_def *nir_imul_32x16(nir_builder*, nir_def *src0, nir_def *src1)
umul_32x16(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Multiply 32-bits with low 16-bits, with zero extension

Constant-folding:

src0 * (uint16_t) src1

Builder function:

nir_def *nir_umul_32x16(nir_builder*, nir_def *src0, nir_def *src1)
fdiv(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 / src1

Builder function:

nir_def *nir_fdiv(nir_builder*, nir_def *src0, nir_def *src1)
idiv(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 == 0 ? 0 : (src0 / src1)

Builder function:

nir_def *nir_idiv(nir_builder*, nir_def *src0, nir_def *src1)
udiv(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 == 0 ? 0 : (src0 / src1)

Builder function:

nir_def *nir_udiv(nir_builder*, nir_def *src0, nir_def *src1)
uadd_carry(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: Return an integer (1 or 0) representing the carry resulting from the addition of the two unsigned arguments.

Constant-folding:

src0 + src1 < src0

Builder function:

nir_def *nir_uadd_carry(nir_builder*, nir_def *src0, nir_def *src1)
usub_borrow(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Return an integer (1 or 0) representing the borrow resulting from the subtraction of the two unsigned arguments.

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_usub_borrow(nir_builder*, nir_def *src0, nir_def *src1)
ihadd(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 & src1) + ((src0 ^ src1) >> 1)

Builder function:

nir_def *nir_ihadd(nir_builder*, nir_def *src0, nir_def *src1)
uhadd(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 & src1) + ((src0 ^ src1) >> 1)

Builder function:

nir_def *nir_uhadd(nir_builder*, nir_def *src0, nir_def *src1)
irhadd(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 | src1) - ((src0 ^ src1) >> 1)

Builder function:

nir_def *nir_irhadd(nir_builder*, nir_def *src0, nir_def *src1)
urhadd(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 | src1) - ((src0 ^ src1) >> 1)

Builder function:

nir_def *nir_urhadd(nir_builder*, nir_def *src0, nir_def *src1)
umod(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 == 0 ? 0 : src0 % src1

Builder function:

nir_def *nir_umod(nir_builder*, nir_def *src0, nir_def *src1)
irem(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 == 0 ? 0 : src0 % src1

Builder function:

nir_def *nir_irem(nir_builder*, nir_def *src0, nir_def *src1)
imod(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 == 0 ? 0 : ((src0 % src1 == 0 || (src0 >= 0) == (src1 >= 0)) ?                 src0 % src1 : src0 % src1 + src1)

Builder function:

nir_def *nir_imod(nir_builder*, nir_def *src0, nir_def *src1)
fmod(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 - src1 * floorf(src0 / src1)

Builder function:

nir_def *nir_fmod(nir_builder*, nir_def *src0, nir_def *src1)
frem(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 - src1 * truncf(src0 / src1)

Builder function:

nir_def *nir_frem(nir_builder*, nir_def *src0, nir_def *src1)
flt(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_flt(nir_builder*, nir_def *src0, nir_def *src1)
flt8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_flt8(nir_builder*, nir_def *src0, nir_def *src1)
flt16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_flt16(nir_builder*, nir_def *src0, nir_def *src1)
flt32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_flt32(nir_builder*, nir_def *src0, nir_def *src1)
fge(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_fge(nir_builder*, nir_def *src0, nir_def *src1)
fge8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_fge8(nir_builder*, nir_def *src0, nir_def *src1)
fge16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_fge16(nir_builder*, nir_def *src0, nir_def *src1)
fge32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_fge32(nir_builder*, nir_def *src0, nir_def *src1)
fltu(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 < src1

Builder function:

nir_def *nir_fltu(nir_builder*, nir_def *src0, nir_def *src1)
fltu8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 < src1

Builder function:

nir_def *nir_fltu8(nir_builder*, nir_def *src0, nir_def *src1)
fltu16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 < src1

Builder function:

nir_def *nir_fltu16(nir_builder*, nir_def *src0, nir_def *src1)
fltu32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 < src1

Builder function:

nir_def *nir_fltu32(nir_builder*, nir_def *src0, nir_def *src1)
fgeu(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 >= src1

Builder function:

nir_def *nir_fgeu(nir_builder*, nir_def *src0, nir_def *src1)
fgeu8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 >= src1

Builder function:

nir_def *nir_fgeu8(nir_builder*, nir_def *src0, nir_def *src1)
fgeu16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 >= src1

Builder function:

nir_def *nir_fgeu16(nir_builder*, nir_def *src0, nir_def *src1)
fgeu32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnan(src0) || isnan(src1) || src0 >= src1

Builder function:

nir_def *nir_fgeu32(nir_builder*, nir_def *src0, nir_def *src1)
feq(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_feq(nir_builder*, nir_def *src0, nir_def *src1)
feq8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_feq8(nir_builder*, nir_def *src0, nir_def *src1)
feq16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_feq16(nir_builder*, nir_def *src0, nir_def *src1)
feq32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_feq32(nir_builder*, nir_def *src0, nir_def *src1)
fneu(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_fneu(nir_builder*, nir_def *src0, nir_def *src1)
fneu8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_fneu8(nir_builder*, nir_def *src0, nir_def *src1)
fneu16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_fneu16(nir_builder*, nir_def *src0, nir_def *src1)
fneu32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_fneu32(nir_builder*, nir_def *src0, nir_def *src1)
fequ(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1) || src0 == src1

Builder function:

nir_def *nir_fequ(nir_builder*, nir_def *src0, nir_def *src1)
fequ8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1) || src0 == src1

Builder function:

nir_def *nir_fequ8(nir_builder*, nir_def *src0, nir_def *src1)
fequ16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1) || src0 == src1

Builder function:

nir_def *nir_fequ16(nir_builder*, nir_def *src0, nir_def *src1)
fequ32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1) || src0 == src1

Builder function:

nir_def *nir_fequ32(nir_builder*, nir_def *src0, nir_def *src1)
fneo(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1) && src0 != src1

Builder function:

nir_def *nir_fneo(nir_builder*, nir_def *src0, nir_def *src1)
fneo8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1) && src0 != src1

Builder function:

nir_def *nir_fneo8(nir_builder*, nir_def *src0, nir_def *src1)
fneo16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1) && src0 != src1

Builder function:

nir_def *nir_fneo16(nir_builder*, nir_def *src0, nir_def *src1)
fneo32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1) && src0 != src1

Builder function:

nir_def *nir_fneo32(nir_builder*, nir_def *src0, nir_def *src1)
funord(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1)

Builder function:

nir_def *nir_funord(nir_builder*, nir_def *src0, nir_def *src1)
funord8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1)

Builder function:

nir_def *nir_funord8(nir_builder*, nir_def *src0, nir_def *src1)
funord16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1)

Builder function:

nir_def *nir_funord16(nir_builder*, nir_def *src0, nir_def *src1)
funord32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

isnan(src0) || isnan(src1)

Builder function:

nir_def *nir_funord32(nir_builder*, nir_def *src0, nir_def *src1)
ford(float[N] src0, float[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1)

Builder function:

nir_def *nir_ford(nir_builder*, nir_def *src0, nir_def *src1)
ford8(float[N] src0, float[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1)

Builder function:

nir_def *nir_ford8(nir_builder*, nir_def *src0, nir_def *src1)
ford16(float[N] src0, float[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1)

Builder function:

nir_def *nir_ford16(nir_builder*, nir_def *src0, nir_def *src1)
ford32(float[N] src0, float[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

!isnan(src0) && !isnan(src1)

Builder function:

nir_def *nir_ford32(nir_builder*, nir_def *src0, nir_def *src1)
ilt(int[N] src0, int[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ilt(nir_builder*, nir_def *src0, nir_def *src1)
ilt8(int[N] src0, int[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ilt8(nir_builder*, nir_def *src0, nir_def *src1)
ilt16(int[N] src0, int[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ilt16(nir_builder*, nir_def *src0, nir_def *src1)
ilt32(int[N] src0, int[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ilt32(nir_builder*, nir_def *src0, nir_def *src1)
ige(int[N] src0, int[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_ige(nir_builder*, nir_def *src0, nir_def *src1)
ige8(int[N] src0, int[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_ige8(nir_builder*, nir_def *src0, nir_def *src1)
ige16(int[N] src0, int[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_ige16(nir_builder*, nir_def *src0, nir_def *src1)
ige32(int[N] src0, int[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_ige32(nir_builder*, nir_def *src0, nir_def *src1)
ieq(int[N] src0, int[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_ieq(nir_builder*, nir_def *src0, nir_def *src1)
ieq8(int[N] src0, int[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_ieq8(nir_builder*, nir_def *src0, nir_def *src1)
ieq16(int[N] src0, int[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_ieq16(nir_builder*, nir_def *src0, nir_def *src1)
ieq32(int[N] src0, int[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 == src1

Builder function:

nir_def *nir_ieq32(nir_builder*, nir_def *src0, nir_def *src1)
ine(int[N] src0, int[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_ine(nir_builder*, nir_def *src0, nir_def *src1)
ine8(int[N] src0, int[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_ine8(nir_builder*, nir_def *src0, nir_def *src1)
ine16(int[N] src0, int[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_ine16(nir_builder*, nir_def *src0, nir_def *src1)
ine32(int[N] src0, int[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 != src1

Builder function:

nir_def *nir_ine32(nir_builder*, nir_def *src0, nir_def *src1)
ult(uint[N] src0, uint[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ult(nir_builder*, nir_def *src0, nir_def *src1)
ult8(uint[N] src0, uint[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ult8(nir_builder*, nir_def *src0, nir_def *src1)
ult16(uint[N] src0, uint[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ult16(nir_builder*, nir_def *src0, nir_def *src1)
ult32(uint[N] src0, uint[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 < src1

Builder function:

nir_def *nir_ult32(nir_builder*, nir_def *src0, nir_def *src1)
uge(uint[N] src0, uint[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_uge(nir_builder*, nir_def *src0, nir_def *src1)
uge8(uint[N] src0, uint[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_uge8(nir_builder*, nir_def *src0, nir_def *src1)
uge16(uint[N] src0, uint[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_uge16(nir_builder*, nir_def *src0, nir_def *src1)
uge32(uint[N] src0, uint[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 >= src1

Builder function:

nir_def *nir_uge32(nir_builder*, nir_def *src0, nir_def *src1)
bitnz(uint[N] src0, uint32[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x1

Builder function:

nir_def *nir_bitnz(nir_builder*, nir_def *src0, nir_def *src1)
bitnz8(uint[N] src0, uint32[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x1

Builder function:

nir_def *nir_bitnz8(nir_builder*, nir_def *src0, nir_def *src1)
bitnz16(uint[N] src0, uint32[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x1

Builder function:

nir_def *nir_bitnz16(nir_builder*, nir_def *src0, nir_def *src1)
bitnz32(uint[N] src0, uint32[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x1

Builder function:

nir_def *nir_bitnz32(nir_builder*, nir_def *src0, nir_def *src1)
bitz(uint[N] src0, uint32[N] src1) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x0

Builder function:

nir_def *nir_bitz(nir_builder*, nir_def *src0, nir_def *src1)
bitz8(uint[N] src0, uint32[N] src1) bool8[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x0

Builder function:

nir_def *nir_bitz8(nir_builder*, nir_def *src0, nir_def *src1)
bitz16(uint[N] src0, uint32[N] src1) bool16[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x0

Builder function:

nir_def *nir_bitz16(nir_builder*, nir_def *src0, nir_def *src1)
bitz32(uint[N] src0, uint32[N] src1) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: only uses the least significant bits like SM5 shifts

Constant-folding:

((uint64_t)src0 >> (src1 & (bit_size - 1)) & 0x1) == 0x0

Builder function:

nir_def *nir_bitz32(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal2(float[2] src0, float[2] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal2(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal4(float[4] src0, float[4] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal4(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal8(float[8] src0, float[8] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal8(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal16(float[16] src0, float[16] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal16(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal3(float[3] src0, float[3] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal3(nir_builder*, nir_def *src0, nir_def *src1)
ball_fequal5(float[5] src0, float[5] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_fequal5(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal2(float[2] src0, float[2] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal2(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal4(float[4] src0, float[4] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal4(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal8(float[8] src0, float[8] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal8(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal16(float[16] src0, float[16] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal16(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal3(float[3] src0, float[3] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal3(nir_builder*, nir_def *src0, nir_def *src1)
b8all_fequal5(float[5] src0, float[5] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_fequal5(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal2(float[2] src0, float[2] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal2(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal4(float[4] src0, float[4] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal4(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal8(float[8] src0, float[8] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal8(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal16(float[16] src0, float[16] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal16(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal3(float[3] src0, float[3] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal3(nir_builder*, nir_def *src0, nir_def *src1)
b16all_fequal5(float[5] src0, float[5] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_fequal5(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal2(float[2] src0, float[2] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal2(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal4(float[4] src0, float[4] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal4(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal8(float[8] src0, float[8] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal8(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal16(float[16] src0, float[16] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal16(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal3(float[3] src0, float[3] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal3(nir_builder*, nir_def *src0, nir_def *src1)
b32all_fequal5(float[5] src0, float[5] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_fequal5(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal2(float[2] src0, float[2] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal2(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal4(float[4] src0, float[4] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal4(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal8(float[8] src0, float[8] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal8(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal16(float[16] src0, float[16] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal16(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal3(float[3] src0, float[3] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal3(nir_builder*, nir_def *src0, nir_def *src1)
bany_fnequal5(float[5] src0, float[5] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_fnequal5(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal2(float[2] src0, float[2] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal2(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal4(float[4] src0, float[4] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal4(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal8(float[8] src0, float[8] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal8(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal16(float[16] src0, float[16] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal16(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal3(float[3] src0, float[3] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal3(nir_builder*, nir_def *src0, nir_def *src1)
b8any_fnequal5(float[5] src0, float[5] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_fnequal5(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal2(float[2] src0, float[2] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal2(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal4(float[4] src0, float[4] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal4(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal8(float[8] src0, float[8] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal8(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal16(float[16] src0, float[16] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal16(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal3(float[3] src0, float[3] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal3(nir_builder*, nir_def *src0, nir_def *src1)
b16any_fnequal5(float[5] src0, float[5] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_fnequal5(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal2(float[2] src0, float[2] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal2(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal4(float[4] src0, float[4] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal4(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal8(float[8] src0, float[8] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal8(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal16(float[16] src0, float[16] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal16(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal3(float[3] src0, float[3] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal3(nir_builder*, nir_def *src0, nir_def *src1)
b32any_fnequal5(float[5] src0, float[5] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_fnequal5(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal2(int[2] src0, int[2] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal2(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal4(int[4] src0, int[4] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal4(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal8(int[8] src0, int[8] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal8(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal16(int[16] src0, int[16] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal16(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal3(int[3] src0, int[3] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal3(nir_builder*, nir_def *src0, nir_def *src1)
ball_iequal5(int[5] src0, int[5] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_ball_iequal5(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal2(int[2] src0, int[2] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal2(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal4(int[4] src0, int[4] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal4(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal8(int[8] src0, int[8] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal8(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal16(int[16] src0, int[16] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal16(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal3(int[3] src0, int[3] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal3(nir_builder*, nir_def *src0, nir_def *src1)
b8all_iequal5(int[5] src0, int[5] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b8all_iequal5(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal2(int[2] src0, int[2] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal2(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal4(int[4] src0, int[4] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal4(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal8(int[8] src0, int[8] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal8(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal16(int[16] src0, int[16] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal16(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal3(int[3] src0, int[3] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal3(nir_builder*, nir_def *src0, nir_def *src1)
b16all_iequal5(int[5] src0, int[5] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b16all_iequal5(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal2(int[2] src0, int[2] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal2(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal4(int[4] src0, int[4] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal4(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal8(int[8] src0, int[8] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal8(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal16(int[16] src0, int[16] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal16(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal3(int[3] src0, int[3] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal3(nir_builder*, nir_def *src0, nir_def *src1)
b32all_iequal5(int[5] src0, int[5] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x))

Builder function:

nir_def *nir_b32all_iequal5(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal2(int[2] src0, int[2] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal2(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal4(int[4] src0, int[4] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal4(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal8(int[8] src0, int[8] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal8(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal16(int[16] src0, int[16] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal16(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal3(int[3] src0, int[3] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal3(nir_builder*, nir_def *src0, nir_def *src1)
bany_inequal5(int[5] src0, int[5] src1) bool1[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_bany_inequal5(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal2(int[2] src0, int[2] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal2(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal4(int[4] src0, int[4] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal4(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal8(int[8] src0, int[8] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal8(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal16(int[16] src0, int[16] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal16(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal3(int[3] src0, int[3] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal3(nir_builder*, nir_def *src0, nir_def *src1)
b8any_inequal5(int[5] src0, int[5] src1) bool8[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b8any_inequal5(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal2(int[2] src0, int[2] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal2(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal4(int[4] src0, int[4] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal4(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal8(int[8] src0, int[8] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal8(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal16(int[16] src0, int[16] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal16(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal3(int[3] src0, int[3] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal3(nir_builder*, nir_def *src0, nir_def *src1)
b16any_inequal5(int[5] src0, int[5] src1) bool16[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b16any_inequal5(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal2(int[2] src0, int[2] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal2(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal4(int[4] src0, int[4] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal4(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal8(int[8] src0, int[8] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal8(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal16(int[16] src0, int[16] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal16(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal3(int[3] src0, int[3] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal3(nir_builder*, nir_def *src0, nir_def *src1)
b32any_inequal5(int[5] src0, int[5] src1) bool32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x))

Builder function:

nir_def *nir_b32any_inequal5(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal2(float32[2] src0, float32[2] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal2(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal4(float32[4] src0, float32[4] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal4(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal8(float32[8] src0, float32[8] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal8(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal16(float32[16] src0, float32[16] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p == src1.p) && (src0.o == src1.o) && (src0.n == src1.n) && (src0.m == src1.m) && (src0.l == src1.l) && (src0.k == src1.k) && (src0.j == src1.j) && (src0.i == src1.i) && (src0.h == src1.h) && (src0.g == src1.g) && (src0.f == src1.f) && (src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal16(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal3(float32[3] src0, float32[3] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal3(nir_builder*, nir_def *src0, nir_def *src1)
fall_equal5(float32[5] src0, float32[5] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e == src1.e) && (src0.w == src1.w) && (src0.z == src1.z) && (src0.y == src1.y) && (src0.x == src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fall_equal5(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal2(float32[2] src0, float32[2] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal2(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal4(float32[4] src0, float32[4] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal4(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal8(float32[8] src0, float32[8] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal8(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal16(float32[16] src0, float32[16] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p != src1.p) || (src0.o != src1.o) || (src0.n != src1.n) || (src0.m != src1.m) || (src0.l != src1.l) || (src0.k != src1.k) || (src0.j != src1.j) || (src0.i != src1.i) || (src0.h != src1.h) || (src0.g != src1.g) || (src0.f != src1.f) || (src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal16(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal3(float32[3] src0, float32[3] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal3(nir_builder*, nir_def *src0, nir_def *src1)
fany_nequal5(float32[5] src0, float32[5] src1) float32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e != src1.e) || (src0.w != src1.w) || (src0.z != src1.z) || (src0.y != src1.y) || (src0.x != src1.x)) ? 1.0f : 0.0f

Builder function:

nir_def *nir_fany_nequal5(nir_builder*, nir_def *src0, nir_def *src1)
slt(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 < src1) ? 1.0f : 0.0f

Builder function:

nir_def *nir_slt(nir_builder*, nir_def *src0, nir_def *src1)
sge(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 >= src1) ? 1.0f : 0.0f

Builder function:

nir_def *nir_sge(nir_builder*, nir_def *src0, nir_def *src1)
seq(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 == src1) ? 1.0f : 0.0f

Builder function:

nir_def *nir_seq(nir_builder*, nir_def *src0, nir_def *src1)
sne(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 != src1) ? 1.0f : 0.0f

Builder function:

nir_def *nir_sne(nir_builder*, nir_def *src0, nir_def *src1)
ishl(int[N] src0, uint32[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Left shift. SPIRV shifts are undefined for shift-operands >= bitsize, but SM5 shifts are defined to use only the least significant bits. The NIR definition is according to the SM5 specification.

Constant-folding:

(uint64_t)src0 << (src1 & (sizeof(src0) * 8 - 1))

Builder function:

nir_def *nir_ishl(nir_builder*, nir_def *src0, nir_def *src1)
ishr(int[N] src0, uint32[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Signed right-shift. SPIRV shifts are undefined for shift-operands >= bitsize, but SM5 shifts are defined to use only the least significant bits. The NIR definition is according to the SM5 specification.

Constant-folding:

src0 >> (src1 & (sizeof(src0) * 8 - 1))

Builder function:

nir_def *nir_ishr(nir_builder*, nir_def *src0, nir_def *src1)
ushr(uint[N] src0, uint32[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Unsigned right-shift. SPIRV shifts are undefined for shift-operands >= bitsize, but SM5 shifts are defined to use only the least significant bits. The NIR definition is according to the SM5 specification.

Constant-folding:

src0 >> (src1 & (sizeof(src0) * 8 - 1))

Builder function:

nir_def *nir_ushr(nir_builder*, nir_def *src0, nir_def *src1)
udiv_aligned_4(uint[N] src0) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Divide a multiple of 4 by 4

Constant-folding:

src0 >> 2

Builder function:

nir_def *nir_udiv_aligned_4(nir_builder*, nir_def *src0)
urol(uint[N] src0, uint32[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

uint32_t rotate_mask = sizeof(src0) * 8 - 1;
dst = (src0 << (src1 & rotate_mask)) |
      (src0 >> (-src1 & rotate_mask));

Builder function:

nir_def *nir_urol(nir_builder*, nir_def *src0, nir_def *src1)
uror(uint[N] src0, uint32[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

uint32_t rotate_mask = sizeof(src0) * 8 - 1;
dst = (src0 >> (src1 & rotate_mask)) |
      (src0 << (-src1 & rotate_mask));

Builder function:

nir_def *nir_uror(nir_builder*, nir_def *src0, nir_def *src1)
shfr(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

uint32_t rotate_mask = sizeof(src0) * 8 - 1;
uint64_t src = src1 | ((uint64_t)src0 << 32);
dst = src >> (src2 & rotate_mask);

Builder function:

nir_def *nir_shfr(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
iand(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Bitwise AND, also used as a boolean AND for hardware supporting integers.

Constant-folding:

src0 & src1

Builder function:

nir_def *nir_iand(nir_builder*, nir_def *src0, nir_def *src1)
ior(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Bitwise OR, also used as a boolean OR for hardware supporting integers.

Constant-folding:

src0 | src1

Builder function:

nir_def *nir_ior(nir_builder*, nir_def *src0, nir_def *src1)
ixor(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Bitwise XOR, also used as a boolean XOR for hardware supporting integers.

Constant-folding:

src0 ^ src1

Builder function:

nir_def *nir_ixor(nir_builder*, nir_def *src0, nir_def *src1)
fdot2(float[2] src0, float[2] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot2(nir_builder*, nir_def *src0, nir_def *src1)
fdot4(float[4] src0, float[4] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot4(nir_builder*, nir_def *src0, nir_def *src1)
fdot8(float[8] src0, float[8] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.h * src1.h) + (src0.g * src1.g) + (src0.f * src1.f) + (src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot8(nir_builder*, nir_def *src0, nir_def *src1)
fdot16(float[16] src0, float[16] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.p * src1.p) + (src0.o * src1.o) + (src0.n * src1.n) + (src0.m * src1.m) + (src0.l * src1.l) + (src0.k * src1.k) + (src0.j * src1.j) + (src0.i * src1.i) + (src0.h * src1.h) + (src0.g * src1.g) + (src0.f * src1.f) + (src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot16(nir_builder*, nir_def *src0, nir_def *src1)
fdot3(float[3] src0, float[3] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot3(nir_builder*, nir_def *src0, nir_def *src1)
fdot5(float[5] src0, float[5] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

Y

Constant-folding:

((src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot5(nir_builder*, nir_def *src0, nir_def *src1)
fdot2_replicated(float[2] src0, float[2] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot2_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdot4_replicated(float[4] src0, float[4] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot4_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdot8_replicated(float[8] src0, float[8] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.h * src1.h) + (src0.g * src1.g) + (src0.f * src1.f) + (src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot8_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdot16_replicated(float[16] src0, float[16] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.p * src1.p) + (src0.o * src1.o) + (src0.n * src1.n) + (src0.m * src1.m) + (src0.l * src1.l) + (src0.k * src1.k) + (src0.j * src1.j) + (src0.i * src1.i) + (src0.h * src1.h) + (src0.g * src1.g) + (src0.f * src1.f) + (src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot16_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdot3_replicated(float[3] src0, float[3] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot3_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdot5_replicated(float[5] src0, float[5] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

((src0.e * src1.e) + (src0.w * src1.w) + (src0.z * src1.z) + (src0.y * src1.y) + (src0.x * src1.x))

Builder function:

nir_def *nir_fdot5_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fdph(float[3] src0, float[4] src1) float[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w

Builder function:

nir_def *nir_fdph(nir_builder*, nir_def *src0, nir_def *src1)
fdph_replicated(float[3] src0, float[4] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0.x * src1.x + src0.y * src1.y + src0.z * src1.z + src1.w

Builder function:

nir_def *nir_fdph_replicated(nir_builder*, nir_def *src0, nir_def *src1)
fmin(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

bit_size == 64 ? (src0 == src1 ? uid(MIN2((int64_t)dui(src0), (int64_t)dui(src1))) : fmin(src0, src1)) :(src0 == src1 ? uif(MIN2((int32_t)fui(src0), (int32_t)fui(src1))) : fminf(src0, src1))

Builder function:

nir_def *nir_fmin(nir_builder*, nir_def *src0, nir_def *src1)
fmax(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

bit_size == 64 ? (src0 == src1 ? uid(MAX2((int64_t)dui(src0), (int64_t)dui(src1))) : fmax(src0, src1)) :(src0 == src1 ? uif(MAX2((int32_t)fui(src0), (int32_t)fui(src1))) : fmaxf(src0, src1))

Builder function:

nir_def *nir_fmax(nir_builder*, nir_def *src0, nir_def *src1)
imin(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

MIN2(src0, src1)

Builder function:

nir_def *nir_imin(nir_builder*, nir_def *src0, nir_def *src1)
umin(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

MIN2(src0, src1)

Builder function:

nir_def *nir_umin(nir_builder*, nir_def *src0, nir_def *src1)
imax(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

MAX2(src0, src1)

Builder function:

nir_def *nir_imax(nir_builder*, nir_def *src0, nir_def *src1)
umax(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

MAX2(src0, src1)

Builder function:

nir_def *nir_umax(nir_builder*, nir_def *src0, nir_def *src1)
fpow(float[N] src0, float[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

bit_size == 64 ? pow(src0, src1) : powf(src0, src1)

Builder function:

nir_def *nir_fpow(nir_builder*, nir_def *src0, nir_def *src1)
pack_half_2x16_split(float32[1] src0, float32[1] src1) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

pack_half_1x16(src0.x) | ((uint32_t)(pack_half_1x16(src1.x)) << 16)

Builder function:

nir_def *nir_pack_half_2x16_split(nir_builder*, nir_def *src0, nir_def *src1)
pack_half_2x16_rtz_split(float32[1] src0, float32[1] src1) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

pack_half_1x16_rtz(src0.x) | (uint32_t)(pack_half_1x16_rtz(src1.x) << 16)

Builder function:

nir_def *nir_pack_half_2x16_rtz_split(nir_builder*, nir_def *src0, nir_def *src1)
pack_64_2x32_split(uint32[N] src0, uint32[N] src1) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 | ((uint64_t)src1 << 32)

Builder function:

nir_def *nir_pack_64_2x32_split(nir_builder*, nir_def *src0, nir_def *src1)
pack_32_2x16_split(uint16[N] src0, uint16[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 | ((uint32_t)src1 << 16)

Builder function:

nir_def *nir_pack_32_2x16_split(nir_builder*, nir_def *src0, nir_def *src1)
pack_32_4x8_split(uint8[N] src0, uint8[N] src1, uint8[N] src2, uint8[N] src3) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 | ((uint32_t)src1 << 8) | ((uint32_t)src2 << 16) | ((uint32_t)src3 << 24)

Builder function:

nir_def *nir_pack_32_4x8_split(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
bfm(int32[N] src0, int32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Implements the behavior of the first operation of the SM5 “bfi” assembly and that of the “bfi1” i965 instruction. That is, the bits and offset values are from the low five bits of src0 and src1, respectively.

Constant-folding:

int bits = src0 & 0x1F;
int offset = src1 & 0x1F;
dst = ((1u << bits) - 1) << offset;

Builder function:

nir_def *nir_bfm(nir_builder*, nir_def *src0, nir_def *src1)
ldexp(float[N] src0, int32[N] src1) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = (bit_size == 64) ? ldexp(src0, src1) : ldexpf(src0, src1);
/* flush denormals to zero. */
if (!isnormal(dst))
   dst = copysignf(0.0f, src0);

Builder function:

nir_def *nir_ldexp(nir_builder*, nir_def *src0, nir_def *src1)
vec2(uint[1] src0, uint[1] src1) uint[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Description: Combines the first component of each input to make a 2-component vector.

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;

Builder function:

nir_def *nir_vec2(nir_builder*, nir_def *src0, nir_def *src1)
extract_u8(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(uint8_t)(src0 >> (src1 * 8))

Builder function:

nir_def *nir_extract_u8(nir_builder*, nir_def *src0, nir_def *src1)
extract_i8(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(int8_t)(src0 >> (src1 * 8))

Builder function:

nir_def *nir_extract_i8(nir_builder*, nir_def *src0, nir_def *src1)
extract_u16(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(uint16_t)(src0 >> (src1 * 16))

Builder function:

nir_def *nir_extract_u16(nir_builder*, nir_def *src0, nir_def *src1)
extract_i16(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(int16_t)(src0 >> (src1 * 16))

Builder function:

nir_def *nir_extract_i16(nir_builder*, nir_def *src0, nir_def *src1)
insert_u8(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 & 0xff) << (src1 * 8)

Builder function:

nir_def *nir_insert_u8(nir_builder*, nir_def *src0, nir_def *src1)
insert_u16(uint[N] src0, uint[N] src1) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 & 0xffff) << (src1 * 16)

Builder function:

nir_def *nir_insert_u16(nir_builder*, nir_def *src0, nir_def *src1)
ffma(float[N] src0, float[N] src1, float[N] src2) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) {
   if (bit_size == 64)
      dst = _mesa_double_fma_rtz(src0, src1, src2);
   else if (bit_size == 32)
      dst = _mesa_float_fma_rtz(src0, src1, src2);
   else
      dst = _mesa_double_to_float_rtz(_mesa_double_fma_rtz(src0, src1, src2));
} else {
   if (bit_size == 32)
      dst = fmaf(src0, src1, src2);
   else
      dst = fma(src0, src1, src2);
}

Builder function:

nir_def *nir_ffma(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ffmaz(float32[N] src0, float32[N] src1, float32[N] src2) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Description: Floating-point multiply-add with modified zero handling.

Unlike ffma, anything (even infinity or NaN) multiplied by zero is always zero. ffmaz(0.0, inf, src2) and ffmaz(0.0, nan, src2) must be +/-0.0 + src2, even if INF_PRESERVE/NAN_PRESERVE is not used. If SIGNED_ZERO_PRESERVE is used, then the result must be a positive zero plus src2 if either src0 or src1 is zero.

Constant-folding:

if (src0 == 0.0 || src1 == 0.0)
   dst = 0.0 + src2;
else if (nir_is_rounding_mode_rtz(execution_mode, 32))
   dst = _mesa_float_fma_rtz(src0, src1, src2);
else
   dst = fmaf(src0, src1, src2);

Builder function:

nir_def *nir_ffmaz(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
flrp(float[N] src0, float[N] src1, float[N] src2) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 * (1 - src2) + src1 * src2

Builder function:

nir_def *nir_flrp(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
iadd3(int[N] src0, int[N] src1, int[N] src2) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Ternary addition

Constant-folding:

src0 + src1 + src2

Builder function:

nir_def *nir_iadd3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
imad(int[N] src0, int[N] src1, int[N] src2) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Description: Integer multiply-add

Constant-folding:

src0 * src1 + src2

Builder function:

nir_def *nir_imad(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
fcsel(float32[N] src0, float32[N] src1, float32[N] src2) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is a floating point bool (0.0 vs 1.0).

Constant-folding:

(src0 != 0.0f) ? src1 : src2

Builder function:

nir_def *nir_fcsel(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
bcsel(bool1[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is a 1-bit bool (0 vs 1).

Constant-folding:

src0 ? src1 : src2

Builder function:

nir_def *nir_bcsel(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
b8csel(bool8[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is an 8-bit bool (0 vs ~0).

Constant-folding:

src0 ? src1 : src2

Builder function:

nir_def *nir_b8csel(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
b16csel(bool16[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is a 16-bit bool (0 vs ~0).

Constant-folding:

src0 ? src1 : src2

Builder function:

nir_def *nir_b16csel(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
b32csel(bool32[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is a 32-bit bool (0 vs ~0).

Constant-folding:

src0 ? src1 : src2

Builder function:

nir_def *nir_b32csel(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
icsel_eqz(int[N] src0, int[N] src1, int[N] src2) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 == 0) ? src1 : src2

Builder function:

nir_def *nir_icsel_eqz(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
i32csel_gt(int32[N] src0, int32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 > 0) ? src1 : src2

Builder function:

nir_def *nir_i32csel_gt(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
i32csel_ge(int32[N] src0, int32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 >= 0) ? src1 : src2

Builder function:

nir_def *nir_i32csel_ge(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
fcsel_gt(float32[N] src0, float32[N] src1, float32[N] src2) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 > 0.0f) ? src1 : src2

Builder function:

nir_def *nir_fcsel_gt(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
fcsel_ge(float32[N] src0, float32[N] src1, float32[N] src2) float32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 >= 0.0f) ? src1 : src2

Builder function:

nir_def *nir_fcsel_ge(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
bfi(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: SM5 bfi assembly

Constant-folding:

unsigned mask = src0, insert = src1, base = src2;
if (mask == 0) {
   dst = base;
} else {
   unsigned tmp = mask;
   while (!(tmp & 1)) {
      tmp >>= 1;
      insert <<= 1;
   }
   dst = (base & ~mask) | (insert & mask);
}

Builder function:

nir_def *nir_bfi(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
bitfield_select(uint[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 & src1) | (~src0 & src2)

Builder function:

nir_def *nir_bitfield_select(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ubfe(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

unsigned base = src0;
unsigned offset = src1 & 0x1F;
unsigned bits = src2 & 0x1F;
if (bits == 0) {
   dst = 0;
} else if (offset + bits < 32) {
   dst = (base << (32 - bits - offset)) >> (32 - bits);
} else {
   dst = base >> offset;
}

Builder function:

nir_def *nir_ubfe(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ibfe(int32[N] src0, uint32[N] src1, uint32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

int base = src0;
unsigned offset = src1 & 0x1F;
unsigned bits = src2 & 0x1F;
if (bits == 0) {
   dst = 0;
} else if (offset + bits < 32) {
   dst = (base << (32 - bits - offset)) >> (32 - bits);
} else {
   dst = base >> offset;
}

Builder function:

nir_def *nir_ibfe(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ubitfield_extract(uint32[N] src0, int32[N] src1, int32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

unsigned base = src0;
int offset = src1, bits = src2;
if (bits == 0) {
   dst = 0;
} else if (bits < 0 || offset < 0 || offset + bits > 32) {
   dst = 0; /* undefined per the spec */
} else {
   dst = (base >> offset) & ((1ull << bits) - 1);
}

Builder function:

nir_def *nir_ubitfield_extract(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ibitfield_extract(int32[N] src0, int32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

int base = src0;
int offset = src1, bits = src2;
if (bits == 0) {
   dst = 0;
} else if (offset < 0 || bits < 0 || offset + bits > 32) {
   dst = 0;
} else {
   dst = (base << (32 - offset - bits)) >> (32 - bits); /* use sign-extending shift */
}

Builder function:

nir_def *nir_ibitfield_extract(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
msad_4x8(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: Masked sum of absolute differences with accumulation. Equivalent to AMD’s v_msad_u8 instruction and DXIL’s MSAD.

The first two sources contain packed 8-bit unsigned integers, the instruction will calculate the absolute difference of integers when src0’s is non-zero, and then add them together. There is also a third source which is a 32-bit unsigned integer and added to the result.

Constant-folding:

dst = msad(src0, src1, src2);

Builder function:

nir_def *nir_msad_4x8(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
mqsad_4x8(uint32[1] src0, uint32[2] src1, uint32[4] src2) uint32[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

uint64_t src = src1.x | ((uint64_t)src1.y << 32);
dst.x = msad(src0.x, src, src2.x);
dst.y = msad(src0.x, src >> 8, src2.y);
dst.z = msad(src0.x, src >> 16, src2.z);
dst.w = msad(src0.x, src >> 24, src2.w);

Builder function:

nir_def *nir_mqsad_4x8(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
vec3(uint[1] src0, uint[1] src1, uint[1] src2) uint[3]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;
dst.z = src2.x;

Builder function:

nir_def *nir_vec3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
bitfield_insert(uint32[N] src0, uint32[N] src1, int32[N] src2, int32[N] src3) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

unsigned base = src0, insert = src1;
int offset = src2, bits = src3;
if (bits == 0) {
   dst = base;
} else if (offset < 0 || bits < 0 || bits + offset > 32) {
   dst = 0;
} else {
   unsigned mask = ((1ull << bits) - 1) << offset;
   dst = (base & ~mask) | ((insert << offset) & mask);
}

Builder function:

nir_def *nir_bitfield_insert(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
vec4(uint[1] src0, uint[1] src1, uint[1] src2, uint[1] src3) uint[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;
dst.z = src2.x;
dst.w = src3.x;

Builder function:

nir_def *nir_vec4(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
vec5(uint[1] src0, uint[1] src1, uint[1] src2, uint[1] src3, uint[1] src4) uint[5]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;
dst.z = src2.x;
dst.w = src3.x;
dst.e = src4.x;

Builder function:

nir_def *nir_vec5(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3, nir_def *src4)
vec8(uint[1] src0, uint[1] src1, uint[1] src2, uint[1] src3, uint[1] src4, uint[1] src5, uint[1] src6, uint[1] src7) uint[8]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;
dst.z = src2.x;
dst.w = src3.x;
dst.e = src4.x;
dst.f = src5.x;
dst.g = src6.x;
dst.h = src7.x;

Builder function:

nir_def *nir_vec8(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3, nir_def *src4, nir_def *src5, nir_def *src6, nir_def *src7)
vec16(uint[1] src0, uint[1] src1, uint[1] src2, uint[1] src3, uint[1] src4, uint[1] src5, uint[1] src6, uint[1] src7, uint[1] src8, uint[1] src9, uint[1] src10, uint[1] src11, uint[1] src12, uint[1] src13, uint[1] src14, uint[1] src15) uint[16]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x;
dst.y = src1.x;
dst.z = src2.x;
dst.w = src3.x;
dst.e = src4.x;
dst.f = src5.x;
dst.g = src6.x;
dst.h = src7.x;
dst.i = src8.x;
dst.j = src9.x;
dst.k = src10.x;
dst.l = src11.x;
dst.m = src12.x;
dst.n = src13.x;
dst.o = src14.x;
dst.p = src15.x;

Builder function:

nir_def *nir_vec16(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3, nir_def *src4, nir_def *src5, nir_def *src6, nir_def *src7, nir_def *src8, nir_def *src9, nir_def *src10, nir_def *src11, nir_def *src12, nir_def *src13, nir_def *src14, nir_def *src15)
amul(int[N] src0, int[N] src1) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

src0 * src1

Builder function:

nir_def *nir_amul(nir_builder*, nir_def *src0, nir_def *src1)
imadsh_mix16(int32[N] src0, int32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = ((((src0 & 0x0000ffff) << 16) * (src1 & 0xffff0000)) >> 16) + src2;

Builder function:

nir_def *nir_imadsh_mix16(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
imad24_ir3(int32[N] src0, int32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(((int32_t)src0 << 8) >> 8) * (((int32_t)src1 << 8) >> 8) + src2

Builder function:

nir_def *nir_imad24_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
shrm_ir3(uint[N] src0, uint32[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 >> (src1 & (sizeof(src0) * 8 - 1))) & src2

Builder function:

nir_def *nir_shrm_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
shlm_ir3(uint[N] src0, uint32[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 << (src1 & (sizeof(src0) * 8 - 1))) & src2

Builder function:

nir_def *nir_shlm_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
shrg_ir3(uint[N] src0, uint32[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 >> (src1 & (sizeof(src0) * 8 - 1))) | src2

Builder function:

nir_def *nir_shrg_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
shlg_ir3(uint[N] src0, uint32[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 << (src1 & (sizeof(src0) * 8 - 1))) | src2

Builder function:

nir_def *nir_shlg_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
andg_ir3(uint[N] src0, uint[N] src1, uint[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(src0 & src1) | src2

Builder function:

nir_def *nir_andg_ir3(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
cube_amd(float32[3] src0) float32[4]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = dst.y = dst.z = 0.0;
float absX = fabsf(src0.x);
float absY = fabsf(src0.y);
float absZ = fabsf(src0.z);

if (absX >= absY && absX >= absZ) { dst.z = 2 * src0.x; }
if (absY >= absX && absY >= absZ) { dst.z = 2 * src0.y; }
if (absZ >= absX && absZ >= absY) { dst.z = 2 * src0.z; }

if (src0.x >= 0 && absX >= absY && absX >= absZ) {
   dst.y = -src0.z; dst.x = -src0.y; dst.w = 0;
}
if (src0.x < 0 && absX >= absY && absX >= absZ) {
   dst.y = src0.z; dst.x = -src0.y; dst.w = 1;
}
if (src0.y >= 0 && absY >= absX && absY >= absZ) {
   dst.y = src0.x; dst.x = src0.z; dst.w = 2;
}
if (src0.y < 0 && absY >= absX && absY >= absZ) {
   dst.y = src0.x; dst.x = -src0.z; dst.w = 3;
}
if (src0.z >= 0 && absZ >= absX && absZ >= absY) {
   dst.y = src0.x; dst.x = -src0.y; dst.w = 4;
}
if (src0.z < 0 && absZ >= absX && absZ >= absY) {
   dst.y = -src0.x; dst.x = -src0.y; dst.w = 5;
}

Builder function:

nir_def *nir_cube_amd(nir_builder*, nir_def *src0)
fsin_amd(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

sinf(6.2831853 * src0)

Builder function:

nir_def *nir_fsin_amd(nir_builder*, nir_def *src0)
fcos_amd(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

cosf(6.2831853 * src0)

Builder function:

nir_def *nir_fcos_amd(nir_builder*, nir_def *src0)
alignbyte_amd(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

uint64_t src = src1 | ((uint64_t)src0 << 32);
dst = src >> ((src2 & 0x3) * 8);

Builder function:

nir_def *nir_alignbyte_amd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
fsin_mdg(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

sinf(3.141592653589793 * src0)

Builder function:

nir_def *nir_fsin_mdg(nir_builder*, nir_def *src0)
fcos_mdg(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

cosf(3.141592653589793 * src0)

Builder function:

nir_def *nir_fcos_mdg(nir_builder*, nir_def *src0)
fsin_agx(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

sinf(src0 * (6.2831853/4.0))

Builder function:

nir_def *nir_fsin_agx(nir_builder*, nir_def *src0)
extr_agx(uint32[N] src0, uint32[N] src1, uint32[N] src2, uint32[N] src3) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

uint32_t mask = 0xFFFFFFFF;
uint8_t shift = src2 & 0x7F;
if (src3 != 0) {
   mask = (1 << src3) - 1;
}
if (shift >= 64) {
    dst = 0;
} else {
    dst = (((((uint64_t) src1) << 32) | (uint64_t) src0) >> shift) & mask;
}

Builder function:

nir_def *nir_extr_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
imadshl_agx(int[N] src0, int[N] src1, int[N] src2, int[N] src3) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 * src1) + (src2 << src3)

Builder function:

nir_def *nir_imadshl_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
imsubshl_agx(int[N] src0, int[N] src1, int[N] src2, int[N] src3) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 * src1) - (src2 << src3)

Builder function:

nir_def *nir_imsubshl_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2, nir_def *src3)
ilea_agx(uint64[N] src0, int32[N] src1, uint32[N] src2) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 + (((int64_t)src1) << src2)

Builder function:

nir_def *nir_ilea_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
ulea_agx(uint64[N] src0, uint32[N] src1, uint32[N] src2) uint64[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src0 + (((uint64_t)src1) << src2)

Builder function:

nir_def *nir_ulea_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
bounds_agx(int[N] src0, int[N] src1, int[N] src2) int[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

src1 <= src2 ? src0 : 0

Builder function:

nir_def *nir_bounds_agx(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
interleave_agx(uint16[N] src0, uint16[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description:

Interleave bits of 16-bit integers to calculate a 32-bit integer. This can be used as-is for Morton encoding.

Constant-folding:

dst = 0;
for (unsigned bit = 0; bit < 16; bit++) {
    dst |= (src0 & (1 << bit)) << bit;
    dst |= (src1 & (1 << bit)) << (bit + 1);
}

Builder function:

nir_def *nir_interleave_agx(nir_builder*, nir_def *src0, nir_def *src1)
fmin_agx(float32[N] src0, float32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

(src0 < src1 || isnan(src1)) ? src0 : src1

Builder function:

nir_def *nir_fmin_agx(nir_builder*, nir_def *src0, nir_def *src1)
fmax_agx(float32[N] src0, float32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

(src0 > src1 || isnan(src1)) ? src0 : src1

Builder function:

nir_def *nir_fmax_agx(nir_builder*, nir_def *src0, nir_def *src1)
prmt_nv(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = 0;
for (unsigned i = 0; i < 4; i++) {
    uint8_t byte = (src0 >> (i * 4)) & 0x7;
    uint8_t x = byte < 4 ? (src1 >> (byte * 8))
                         : (src2 >> ((byte - 4) * 8));
    if ((src0 >> (i * 4)) & 0x8)
        x = ((int8_t)x) >> 7;
    dst |= ((uint32_t)x) << i * 8;
}

Builder function:

nir_def *nir_prmt_nv(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
imul24(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

(((int32_t)src0 << 8) >> 8) * (((int32_t)src1 << 8) >> 8)

Builder function:

nir_def *nir_imul24(nir_builder*, nir_def *src0, nir_def *src1)
umad24(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

(((uint32_t)src0 << 8) >> 8) * (((uint32_t)src1 << 8) >> 8) + src2

Builder function:

nir_def *nir_umad24(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
umul24(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

(((uint32_t)src0 << 8) >> 8) * (((uint32_t)src1 << 8) >> 8)

Builder function:

nir_def *nir_umul24(nir_builder*, nir_def *src0, nir_def *src1)
imul24_relaxed(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

src0 * src1

Builder function:

nir_def *nir_imul24_relaxed(nir_builder*, nir_def *src0, nir_def *src1)
umad24_relaxed(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

src0 * src1 + src2

Builder function:

nir_def *nir_umad24_relaxed(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
umul24_relaxed(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

src0 * src1

Builder function:

nir_def *nir_umul24_relaxed(nir_builder*, nir_def *src0, nir_def *src1)
fisnormal(float[N] src0) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isnormal(src0)

Builder function:

nir_def *nir_fisnormal(nir_builder*, nir_def *src0)
fisfinite(float[N] src0) bool1[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isfinite(src0)

Builder function:

nir_def *nir_fisfinite(nir_builder*, nir_def *src0)
fisfinite32(float[N] src0) bool32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

isfinite(src0)

Builder function:

nir_def *nir_fisfinite32(nir_builder*, nir_def *src0)
usadd_4x8_vc4(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

dst = 0;
for (int i = 0; i < 32; i += 8) {
   dst |= MIN2(((src0 >> i) & 0xff) + ((src1 >> i) & 0xff), 0xff) << i;
}

Builder function:

nir_def *nir_usadd_4x8_vc4(nir_builder*, nir_def *src0, nir_def *src1)
ussub_4x8_vc4(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

dst = 0;
for (int i = 0; i < 32; i += 8) {
   int src0_chan = (src0 >> i) & 0xff;
   int src1_chan = (src1 >> i) & 0xff;
   if (src0_chan > src1_chan)
      dst |= (src0_chan - src1_chan) << i;
}

Builder function:

nir_def *nir_ussub_4x8_vc4(nir_builder*, nir_def *src0, nir_def *src1)
umin_4x8_vc4(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

dst = 0;
for (int i = 0; i < 32; i += 8) {
   dst |= MIN2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i;
}

Builder function:

nir_def *nir_umin_4x8_vc4(nir_builder*, nir_def *src0, nir_def *src1)
umax_4x8_vc4(int32[N] src0, int32[N] src1) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

dst = 0;
for (int i = 0; i < 32; i += 8) {
   dst |= MAX2((src0 >> i) & 0xff, (src1 >> i) & 0xff) << i;
}

Builder function:

nir_def *nir_umax_4x8_vc4(nir_builder*, nir_def *src0, nir_def *src1)
umul_unorm_4x8_vc4(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

Y

Y

Constant-folding:

dst = 0;
for (int i = 0; i < 32; i += 8) {
   uint32_t src0_chan = (src0 >> i) & 0xff;
   uint32_t src1_chan = (src1 >> i) & 0xff;
   dst |= ((src0_chan * src1_chan) / 255) << i;
}

Builder function:

nir_def *nir_umul_unorm_4x8_vc4(nir_builder*, nir_def *src0, nir_def *src1)
pack_32_to_r11g11b10_v3d(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

pack_32_to_r11g11b10_v3d(src0, src1)

Builder function:

nir_def *nir_pack_32_to_r11g11b10_v3d(nir_builder*, nir_def *src0, nir_def *src1)
pack_2x32_to_2x16_v3d(uint32[1] src0, uint32[1] src1) uint32[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

(src0.x & 0xffff) | (src1.x << 16)

Builder function:

nir_def *nir_pack_2x32_to_2x16_v3d(nir_builder*, nir_def *src0, nir_def *src1)
pack_uint_32_to_r10g10b10a2_v3d(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 & 0x3ff) | ((src0 >> 16) & 0x3ff) << 10 | (src1 & 0x3ff) << 20 | ((src1 >> 16) & 0x3ff) << 30

Builder function:

nir_def *nir_pack_uint_32_to_r10g10b10a2_v3d(nir_builder*, nir_def *src0, nir_def *src1)
pack_4x16_to_4x8_v3d(uint32[N] src0, uint32[N] src1) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

(src0 & 0x000000ff) | (src0 & 0x00ff0000) >> 8 | (src1 & 0x000000ff) << 16 | (src1 & 0x00ff0000) << 8

Builder function:

nir_def *nir_pack_4x16_to_4x8_v3d(nir_builder*, nir_def *src0, nir_def *src1)
pack_2x16_to_unorm_2x8_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

_mesa_half_to_unorm(src0 & 0xffff, 8) | (_mesa_half_to_unorm(src0 >> 16, 8) << 16)

Builder function:

nir_def *nir_pack_2x16_to_unorm_2x8_v3d(nir_builder*, nir_def *src0)
pack_2x16_to_snorm_2x8_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

_mesa_half_to_snorm(src0 & 0xffff, 8) | ((uint32_t)(_mesa_half_to_snorm(src0 >> 16, 8)) << 16)

Builder function:

nir_def *nir_pack_2x16_to_snorm_2x8_v3d(nir_builder*, nir_def *src0)
f2unorm_16_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

_mesa_float_to_unorm16(src0)

Builder function:

nir_def *nir_f2unorm_16_v3d(nir_builder*, nir_def *src0)
f2snorm_16_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

_mesa_float_to_snorm16(src0)

Builder function:

nir_def *nir_f2snorm_16_v3d(nir_builder*, nir_def *src0)
pack_2x16_to_unorm_2x10_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

pack_2x16_to_unorm_2x10(src0)

Builder function:

nir_def *nir_pack_2x16_to_unorm_2x10_v3d(nir_builder*, nir_def *src0)
pack_2x16_to_unorm_10_2_v3d(uint32[N] src0) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

pack_2x16_to_unorm_10_2(src0)

Builder function:

nir_def *nir_pack_2x16_to_unorm_10_2_v3d(nir_builder*, nir_def *src0)
fsat_signed(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

fmin(fmax(src0, -1.0), 1.0)

Builder function:

nir_def *nir_fsat_signed(nir_builder*, nir_def *src0)
fclamp_pos(float[N] src0) float[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

fmax(src0, 0.0)

Builder function:

nir_def *nir_fclamp_pos(nir_builder*, nir_def *src0)
b32fcsel_mdg(bool32[N] src0, float[N] src1, float[N] src2) uint[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Description: A vector conditional select instruction (like ?:, but operating per- component on vectors). The condition is a 32-bit bool (0 vs ~0).

This Midgard-specific variant takes floating-point sources, rather than integer sources. That includes support for floating point modifiers in the backend.

Constant-folding:

src0 ? src1 : src2

Builder function:

nir_def *nir_b32fcsel_mdg(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
pack_double_2x32_dxil(uint32[2] src0) uint64[1]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x | ((uint64_t)src0.y << 32);

Builder function:

nir_def *nir_pack_double_2x32_dxil(nir_builder*, nir_def *src0)
unpack_double_2x32_dxil(uint64[1] src0) uint32[2]

Properties:

Per-component

Associative

2-src commutative

N

N

N

Constant-folding:

dst.x = src0.x; dst.y = src0.x >> 32;

Builder function:

nir_def *nir_unpack_double_2x32_dxil(nir_builder*, nir_def *src0)
sdot_4x8_iadd(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const int32_t v0x = (int8_t)(src0      );
const int32_t v0y = (int8_t)(src0 >>  8);
const int32_t v0z = (int8_t)(src0 >> 16);
const int32_t v0w = (int8_t)(src0 >> 24);
const int32_t v1x = (int8_t)(src1      );
const int32_t v1y = (int8_t)(src1 >>  8);
const int32_t v1z = (int8_t)(src1 >> 16);
const int32_t v1w = (int8_t)(src1 >> 24);

dst = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

Builder function:

nir_def *nir_sdot_4x8_iadd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
udot_4x8_uadd(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const uint32_t v0x = (uint8_t)(src0      );
const uint32_t v0y = (uint8_t)(src0 >>  8);
const uint32_t v0z = (uint8_t)(src0 >> 16);
const uint32_t v0w = (uint8_t)(src0 >> 24);
const uint32_t v1x = (uint8_t)(src1      );
const uint32_t v1y = (uint8_t)(src1 >>  8);
const uint32_t v1z = (uint8_t)(src1 >> 16);
const uint32_t v1w = (uint8_t)(src1 >> 24);

dst = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

Builder function:

nir_def *nir_udot_4x8_uadd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
sudot_4x8_iadd(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

const int32_t v0x = (int8_t)(src0      );
const int32_t v0y = (int8_t)(src0 >>  8);
const int32_t v0z = (int8_t)(src0 >> 16);
const int32_t v0w = (int8_t)(src0 >> 24);
const uint32_t v1x = (uint8_t)(src1      );
const uint32_t v1y = (uint8_t)(src1 >>  8);
const uint32_t v1z = (uint8_t)(src1 >> 16);
const uint32_t v1w = (uint8_t)(src1 >> 24);

dst = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

Builder function:

nir_def *nir_sudot_4x8_iadd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
sdot_4x8_iadd_sat(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const int64_t v0x = (int8_t)(src0      );
const int64_t v0y = (int8_t)(src0 >>  8);
const int64_t v0z = (int8_t)(src0 >> 16);
const int64_t v0w = (int8_t)(src0 >> 24);
const int64_t v1x = (int8_t)(src1      );
const int64_t v1y = (int8_t)(src1 >>  8);
const int64_t v1z = (int8_t)(src1 >> 16);
const int64_t v1w = (int8_t)(src1 >> 24);

const int64_t tmp = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

dst = tmp >= INT32_MAX ? INT32_MAX : (tmp <= INT32_MIN ? INT32_MIN : tmp);

Builder function:

nir_def *nir_sdot_4x8_iadd_sat(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
udot_4x8_uadd_sat(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const uint64_t v0x = (uint8_t)(src0      );
const uint64_t v0y = (uint8_t)(src0 >>  8);
const uint64_t v0z = (uint8_t)(src0 >> 16);
const uint64_t v0w = (uint8_t)(src0 >> 24);
const uint64_t v1x = (uint8_t)(src1      );
const uint64_t v1y = (uint8_t)(src1 >>  8);
const uint64_t v1z = (uint8_t)(src1 >> 16);
const uint64_t v1w = (uint8_t)(src1 >> 24);

const uint64_t tmp = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

dst = tmp >= UINT32_MAX ? UINT32_MAX : tmp;

Builder function:

nir_def *nir_udot_4x8_uadd_sat(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
sudot_4x8_iadd_sat(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

N

Constant-folding:

const int64_t v0x = (int8_t)(src0      );
const int64_t v0y = (int8_t)(src0 >>  8);
const int64_t v0z = (int8_t)(src0 >> 16);
const int64_t v0w = (int8_t)(src0 >> 24);
const uint64_t v1x = (uint8_t)(src1      );
const uint64_t v1y = (uint8_t)(src1 >>  8);
const uint64_t v1z = (uint8_t)(src1 >> 16);
const uint64_t v1w = (uint8_t)(src1 >> 24);

const int64_t tmp = (v0x * v1x) + (v0y * v1y) + (v0z * v1z) + (v0w * v1w) + src2;

dst = tmp >= INT32_MAX ? INT32_MAX : (tmp <= INT32_MIN ? INT32_MIN : tmp);

Builder function:

nir_def *nir_sudot_4x8_iadd_sat(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
sdot_2x16_iadd(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const int32_t v0x = (int16_t)(src0      );
const int32_t v0y = (int16_t)(src0 >> 16);
const int32_t v1x = (int16_t)(src1      );
const int32_t v1y = (int16_t)(src1 >> 16);

dst = (v0x * v1x) + (v0y * v1y) + src2;

Builder function:

nir_def *nir_sdot_2x16_iadd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
udot_2x16_uadd(uint32[N] src0, uint32[N] src1, uint32[N] src2) uint32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const uint32_t v0x = (uint16_t)(src0      );
const uint32_t v0y = (uint16_t)(src0 >> 16);
const uint32_t v1x = (uint16_t)(src1      );
const uint32_t v1y = (uint16_t)(src1 >> 16);

dst = (v0x * v1x) + (v0y * v1y) + src2;

Builder function:

nir_def *nir_udot_2x16_uadd(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
sdot_2x16_iadd_sat(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const int64_t v0x = (int16_t)(src0      );
const int64_t v0y = (int16_t)(src0 >> 16);
const int64_t v1x = (int16_t)(src1      );
const int64_t v1y = (int16_t)(src1 >> 16);

const int64_t tmp = (v0x * v1x) + (v0y * v1y) + src2;

dst = tmp >= INT32_MAX ? INT32_MAX : (tmp <= INT32_MIN ? INT32_MIN : tmp);

Builder function:

nir_def *nir_sdot_2x16_iadd_sat(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)
udot_2x16_uadd_sat(uint32[N] src0, uint32[N] src1, int32[N] src2) int32[N]

Properties:

Per-component

Associative

2-src commutative

Y

N

Y

Constant-folding:

const uint64_t v0x = (uint16_t)(src0      );
const uint64_t v0y = (uint16_t)(src0 >> 16);
const uint64_t v1x = (uint16_t)(src1      );
const uint64_t v1y = (uint16_t)(src1 >> 16);

const uint64_t tmp = (v0x * v1x) + (v0y * v1y) + src2;

dst = tmp >= UINT32_MAX ? UINT32_MAX : tmp;

Builder function:

nir_def *nir_udot_2x16_uadd_sat(nir_builder*, nir_def *src0, nir_def *src1, nir_def *src2)