diff --git a/example/std_example.rs b/example/std_example.rs index 1337c314766..c0f236055ab 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -36,6 +36,7 @@ fn main() { println!("{}", 2.3f32.min(1.0)); println!("{}", 2.3f32.max(1.0)); println!("{}", 2.3f32.powi(2)); + println!("{}", 2.3f32.log2()); assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26); assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7); diff --git a/src/intrinsics.rs b/src/intrinsics.rs index 5beabfb5ee2..7754e34eb1f 100644 --- a/src/intrinsics.rs +++ b/src/intrinsics.rs @@ -317,6 +317,8 @@ pub fn codegen_intrinsic_call<'a, 'tcx: 'a>( powif64(a, x) -> f64 => __powidf2, // compiler-builtins logf32(flt) -> f32 => logf, logf64(flt) -> f64 => log, + log2f32(flt) -> f32 => log2f, + log2f64(flt) -> f64 => log2, fabsf32(flt) -> f32 => fabsf, fabsf64(flt) -> f64 => fabs, fmaf32(x, y, z) -> f32 => fmaf,