Implement copysign{f32,f64} intrinsics

This commit is contained in:
bjorn3 2019-08-19 15:48:32 +02:00
parent ce860e5fde
commit edbb5730ea
2 changed files with 4 additions and 0 deletions

View File

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

View File

@ -326,8 +326,11 @@ pub fn codegen_intrinsic_call<'tcx>(
fabsf64(flt) -> f64 => fabs,
fmaf32(x, y, z) -> f32 => fmaf,
fmaf64(x, y, z) -> f64 => fma,
copysignf32(x, y) -> f32 => copysignf,
copysignf64(x, y) -> f64 => copysign,
// rounding variants
// FIXME use clif insts
floorf32(flt) -> f32 => floorf,
floorf64(flt) -> f64 => floor,
ceilf32(flt) -> f32 => ceilf,