]>
git.proxmox.com Git - rustc.git/blob - tests/assembly/target-feature-multiple.rs
1 // assembly-output: emit-asm
2 // needs-llvm-components: x86
3 // revisions: TWOFLAGS SINGLEFLAG
4 // compile-flags: --target=x86_64-unknown-linux-gnu
5 // [TWOFLAGS] compile-flags: -C target-feature=+rdrnd -C target-feature=+rdseed
6 // [SINGLEFLAG] compile-flags: -C target-feature=+rdrnd,+rdseed
8 // Target features set via flags aren't necessarily reflected in the IR, so the only way to test
9 // them is to build code that requires the features to be enabled to work.
11 // In this particular test if `rdrnd,rdseed` somehow didn't make it to LLVM, the instruction
12 // selection should crash.
14 // > LLVM ERROR: Cannot select: 0x7f00f400c010: i32,i32,ch = X86ISD::RDSEED 0x7f00f400bfa8:2
17 // See also tests/codegen/target-feature-overrides.rs
18 #![feature(no_core, lang_items, link_llvm_intrinsics, abi_unadjusted)]
19 #![crate_type = "lib"]
28 // Use of these requires target features to be enabled
30 #[link_name = "llvm.x86.rdrand.32"]
31 fn x86_rdrand32_step() -> (u32, i32);
32 #[link_name = "llvm.x86.rdseed.32"]
33 fn x86_rdseed32_step() -> (u32, i32);
37 pub unsafe fn foo() -> (u32, u32) {
41 (x86_rdrand32_step().0, x86_rdseed32_step().0)