Implement pow{f32,f64} intrinsics

This commit is contained in:
bjorn3 2019-08-19 17:16:21 +02:00
parent 95908f61a0
commit f99d31dbfe
2 changed files with 3 additions and 0 deletions

View File

@ -36,6 +36,7 @@ fn main() {
println!("{}", 2.3f32.powi(2));
println!("{}", 2.3f32.log2());
assert_eq!(2.3f32.copysign(-1.0), -2.3f32);
println!("{}", 2.3f32.powf(2.0));
assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);

View File

@ -318,6 +318,8 @@ pub fn codegen_intrinsic_call<'tcx>(
sqrtf64(flt) -> f64 => sqrt,
powif32(a, x) -> f32 => __powisf2, // compiler-builtins
powif64(a, x) -> f64 => __powidf2, // compiler-builtins
powf32(a, x) -> f32 => powf,
powf64(a, x) -> f64 => pow,
logf32(flt) -> f32 => logf,
logf64(flt) -> f64 => log,
log2f32(flt) -> f32 => log2f,