mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
* Make Rust examples more idiomatic * Make 'non-idiomatic' example match the aligned version * Rename examples
9 lines
209 B
Rust
9 lines
209 B
Rust
// Compile with -C opt-level=3 -C target-cpu=native to see autovectorization
|
|
|
|
#[repr(align(64))]
|
|
pub struct Aligned<T: ?Sized>(T);
|
|
|
|
pub fn sum_array(input: &Aligned<[i32]>) -> i32 {
|
|
input.0.iter().sum()
|
|
}
|