test: codegen: Add riscv abi llvm intrinsics test

This commit is contained in:
Tom Eccles 2020-06-04 11:13:52 +01:00
parent c872dcf956
commit 37e8e05712
2 changed files with 32 additions and 0 deletions

View file

@ -1,5 +1,7 @@
// compile-flags: -C no-prepopulate-passes
// ignore-riscv64
#![feature(link_llvm_intrinsics)]
#![crate_type = "lib"]

View file

@ -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);
}
}