Skip to content

Commit 4fecc36

Browse files
committed
Don't inline floor into rem_pio2_large when implemented with asm, to fix no_panic
1 parent 71f73a5 commit 4fecc36

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

libm/src/math/rem_pio2_large.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* ====================================================
1212
*/
1313

14-
use super::{floor, scalbn};
14+
use super::scalbn;
1515

1616
// initial value for jk
1717
const INIT_JK: [usize; 4] = [3, 4, 4, 6];
@@ -223,6 +223,14 @@ const PIO2: [f64; 8] = [
223223
/// independent of the exponent of the input.
224224
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
225225
pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) -> i32 {
226+
// FIXME: Use of inline assembly would currently cause this function to be
227+
// considered potentially unwinding for any callers, causing them to fail `no_panic`.
228+
// As a workaround, avoid inlining `floor` here when implemented with assembly.
229+
#[cfg_attr(x86_no_sse, inline(never))]
230+
extern "C" fn floor(x: f64) -> f64 {
231+
super::floor(x)
232+
}
233+
226234
let x1p24 = f64::from_bits(0x4170000000000000); // 0x1p24 === 2 ^ 24
227235
let x1p_24 = f64::from_bits(0x3e70000000000000); // 0x1p_24 === 2 ^ (-24)
228236

0 commit comments

Comments
 (0)