about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs')
-rw-r--r--compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs b/compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs
new file mode 100644
index 00000000000..decae5bfcd7
--- /dev/null
+++ b/compiler/rustc_codegen_gcc/tests/run/switchint_128bit.rs
@@ -0,0 +1,37 @@
+// Compiler:
+//
+// Run-time:
+//   status: 0
+
+#![feature(no_core)]
+#![no_std]
+#![no_core]
+#![no_main]
+
+extern crate mini_core;
+use intrinsics::black_box;
+use mini_core::*;
+
+#[no_mangle]
+extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
+    // 1st. Check that small 128 bit values work.
+    let val = black_box(64_u128);
+    match val {
+        0 => return 1,
+        1 => return 2,
+        64 => (),
+        _ => return 3,
+    }
+    // 2nd check that *large* values work.
+    const BIG: u128 = 0xDEAD_C0FE_BEEF_DECAF_BADD_DECAF_BEEF_u128;
+    let val = black_box(BIG);
+    match val {
+        0 => return 4,
+        1 => return 5,
+        // Check that we will not match on the lower u64, if the upper qword is different!
+        0xcafbadddecafbeef => return 6,
+        0xDEAD_C0FE_BEEF_DECAF_BADD_DECAF_BEEF_u128 => (),
+        _ => return 7,
+    }
+    0
+}