Skip to content

Commit

Permalink
Implement pow{f32,f64} intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Aug 19, 2019
1 parent 95908f6 commit f99d31d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/std_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f99d31d

Please sign in to comment.