We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 81acbae commit afdfa8cCopy full SHA for afdfa8c
1 file changed
tests/run/call-llvm-intrinsics.rs
@@ -0,0 +1,35 @@
1
+// Compiler:
2
+//
3
+// Run-time:
4
+// status: 0
5
+
6
+#![feature(link_llvm_intrinsics)]
7
+#![allow(internal_features)]
8
9
+struct A;
10
11
+impl Drop for A {
12
+ fn drop(&mut self) {
13
+ println!("A");
14
+ }
15
+}
16
17
+extern "C" {
18
+ #[link_name = "llvm.sqrt.f32"]
19
+ fn sqrt(x: f32) -> f32;
20
21
22
+pub fn do_call() {
23
+ let _a = A;
24
25
+ unsafe {
26
+ // Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
27
+ // CHECK: store float 4.000000e+00, float* %{{.}}, align 4
28
+ // CHECK: call float @llvm.sqrt.f32(float %{{.}}
29
+ sqrt(4.0);
30
31
32
33
+fn main() {
34
+ do_call();
35
0 commit comments