about summary refs log tree commit diff
path: root/tests/codegen/array-optimized.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-10 16:32:41 +0000
committerbors <bors@rust-lang.org>2024-04-10 16:32:41 +0000
commitc2239bca5b89a8d3573cc0fc0f2fa65c50edb79c (patch)
treea4a7023541f6318e82116ac328a7850e53357732 /tests/codegen/array-optimized.rs
parent5974fe87c4d711949caa64fc1e8366685c8fc190 (diff)
parent593e900ad25f1b21cc218ea8bcce3c5e3e94ceac (diff)
downloadrust-c2239bca5b89a8d3573cc0fc0f2fa65c50edb79c.tar.gz
rust-c2239bca5b89a8d3573cc0fc0f2fa65c50edb79c.zip
Auto merge of #123185 - scottmcm:more-typed-copy, r=compiler-errors
Remove my `scalar_copy_backend_type` optimization attempt

I added this back in https://github.com/rust-lang/rust/pull/111999 , but I no longer think it's a good idea
- It had to get scaled back to only power-of-two things to not break a bunch of targets
- LLVM seems to be getting better at memcpy removal anyway
- Introducing vector instructions has seemed to sometimes (https://github.com/rust-lang/rust/pull/115515#issuecomment-1750069529) make autovectorization worse

So this removes it from the codegen crates entirely, and instead just tries to use <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/builder/trait.BuilderMethods.html#method.typed_place_copy> instead of direct `memcpy` so things will still use load/store when a type isn't `OperandValue::Ref`.
Diffstat (limited to 'tests/codegen/array-optimized.rs')
-rw-r--r--tests/codegen/array-optimized.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/codegen/array-optimized.rs b/tests/codegen/array-optimized.rs
index 4cf16f1fb30..42fdbd39b7e 100644
--- a/tests/codegen/array-optimized.rs
+++ b/tests/codegen/array-optimized.rs
@@ -16,8 +16,8 @@ pub fn array_copy_1_element(a: &[u8; 1], p: &mut [u8; 1]) {
 #[no_mangle]
 pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
     // CHECK-NOT: alloca
-    // CHECK: %[[TEMP:.+]] = load <2 x i8>, ptr %a, align 1
-    // CHECK: store <2 x i8> %[[TEMP]], ptr %p, align 1
+    // CHECK: %[[TEMP:.+]] = load i16, ptr %a, align 1
+    // CHECK: store i16 %[[TEMP]], ptr %p, align 1
     // CHECK: ret
     *p = *a;
 }
@@ -26,8 +26,8 @@ pub fn array_copy_2_elements(a: &[u8; 2], p: &mut [u8; 2]) {
 #[no_mangle]
 pub fn array_copy_4_elements(a: &[u8; 4], p: &mut [u8; 4]) {
     // CHECK-NOT: alloca
-    // CHECK: %[[TEMP:.+]] = load <4 x i8>, ptr %a, align 1
-    // CHECK: store <4 x i8> %[[TEMP]], ptr %p, align 1
+    // CHECK: %[[TEMP:.+]] = load i32, ptr %a, align 1
+    // CHECK: store i32 %[[TEMP]], ptr %p, align 1
     // CHECK: ret
     *p = *a;
 }