diff --git a/src/test/codegen/call-llvm-intrinsics.rs b/src/test/codegen/call-llvm-intrinsics.rs index c7a464a9b0ef2..24e3d3cd64b58 100644 --- a/src/test/codegen/call-llvm-intrinsics.rs +++ b/src/test/codegen/call-llvm-intrinsics.rs @@ -1,5 +1,7 @@ // compile-flags: -C no-prepopulate-passes +// ignore-riscv64 + #![feature(link_llvm_intrinsics)] #![crate_type = "lib"] diff --git a/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs b/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs new file mode 100644 index 0000000000000..f100a23a31897 --- /dev/null +++ b/src/test/codegen/riscv-abi/call-llvm-intrinsics.rs @@ -0,0 +1,30 @@ +// compile-flags: -C no-prepopulate-passes + +// only-riscv64 + +#![feature(link_llvm_intrinsics)] +#![crate_type = "lib"] + +struct A; + +impl Drop for A { + fn drop(&mut self) { + println!("A"); + } +} + +extern { + #[link_name = "llvm.sqrt.f32"] + fn sqrt(x: f32) -> f32; +} + +pub fn do_call() { + let _a = A; + + unsafe { + // Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them + // CHECK: store float 4.000000e+00, float* %{{.}}, align 4 + // CHECK: call float @llvm.sqrt.f32(float %{{.}} + sqrt(4.0); + } +}