Skip to content

scalar.constant

scalar dialect

Materialize a compile-time integer or floating-point scalar value. Fixed-width integer literals use their signed value domain; unsigned operations interpret the resulting bit pattern. Logical coordinate and byte-offset constants use index.constant.

Operation contract

Property Value
Semantic phase executable
Traits Pure, ConstantLike

Signature

Kind Name Type Cardinality Description
Result result payload_scalar required
Attribute value any required The constant value.

Verification constraints

  • AttrMatchesElementType(value, result)

Examples

%c42 = scalar.constant 42 : i32
%pi = scalar.constant 3.14159265358979 : f32
%true = scalar.constant 1 : i1