diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2019-08-19 17:16:21 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2019-08-19 17:16:21 +0200 |
| commit | f99d31dbfedd10ed3bb66bea1184065bd841f44c (patch) | |
| tree | a1b8b3564554969b36f990401697e5745b81797a | |
| parent | 95908f61a0c4e0cb874f5fbb882399a82003ae51 (diff) | |
| download | rust-f99d31dbfedd10ed3bb66bea1184065bd841f44c.tar.gz rust-f99d31dbfedd10ed3bb66bea1184065bd841f44c.zip | |
Implement pow{f32,f64} intrinsics
| -rw-r--r-- | example/std_example.rs | 1 | ||||
| -rw-r--r-- | src/intrinsics.rs | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/example/std_example.rs b/example/std_example.rs index 2aa2235d7bd..f16ff592d4c 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -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); diff --git a/src/intrinsics.rs b/src/intrinsics.rs index c12730da758..e09dc25f4ab 100644 --- a/src/intrinsics.rs +++ b/src/intrinsics.rs @@ -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, |
