2024-02-22 12:10:29 +00:00
|
|
|
//@ compile-flags: -C no-prepopulate-passes -O
|
2016-04-21 21:35:39 +02:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// CHECK-LABEL: @zip_copy
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn zip_copy(xs: &[u8], ys: &mut [u8]) {
|
2024-05-29 14:11:20 +10:00
|
|
|
// CHECK: memcpy
|
2016-04-21 21:35:39 +02:00
|
|
|
for (x, y) in xs.iter().zip(ys) {
|
|
|
|
*y = *x;
|
|
|
|
}
|
|
|
|
}
|
2016-10-17 10:58:21 +02:00
|
|
|
|
|
|
|
// CHECK-LABEL: @zip_copy_mapped
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) {
|
2024-05-29 14:11:20 +10:00
|
|
|
// CHECK: memcpy
|
2016-10-17 10:58:21 +02:00
|
|
|
for (x, y) in xs.iter().map(|&x| x).zip(ys) {
|
|
|
|
*y = x;
|
|
|
|
}
|
|
|
|
}
|