Skip to content

Commit b67a704

Browse files
Rollup merge of rust-lang#153285 - DeepeshWR:codegen-llvm-sqrt-call-1.94, r=folkertdev
Update call-llvm-intrinsics test for Rust 1.94.0 IR Rust 1.94 now passes constants directly to llvm.sqrt.f32 instead of storing/loading via the stack. - Updated the FileCheck pattern to match the new IR: // CHECK: call float @llvm.sqrt.f32(float 4.000000e+00) The test intent is unchanged: it still ensures the intrinsic is emitted as a 'call' (not 'invoke'). - Removed unnecessary local variables and Drop usage to work in `#![no_core]` mode with minicore. - Added required crate attributes: #![feature(no_core, lang_items)] #![no_std] #![no_core] - Replaced `//@ only-riscv64` (host-based execution) with explicit revisions for: riscv32gc-unknown-linux-gnu riscv64gc-unknown-linux-gnu This ensures deterministic multi-target coverage in CI without relying on the host architecture. - Added `//@ needs-llvm-components: riscv` and `//@ min-llvm-version: 21` for CI compatibility. Fixes rust-lang#153271
2 parents c7cc5e1 + 1d678f6 commit b67a704

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1+
//@ add-minicore
12
//@ compile-flags: -C no-prepopulate-passes
2-
3-
//@ only-riscv64
3+
//@ revisions: riscv32gc riscv64gc
4+
//@ [riscv32gc] compile-flags: --target riscv32gc-unknown-linux-gnu
5+
//@ [riscv32gc] needs-llvm-components: riscv
6+
//@ [riscv64gc] compile-flags: --target riscv64gc-unknown-linux-gnu
7+
//@ [riscv64gc] needs-llvm-components: riscv
8+
//@ min-llvm-version: 21
49

510
#![feature(link_llvm_intrinsics)]
11+
#![feature(no_core, lang_items)]
12+
#![no_std]
13+
#![no_core]
614
#![crate_type = "lib"]
715

8-
struct A;
9-
10-
impl Drop for A {
11-
fn drop(&mut self) {
12-
println!("A");
13-
}
14-
}
16+
extern crate minicore;
17+
use minicore::*;
1518

1619
extern "C" {
1720
#[link_name = "llvm.sqrt.f32"]
1821
fn sqrt(x: f32) -> f32;
1922
}
2023

2124
pub fn do_call() {
22-
let _a = A;
23-
2425
unsafe {
2526
// Ensure that we `call` LLVM intrinsics instead of trying to `invoke` them
26-
// CHECK: store float 4.000000e+00, ptr %{{.}}, align 4
27-
// CHECK: call float @llvm.sqrt.f32(float %{{.}}
27+
// CHECK: call float @llvm.sqrt.f32(float 4.000000e+00)
2828
sqrt(4.0);
2929
}
3030
}

0 commit comments

Comments
 (0)