//! An array repeat literal of more than 32 aggregate elements of 1, 2, 4, or 8 bytes fills the //! array in double words, as one of scalar elements does. The IL loads the bytes of the item once, //! in pieces of the item alignment, combines the pieces, and replicates the result into a word. A //! tail element is stored as an integer of the item size. An aggregate item of another size keeps //! the fill loop of one blit per element. This IL snapshot covers each case. /// Record of two 32-bit fields, 8 bytes with alignment 4. record Pair: Copy { /// First field. a: u32, /// Second field. b: u32, } /// Record of a halfword and a byte, 4 bytes with alignment 2. record Small: Copy { /// Halfword field. prefix: u16, /// Byte field. suffix: u8, } /// Record of a 64-bit field, 8 bytes with alignment 8. record Wide: Copy { /// Field. value: u64, } /// Record of five 32-bit fields, 20 bytes. record Node: Copy { /// First field. a: u32, /// Second field. b: u32, /// Third field. c: u32, /// Fourth field. d: u32, /// Fifth field. e: u32, } /// Fill 40 pairs: two word loads of the item, and a loop that stores 64 bytes per iteration. fn pairs(x: u32) -> u32 { let a: [Pair; 40] = [Pair { a: x, b: 0 }; 40]; return a[3].a; } /// Fill 35 small records: two halfword loads, and a tail of one word and one element. fn smalls(x: u16) -> u16 { let a: [Small; 35] = [Small { prefix: x, suffix: 1 }; 35]; return a[3].prefix; } /// Fill 40 wide records: a record of one field is a scalar, so the item needs no loads. fn wides(x: u64) -> u64 { let a: [Wide; 40] = [Wide { value: x }; 40]; return a[3].value; } /// Fill 33 byte arrays of four elements: one byte piece per element. fn arrays(x: u8) -> u8 { let a: [[u8; 4]; 33] = [[x, 2, 3, 4]; 33]; return a[3][1]; } /// Fill 40 nodes of 20 bytes, each by a blit. fn nodes(x: u32) -> u32 { let a: [Node; 40] = [Node { a: x, b: 0, c: 0, d: 0, e: 0 }; 40]; return a[3].a; } @default fn main() -> i32 { return 0; }