summary refs log tree commit diff
path: root/src/test/ui/codegen
diff options
context:
space:
mode:
authorCaio <c410.f3r@gmail.com>2021-11-18 12:09:34 -0300
committerCaio <c410.f3r@gmail.com>2021-11-18 12:09:34 -0300
commit41d9abd76cd514aca23e3409fe6896a3a7d61d1a (patch)
treeaff7d6c42e88201c903006083095106fd082f16b /src/test/ui/codegen
parent6414e0b5b308d3ae27da83c6a25098cc8aadc1a9 (diff)
downloadrust-41d9abd76cd514aca23e3409fe6896a3a7d61d1a.tar.gz
rust-41d9abd76cd514aca23e3409fe6896a3a7d61d1a.zip
Move some tests to more reasonable directories
Diffstat (limited to 'src/test/ui/codegen')
-rw-r--r--src/test/ui/codegen/auxiliary/llvm_pr32379.rs5
-rw-r--r--src/test/ui/codegen/init-large-type.rs23
-rw-r--r--src/test/ui/codegen/llvm-pr32379.rs14
3 files changed, 42 insertions, 0 deletions
diff --git a/src/test/ui/codegen/auxiliary/llvm_pr32379.rs b/src/test/ui/codegen/auxiliary/llvm_pr32379.rs
new file mode 100644
index 00000000000..8e429767095
--- /dev/null
+++ b/src/test/ui/codegen/auxiliary/llvm_pr32379.rs
@@ -0,0 +1,5 @@
+pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 {
+    if f1 { data &= !2; }
+    if f2 { data |= 2; }
+    data
+}
diff --git a/src/test/ui/codegen/init-large-type.rs b/src/test/ui/codegen/init-large-type.rs
new file mode 100644
index 00000000000..ce905572f2a
--- /dev/null
+++ b/src/test/ui/codegen/init-large-type.rs
@@ -0,0 +1,23 @@
+// compile-flags: -O
+// run-pass
+
+#![allow(unused_must_use)]
+// Makes sure that zero-initializing large types is reasonably fast,
+// Doing it incorrectly causes massive slowdown in LLVM during
+// optimisation.
+
+// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
+
+#![feature(intrinsics)]
+
+use std::{mem, thread};
+
+const SIZE: usize = 1024 * 1024;
+
+fn main() {
+    // do the test in a new thread to avoid (spurious?) stack overflows
+    thread::spawn(|| {
+        let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
+    }).join();
+}
diff --git a/src/test/ui/codegen/llvm-pr32379.rs b/src/test/ui/codegen/llvm-pr32379.rs
new file mode 100644
index 00000000000..8a1f03241b1
--- /dev/null
+++ b/src/test/ui/codegen/llvm-pr32379.rs
@@ -0,0 +1,14 @@
+// run-pass
+// aux-build:llvm_pr32379.rs
+
+// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
+// applies to upstream LLVM 3.9.1, is known to cause rustc itself to be
+// miscompiled on ARM (Rust issue #40593). Because cross builds don't test
+// our *compiler* on ARM, have a test for the miscompilation directly.
+
+extern crate llvm_pr32379;
+
+pub fn main() {
+    let val = llvm_pr32379::pr32379(2, false, false);
+    assert_eq!(val, 2);
+}