]> git.lizzy.rs Git - rust.git/blob - tests/codegen/riscv-abi/call-llvm-intrinsics.rs
Rollup merge of #106605 - notriddle:notriddle/outdated-rustbook, r=GuillaumeGomez
[rust.git] / tests / codegen / riscv-abi / call-llvm-intrinsics.rs
1 // compile-flags: -C no-prepopulate-passes
2
3 // only-riscv64
4
5 #![feature(link_llvm_intrinsics)]
6 #![crate_type = "lib"]
7
8 struct A;
9
10 impl Drop for A {
11     fn drop(&mut self) {
12         println!("A");
13     }
14 }
15
16 extern "C" {
17     #[link_name = "llvm.sqrt.f32"]
18     fn sqrt(x: f32) -> f32;
19 }
20
21 pub fn do_call() {
22     let _a = A;
23
24     unsafe {
25         // Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
26         // CHECK: store float 4.000000e+00, float* %{{.}}, align 4
27         // CHECK: call float @llvm.sqrt.f32(float %{{.}}
28         sqrt(4.0);
29     }
30 }