Skip to content

scalar.bitfield.extracts

scalar dialect

Extract one fixed integer bitfield and sign-extend it into the result.

Operation contract

Property Value
Semantic phase executable
Traits Pure, DistributionTransfer

Signature

Kind Name Type Cardinality Description
Operand source integer required
Result result integer required
Attribute offset i64 required Least-significant bit position of the field within the source.
Attribute width i64 required Number of bits in the extracted field.

Verification constraints

  • SameKind(source, result)
  • BitRangeWithinElementWidth(source, offset, width)
  • ElementWidthAtLeastAttr(result, width)

Examples

%signed_byte = scalar.bitfield.extracts %word {offset = 24, width = 8} : i32 -> i32