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) {
14 // FIXME MIR inlining messes up LLVM optimizations.
15 // WOULD-CHECK-NOT: alloca
16 // WOULD-CHECK: load i48
17 // WOULD-CHECK: store i48
21 // LLVM doesn't vectorize a loop over 3-byte elements,
22 // so we chunk it down to bytes and loop over those instead.
25 // CHECK-LABEL: @swap_rgb24_slices
27 pub fn swap_rgb24_slices(x: &mut [RGB24], y: &mut [RGB24]) {
29 // CHECK: load <{{[0-9]+}} x i8>
30 // CHECK: store <{{[0-9]+}} x i8>
31 if x.len() == y.len() {
36 // This one has a power-of-two size, so we iterate over it directly
37 type RGBA32 = [u8; 4];
39 // CHECK-LABEL: @swap_rgba32_slices
41 pub fn swap_rgba32_slices(x: &mut [RGBA32], y: &mut [RGBA32]) {
43 // CHECK: load <{{[0-9]+}} x i32>
44 // CHECK: store <{{[0-9]+}} x i32>
45 if x.len() == y.len() {
50 // Strings have a non-power-of-two size, but have pointer alignment,
51 // so we swap usizes instead of dropping all the way down to bytes.
52 const _: () = assert!(!std::mem::size_of::<String>().is_power_of_two());
54 // CHECK-LABEL: @swap_string_slices
56 pub fn swap_string_slices(x: &mut [String], y: &mut [String]) {
58 // CHECK: load <{{[0-9]+}} x i64>
59 // CHECK: store <{{[0-9]+}} x i64>
60 if x.len() == y.len() {