Skip to content

vector.bitfield.insert

vector dialect

Insert the low bits of each integer field lane into a fixed bitfield of the corresponding integer base lane. Bits outside the target field are preserved from the base lane.

Operation contract

Property Value
Semantic phase executable
Traits Pure, Elementwise

Signature

Kind Name Type Cardinality Description
Operand field vector required Integer field values. Only the low width bits are inserted.
Operand base vector required Integer base lanes whose target bitfield is replaced.
Result result vector required
Attribute offset i64 required Least-significant bit position of the field within each source lane.
Attribute width i64 required Number of bits in the field extracted or inserted in each lane.

Verification constraints

  • HasIntegerElement(field)
  • HasIntegerElement(base)
  • HasIntegerElement(result)
  • SameShape(field, base, result)
  • SameType(base, result)
  • BitRangeWithinElementWidth(base, offset, width)
  • ElementWidthAtLeastAttr(field, width)

Examples

%packed = vector.bitfield.insert %lo into %zero {offset = 0, width = 4} : vector<16xi32>, vector<16xi8>