about summary refs log tree commit diff
path: root/tests/codegen-llvm/zip.rs
blob: 38ecf7c15c675a106a0a0a8fbbb66c9e615866bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ compile-flags: -Cno-prepopulate-passes -Copt-level=3

#![crate_type = "lib"]

// CHECK-LABEL: @zip_copy
#[no_mangle]
pub fn zip_copy(xs: &[u8], ys: &mut [u8]) {
    // CHECK: memcpy
    for (x, y) in xs.iter().zip(ys) {
        *y = *x;
    }
}

// CHECK-LABEL: @zip_copy_mapped
#[no_mangle]
pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) {
    // CHECK: memcpy
    for (x, y) in xs.iter().map(|&x| x).zip(ys) {
        *y = x;
    }
}