Implement log2{f32,f64} intrinsics

This commit is contained in:
bjorn3 2019-08-12 15:54:24 +02:00
parent 7633bb6902
commit 314141392a
2 changed files with 3 additions and 0 deletions

View File

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

View File

@ -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,