view.bitcast
← view dialect
Reinterpret a dense contiguous byte span with another view type. Source and result must have no encoding, byte-addressable scalar elements, and provably equal total bit counts. Shapes may differ, including common SSA dimension factors. The storage root, byte origin, memory space, access rights, and borrowed lifetime are unchanged; this operation allocates, copies, and synchronizes nothing. Element accesses use the target's memory byte order. Result alignment qualifiers govern executed accesses and establish no address facts.
Operation contract
| Property |
Value |
| Semantic phase |
executable |
| Traits |
Pure, RefinableResultTypeRefs, ValueAlias |
Signature
| Kind |
Name |
Type |
Cardinality |
Description |
| Operand |
source |
view |
required |
Dense source view to reinterpret. |
| Result |
result |
view |
required |
Reinterpreted alias of the same byte span. |
Verification constraints
TotalBitCountEqual(source, result)
Examples
%bytes = view.bitcast %words : view<7168xi32> -> view<28672xi8>
%bytes = view.bitcast %words : view<[%count]xi32> -> view<[%count]x4xi8>