about summary refs log tree commit diff
path: root/tests/codegen-llvm/array-optimized.rs
diff options
context:
space:
mode:
authorThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-07-24 04:15:39 +0000
committerThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-07-24 04:15:39 +0000
commite5b1e7d192780463c35d3a08ad79c6764119297e (patch)
tree7e4fa13bc2c055d6c08a75275412d50d641d9564 /tests/codegen-llvm/array-optimized.rs
parent11153451845ff40624a3887d6312e563951932b0 (diff)
parentefd420c770bb179537c01063e98cb6990c439654 (diff)
downloadrust-e5b1e7d192780463c35d3a08ad79c6764119297e.tar.gz
rust-e5b1e7d192780463c35d3a08ad79c6764119297e.zip
Merge ref 'efd420c770bb' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: efd420c770bb179537c01063e98cb6990c439654
Filtered ref: d11dbbb02905535a89393e80c24274bee81fa928

This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'tests/codegen-llvm/array-optimized.rs')
-rw-r--r--tests/codegen-llvm/array-optimized.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/codegen-llvm/array-optimized.rs b/tests/codegen-llvm/array-optimized.rs
new file mode 100644
index 00000000000..000163d5519
--- /dev/null
+++ b/tests/codegen-llvm/array-optimized.rs
@@ -0,0 +1,33 @@
+//@ compile-flags: -Copt-level=3
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: @array_copy_1_element
+#[no_mangle]
+pub fn array_copy_1_element(a: &[u8; 1], p: &mut [u8; 1]) {
+    // CHECK-NOT: alloca
+    // CHECK: %[[TEMP:.+]] = load i8, ptr %a, align 1
+    // CHECK: store i8 %[[TEMP]], ptr %p, align 1
+    // CHECK: ret
+    *p = *a;
+}
+
+// CHECK-LABEL: @array_copy_2_elements
+#[no_mangle]
+pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
+    // CHECK-NOT: alloca
+    // CHECK: %[[TEMP:.+]] = load i16, ptr %a, align 1
+    // CHECK: store i16 %[[TEMP]], ptr %p, align 1
+    // CHECK: ret
+    *p = *a;
+}
+
+// CHECK-LABEL: @array_copy_4_elements
+#[no_mangle]
+pub fn array_copy_4_elements(a: &[u8; 4], p: &mut [u8; 4]) {
+    // CHECK-NOT: alloca
+    // CHECK: %[[TEMP:.+]] = load i32, ptr %a, align 1
+    // CHECK: store i32 %[[TEMP]], ptr %p, align 1
+    // CHECK: ret
+    *p = *a;
+}