about summary refs log tree commit diff
path: root/tests/assembly
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-04-30 19:29:51 +0100
committerGitHub <noreply@github.com>2024-04-30 19:29:51 +0100
commit4b6c1918ee13d5e1f7f24037eb6f21dbd95fce08 (patch)
tree1e3f9b27fc0d71a1ccc18fb71c0906dbca2a7712 /tests/assembly
parentce18639b924554f407099a5b61b698eaf8f64b33 (diff)
parent7032c92b33c978c6a7c24ecca2e02ca27af23147 (diff)
downloadrust-4b6c1918ee13d5e1f7f24037eb6f21dbd95fce08.tar.gz
rust-4b6c1918ee13d5e1f7f24037eb6f21dbd95fce08.zip
Rollup merge of #124299 - clubby789:106269-test, r=nikic
Add test for issue 106269

Closes #106269

Made this an assembly test as the LLVM codegen is still quite verbose and doesn't really indicate the behaviour we want
Diffstat (limited to 'tests/assembly')
-rw-r--r--tests/assembly/manual-eq-efficient.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/assembly/manual-eq-efficient.rs b/tests/assembly/manual-eq-efficient.rs
new file mode 100644
index 00000000000..817ce94f476
--- /dev/null
+++ b/tests/assembly/manual-eq-efficient.rs
@@ -0,0 +1,22 @@
+// Regression test for #106269
+//@ assembly-output: emit-asm
+//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
+//@ only-x86_64
+//@ ignore-sgx
+
+pub struct S {
+    a: u8,
+    b: u8,
+    c: u8,
+    d: u8,
+}
+
+// CHECK-LABEL: manual_eq:
+#[no_mangle]
+pub fn manual_eq(s1: &S, s2: &S) -> bool {
+    // CHECK: mov [[REG:[a-z0-9]+]], dword ptr [{{[a-z0-9]+}}]
+    // CHECK-NEXT: cmp [[REG]], dword ptr [{{[a-z0-9]+}}]
+    // CHECK-NEXT: sete al
+    // CHECK: ret
+    s1.a == s2.a && s1.b == s2.b && s1.c == s2.c && s1.d == s2.d
+}