Beaver.MLIR.Dialect.Index (beaver v0.4.8)

Copy Markdown

Summary

Functions

Return op name index.add as a bitstring.

index.add - index addition

Return op name index.and as a bitstring.

index.and - index bitwise and

Return op name index.bool.constant as a bitstring.

index.bool.constant - boolean constant

Return op name index.casts as a bitstring.

index.casts - index signed cast

Return op name index.castu as a bitstring.

index.castu - index unsigned cast

Return op name index.ceildivs as a bitstring.

index.ceildivs - index signed ceil division

Return op name index.ceildivu as a bitstring.

index.ceildivu - index unsigned ceil division

Return op name index.cmp as a bitstring.

index.cmp - index compare

Return op name index.constant as a bitstring.

index.constant - index constant

Return op name index.divs as a bitstring.

index.divs - index signed division

Return op name index.divu as a bitstring.

index.divu - index unsigned division

Return op name index.floordivs as a bitstring.

index.floordivs - index signed floor division

Return op name index.maxs as a bitstring.

index.maxs - index signed maximum

Return op name index.maxu as a bitstring.

index.maxu - index unsigned maximum

Return op name index.mins as a bitstring.

index.mins - index signed minimum

Return op name index.minu as a bitstring.

index.minu - index unsigned minimum

Return op name index.mul as a bitstring.

index.mul - index multiplication

Return op name index.or as a bitstring.

index.or - index bitwise or

Return op name index.rems as a bitstring.

index.rems - index signed remainder

Return op name index.remu as a bitstring.

index.remu - index unsigned remainder

Return op name index.shl as a bitstring.

index.shl - index shift left

Return op name index.shrs as a bitstring.

index.shrs - signed index shift right

Return op name index.shru as a bitstring.

index.shru - unsigned index shift right

Return op name index.sizeof as a bitstring.

index.sizeof - size in bits of the index type

Return op name index.sub as a bitstring.

index.sub - index subtraction

Return op name index.xor as a bitstring.

index.xor - index bitwise xor

Functions

add()

Return op name index.add as a bitstring.

add(ssa)

index.add - index addition

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.add operation takes two index values and computes their sum.

Example:

// c = a + b
%c = index.add %a, %b

and()

Return op name index.and as a bitstring.

and(ssa)

index.and - index bitwise and

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.and operation takes two index values and computes their bitwise and.

Example:

// c = a & b
%c = index.and %a, %b

bool_constant()

Return op name index.bool.constant as a bitstring.

bool_constant(ssa)

index.bool.constant - boolean constant

This op has support for result type inference.

Attributes

  • value - Single, BoolAttr, bool attribute

Results

  • result - Single, I1, 1-bit signless integer

Description

The index.bool.constant operation produces an bool-typed SSA value equal to either true or false.

This operation is used to materialize bool constants that arise when folding index.cmp.

Example:

%0 = index.bool.constant true

casts()

Return op name index.casts as a bitstring.

casts(ssa)

index.casts - index signed cast

Operands

  • input - Single, anonymous/composite constraint, integer or index

Results

  • output - Single, anonymous/composite constraint, integer or index

Description

The index.casts operation enables conversions between values of index type and concrete fixed-width integer types. If casting to a wider integer, the value is sign-extended. If casting to a narrower integer, the value is truncated.

Example:

// Cast to i32
%0 = index.casts %a : index to i32

// Cast from i64
%1 = index.casts %b : i64 to index

castu()

Return op name index.castu as a bitstring.

castu(ssa)

index.castu - index unsigned cast

Operands

  • input - Single, anonymous/composite constraint, integer or index

Results

  • output - Single, anonymous/composite constraint, integer or index

Description

The index.castu operation enables conversions between values of index type and concrete fixed-width integer types. If casting to a wider integer, the value is zero-extended. If casting to a narrower integer, the value is truncated.

Example:

// Cast to i32
%0 = index.castu %a : index to i32

// Cast from i64
%1 = index.castu %b : i64 to index

ceildivs()

Return op name index.ceildivs as a bitstring.

ceildivs(ssa)

index.ceildivs - index signed ceil division

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.ceildivs operation takes two index values and computes their signed quotient. Treats the leading bit as the sign and rounds towards positive infinity, i.e. 7 / -2 = -3.

Note: division by zero and signed division overflow are undefined behaviour.

Example:

// c = ceil(a / b)
%c = index.ceildivs %a, %b

ceildivu()

Return op name index.ceildivu as a bitstring.

ceildivu(ssa)

index.ceildivu - index unsigned ceil division

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.ceildivu operation takes two index values and computes their unsigned quotient. Treats the leading bit as the most significant and rounds towards positive infinity, i.e. 6 / -2 = 1.

Note: division by zero is undefined behaviour.

Example:

// c = ceil(a / b)
%c = index.ceildivu %a, %b

cmp()

Return op name index.cmp as a bitstring.

cmp(ssa)

index.cmp - index compare

This op has support for result type inference.

Attributes

  • pred - Single, IndexCmpPredicateAttr, index comparison predicate kind

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, I1, 1-bit signless integer

Description

The index.cmp operation takes two index values and compares them according to the comparison predicate and returns an i1. The following comparisons are supported:

  • eq: equal
  • ne: not equal
  • slt: signed less than
  • sle: signed less than or equal
  • sgt: signed greater than
  • sge: signed greater than or equal
  • ult: unsigned less than
  • ule: unsigned less than or equal
  • ugt: unsigned greater than
  • uge: unsigned greater than or equal

The result is 1 if the comparison is true and 0 otherwise.

Example:

// Signed less than comparison.
%0 = index.cmp slt(%a, %b)

// Unsigned greater than or equal comparison.
%1 = index.cmp uge(%a, %b)

// Not equal comparison.
%2 = index.cmp ne(%a, %b)

constant()

Return op name index.constant as a bitstring.

constant(ssa)

index.constant - index constant

This op has support for result type inference.

Attributes

  • value - Single, IndexAttr, index attribute

Results

  • result - Single, Index, index

Description

The index.constant operation produces an index-typed SSA value equal to some index-typed integer constant.

Example:

%0 = index.constant 42

divs()

Return op name index.divs as a bitstring.

divs(ssa)

index.divs - index signed division

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.divs operation takes two index values and computes their signed quotient. Treats the leading bit as the sign and rounds towards zero, i.e. 6 / -2 = -3.

Note: division by zero and signed division overflow are undefined behaviour.

Example:

// c = a / b
%c = index.divs %a, %b

divu()

Return op name index.divu as a bitstring.

divu(ssa)

index.divu - index unsigned division

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.divu operation takes two index values and computes their unsigned quotient. Treats the leading bit as the most significant and rounds towards zero, i.e. 6 / -2 = 0.

Note: division by zero is undefined behaviour.

Example:

// c = a / b
%c = index.divu %a, %b

floordivs()

Return op name index.floordivs as a bitstring.

floordivs(ssa)

index.floordivs - index signed floor division

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.floordivs operation takes two index values and computes their signed quotient. Treats the leading bit as the sign and rounds towards negative infinity, i.e. 5 / -2 = -3.

Note: division by zero and signed division overflow are undefined behaviour.

Example:

// c = floor(a / b)
%c = index.floordivs %a, %b

maxs()

Return op name index.maxs as a bitstring.

maxs(ssa)

index.maxs - index signed maximum

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.maxs operation takes two index values and computes their signed maximum value. Treats the leading bit as the sign, i.e. max(-2, 6) = 6.

Example:

// c = max(a, b)
%c = index.maxs %a, %b

maxu()

Return op name index.maxu as a bitstring.

maxu(ssa)

index.maxu - index unsigned maximum

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.maxu operation takes two index values and computes their unsigned maximum value. Treats the leading bit as the most significant, i.e. max(15, 6) = 15 or max(-2, 6) = -2.

Example:

// c = max(a, b)
%c = index.maxu %a, %b

mins()

Return op name index.mins as a bitstring.

mins(ssa)

index.mins - index signed minimum

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.mins operation takes two index values and computes their signed minimum value. Treats the leading bit as the sign, i.e. min(-2, 6) = -2.

Example:

// c = min(a, b)
%c = index.mins %a, %b

minu()

Return op name index.minu as a bitstring.

minu(ssa)

index.minu - index unsigned minimum

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.minu operation takes two index values and computes their unsigned minimum value. Treats the leading bit as the most significant, i.e. min(15, 6) = 6 or min(-2, 6) = 6.

Example:

// c = min(a, b)
%c = index.minu %a, %b

mul()

Return op name index.mul as a bitstring.

mul(ssa)

index.mul - index multiplication

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.mul operation takes two index values and computes their product.

Example:

// c = a * b
%c = index.mul %a, %b

or()

Return op name index.or as a bitstring.

or(ssa)

index.or - index bitwise or

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.or operation takes two index values and computes their bitwise or.

Example:

// c = a | b
%c = index.or %a, %b

rems()

Return op name index.rems as a bitstring.

rems(ssa)

index.rems - index signed remainder

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.rems operation takes two index values and computes their signed remainder. Treats the leading bit as the sign, i.e. 6 % -2 = 0.

Example:

// c = a % b
%c = index.rems %a, %b

remu()

Return op name index.remu as a bitstring.

remu(ssa)

index.remu - index unsigned remainder

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.remu operation takes two index values and computes their unsigned remainder. Treats the leading bit as the most significant, i.e. 6 % -2 = 6.

Example:

// c = a % b
%c = index.remu %a, %b

shl()

Return op name index.shl as a bitstring.

shl(ssa)

index.shl - index shift left

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.shl operation shifts an index value to the left by a variable amount. The low order bits are filled with zeroes. The RHS operand is always treated as unsigned. If the RHS operand is equal to or greater than the index bitwidth, the result is a poison value.

Example:

// c = a << b
%c = index.shl %a, %b

shrs()

Return op name index.shrs as a bitstring.

shrs(ssa)

index.shrs - signed index shift right

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.shrs operation shifts an index value to the right by a variable amount. The LHS operand is treated as signed. The high order bits are filled with copies of the most significant bit. If the RHS operand is equal to or greater than the index bitwidth, the result is a poison value.

Example:

// c = a >> b
%c = index.shrs %a, %b

shru()

Return op name index.shru as a bitstring.

shru(ssa)

index.shru - unsigned index shift right

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.shru operation shifts an index value to the right by a variable amount. The LHS operand is treated as unsigned. The high order bits are filled with zeroes. If the RHS operand is equal to or greater than the index bitwidth, the result is a poison value.

Example:

// c = a >> b
%c = index.shru %a, %b

sizeof()

Return op name index.sizeof as a bitstring.

sizeof(ssa)

index.sizeof - size in bits of the index type

This op has support for result type inference.

Results

  • result - Single, Index, index

Description

The index.sizeof operation produces an index-typed SSA value equal to the size in bits of the index type. For example, on 32-bit systems, the result is 32 : index, and on 64-bit systems, the result is 64 : index.

Example:

%0 = index.sizeof

sub()

Return op name index.sub as a bitstring.

sub(ssa)

index.sub - index subtraction

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.sub operation takes two index values and computes the difference of the first from the second operand.

Example:

// c = a - b
%c = index.sub %a, %b

xor()

Return op name index.xor as a bitstring.

xor(ssa)

index.xor - index bitwise xor

This op has support for result type inference.

Operands

  • lhs - Single, Index, index
  • rhs - Single, Index, index

Results

  • result - Single, Index, index

Description

The index.xor operation takes two index values and computes their bitwise xor.

Example:

// c = a ^ b
%c = index.xor %a, %b