]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/example/mod_bench.rs
Rollup merge of #99758 - WaffleLapkin:remove_useless_allow, r=Dylan-DPC
[rust.git] / compiler / rustc_codegen_cranelift / example / mod_bench.rs
1 #![feature(start, core_intrinsics, lang_items)]
2 #![no_std]
3
4 #[cfg_attr(unix, link(name = "c"))]
5 #[cfg_attr(target_env = "msvc", link(name = "msvcrt"))]
6 extern {}
7
8 #[panic_handler]
9 fn panic_handler(_: &core::panic::PanicInfo) -> ! {
10     core::intrinsics::abort();
11 }
12
13 #[lang="eh_personality"]
14 fn eh_personality(){}
15
16 // Required for rustc_codegen_llvm
17 #[no_mangle]
18 unsafe extern "C" fn _Unwind_Resume() {
19     core::intrinsics::unreachable();
20 }
21
22 #[start]
23 fn main(_argc: isize, _argv: *const *const u8) -> isize {
24     for i in 2..10_000_000 {
25         black_box((i + 1) % i);
26     }
27
28     0
29 }
30
31 #[inline(never)]
32 fn black_box(i: u32) {
33     if i != 1 {
34         core::intrinsics::abort();
35     }
36 }