Skip to content

vector.splat

vector dialect

Replicate one scalar value to every lane of a vector result. The annotation after ':' is the result vector type; the scalar operand must already have the same element type, so conversions must be spelled with scalar/vector cast ops before or after the splat.

Operation contract

Property Value
Semantic phase executable
Traits Pure, RefinableResultTypeRefs

Signature

Kind Name Type Cardinality Description
Operand scalar scalar required
Result result vector required

Verification constraints

  • SameElementType(scalar, result)

Examples

%vec = vector.splat %scalar : vector<16xf32>
%vec = vector.splat %scalar : vector<[%n]xi32>