3 // ignore-debug: the debug assertions get in the way
11 // CHECK-LABEL: @swap_rgb48
13 pub fn swap_rgb48(x: &mut RGB48, y: &mut RGB48) {
20 // LLVM doesn't vectorize a loop over 3-byte elements,
21 // so we chunk it down to bytes and loop over those instead.
24 // CHECK-LABEL: @swap_rgb24_slices
26 pub fn swap_rgb24_slices(x: &mut [RGB24], y: &mut [RGB24]) {
28 // CHECK: load <{{[0-9]+}} x i8>
29 // CHECK: store <{{[0-9]+}} x i8>
30 if x.len() == y.len() {
35 // This one has a power-of-two size, so we iterate over it directly
36 type RGBA32 = [u8; 4];
38 // CHECK-LABEL: @swap_rgba32_slices
40 pub fn swap_rgba32_slices(x: &mut [RGBA32], y: &mut [RGBA32]) {
42 // CHECK: load <{{[0-9]+}} x i32>
43 // CHECK: store <{{[0-9]+}} x i32>
44 if x.len() == y.len() {
49 // Strings have a non-power-of-two size, but have pointer alignment,
50 // so we swap usizes instead of dropping all the way down to bytes.
51 const _: () = assert!(!std::mem::size_of::<String>().is_power_of_two());
53 // CHECK-LABEL: @swap_string_slices
55 pub fn swap_string_slices(x: &mut [String], y: &mut [String]) {
57 // CHECK: load <{{[0-9]+}} x i64>
58 // CHECK: store <{{[0-9]+}} x i64>
59 if x.len() == y.len() {