summaryrefslogtreecommitdiffstats
path: root/tests/ui/codegen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /tests/ui/codegen
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/codegen')
-rw-r--r--tests/ui/codegen/issue-79865-llvm-miscompile.rs38
-rw-r--r--tests/ui/codegen/subtyping-enforces-type-equality.stderr1
2 files changed, 38 insertions, 1 deletions
diff --git a/tests/ui/codegen/issue-79865-llvm-miscompile.rs b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
new file mode 100644
index 000000000..b77f09f8e
--- /dev/null
+++ b/tests/ui/codegen/issue-79865-llvm-miscompile.rs
@@ -0,0 +1,38 @@
+// run-pass
+// only-x86_64
+// compile-flags: -C opt-level=3
+
+// Regression test for issue #79865.
+// The assertion will fail when compiled with Rust 1.56..=1.59
+// due to a LLVM miscompilation.
+
+use std::arch::x86_64::*;
+
+fn main() {
+ if is_x86_feature_detected!("avx") {
+ let res: [f64; 4] = unsafe { std::mem::transmute::<_, _>(first()) };
+ assert_eq!(res, [22.0, 44.0, 66.0, 88.0]);
+ }
+}
+
+#[target_feature(enable = "avx")]
+unsafe fn first() -> __m256d {
+ second()
+}
+
+unsafe fn second() -> __m256d {
+ let v0 = _mm256_setr_pd(1.0, 2.0, 3.0, 4.0);
+ let v1 = _mm256_setr_pd(10.0, 20.0, 30.0, 40.0);
+
+ // needs to be called twice to hit the miscompilation
+ let (add, _) = add_sub(v0, v1);
+ let (add, _) = add_sub(add, add);
+ add
+}
+
+#[inline(never)] // needed to hit the miscompilation
+unsafe fn add_sub(v1: __m256d, v0: __m256d) -> (__m256d, __m256d) {
+ let add = _mm256_add_pd(v0, v1);
+ let sub = _mm256_sub_pd(v0, v1);
+ (add, sub)
+}
diff --git a/tests/ui/codegen/subtyping-enforces-type-equality.stderr b/tests/ui/codegen/subtyping-enforces-type-equality.stderr
deleted file mode 100644
index 870ca0f83..000000000
--- a/tests/ui/codegen/subtyping-enforces-type-equality.stderr
+++ /dev/null
@@ -1 +0,0 @@
-WARN rustc_codegen_ssa::mir::locals Unexpected initial operand type. See the issues/114858