]> git.lizzy.rs Git - rust.git/blob - tests/codegen/call-llvm-intrinsics.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / codegen / call-llvm-intrinsics.rs
1 // compile-flags: -C no-prepopulate-passes -Copt-level=0
2
3 // ignore-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: call float @llvm.sqrt.f32(float 4.000000e+00
27         sqrt(4.0);
28     }
29 }