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