test: codegen: Add riscv abi llvm intrinsics test
This commit is contained in:
parent
c872dcf956
commit
37e8e05712
2 changed files with 32 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
// compile-flags: -C no-prepopulate-passes
|
||||
|
||||
// ignore-riscv64
|
||||
|
||||
#![feature(link_llvm_intrinsics)]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
|
|
30
src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
Normal file
30
src/test/codegen/riscv-abi/call-llvm-intrinsics.rs
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue