From 462a28d0030a52eaaf3233219a4a892903f631b0 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 21 Oct 2013 14:09:42 -0400 Subject: [PATCH] fix the new floating point intrinsics --- src/librustc/middle/trans/base.rs | 16 ++++++++-------- src/librustc/middle/trans/intrinsic.rs | 14 +++++++------- src/librustc/middle/typeck/check/mod.rs | 4 ++-- src/libstd/unstable/intrinsics.rs | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index f6a70a373c684..6cb63f9e1a164 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -2797,8 +2797,8 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> { ifn!(intrinsics, "llvm.fabs.f32", [Type::f32()], Type::f32()); ifn!(intrinsics, "llvm.fabs.f64", [Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.copysign.f32", [Type::f32()], Type::f32()); - ifn!(intrinsics, "llvm.copysign.f64", [Type::f64()], Type::f64()); + ifn!(intrinsics, "llvm.copysign.f32", [Type::f32(), Type::f32()], Type::f32()); + ifn!(intrinsics, "llvm.copysign.f64", [Type::f64(), Type::f64()], Type::f64()); ifn!(intrinsics, "llvm.floor.f32",[Type::f32()], Type::f32()); ifn!(intrinsics, "llvm.floor.f64",[Type::f64()], Type::f64()); @@ -2807,12 +2807,12 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> { ifn!(intrinsics, "llvm.trunc.f32",[Type::f32()], Type::f32()); ifn!(intrinsics, "llvm.trunc.f64",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.rint.f32",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.rint.f64",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.nearbyint.f32",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.nearbyint.f64",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.round.f32",[Type::f64()], Type::f64()); - ifn!(intrinsics, "llvm.round.f64",[Type::f64()], Type::f64()); + ifn!(intrinsics, "llvm.rint.f32", [Type::f32()], Type::f32()); + ifn!(intrinsics, "llvm.rint.f64", [Type::f64()], Type::f64()); + ifn!(intrinsics, "llvm.nearbyint.f32", [Type::f32()], Type::f32()); + ifn!(intrinsics, "llvm.nearbyint.f64", [Type::f64()], Type::f64()); + ifn!(intrinsics, "llvm.round.f32", [Type::f32()], Type::f32()); + ifn!(intrinsics, "llvm.round.f64", [Type::f64()], Type::f64()); ifn!(intrinsics, "llvm.ctpop.i8", [Type::i8()], Type::i8()); ifn!(intrinsics, "llvm.ctpop.i16",[Type::i16()], Type::i16()); diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index a37ec29973a8e..6334677a40695 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -460,20 +460,20 @@ pub fn trans_intrinsic(ccx: @mut CrateContext, "fmaf64" => simple_llvm_intrinsic(bcx, "llvm.fma.f64", 3), "fabsf32" => simple_llvm_intrinsic(bcx, "llvm.fabs.f32", 1), "fabsf64" => simple_llvm_intrinsic(bcx, "llvm.fabs.f64", 1), - "copysignf32" => simple_llvm_intrinsic(bcx, "llvm.copysign.f32", 1), - "copysignf64" => simple_llvm_intrinsic(bcx, "llvm.copysign.f64", 1), + "copysignf32" => simple_llvm_intrinsic(bcx, "llvm.copysign.f32", 2), + "copysignf64" => simple_llvm_intrinsic(bcx, "llvm.copysign.f64", 2), "floorf32" => simple_llvm_intrinsic(bcx, "llvm.floor.f32", 1), "floorf64" => simple_llvm_intrinsic(bcx, "llvm.floor.f64", 1), "ceilf32" => simple_llvm_intrinsic(bcx, "llvm.ceil.f32", 1), "ceilf64" => simple_llvm_intrinsic(bcx, "llvm.ceil.f64", 1), "truncf32" => simple_llvm_intrinsic(bcx, "llvm.trunc.f32", 1), "truncf64" => simple_llvm_intrinsic(bcx, "llvm.trunc.f64", 1), - "rintf64" => simple_llvm_intrinsic(bcx, "llvm.rint.f64", 1), "rintf32" => simple_llvm_intrinsic(bcx, "llvm.rint.f32", 1), - "nearbyintf32" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f64", 1), - "nearbyintf64" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f32", 1), - "roundf32" => simple_llvm_intrinsic(bcx, "llvm.round.f64", 1), - "roundf64" => simple_llvm_intrinsic(bcx, "llvm.round.f32", 1), + "rintf64" => simple_llvm_intrinsic(bcx, "llvm.rint.f64", 1), + "nearbyintf32" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f32", 1), + "nearbyintf64" => simple_llvm_intrinsic(bcx, "llvm.nearbyint.f64", 1), + "roundf32" => simple_llvm_intrinsic(bcx, "llvm.round.f32", 1), + "roundf64" => simple_llvm_intrinsic(bcx, "llvm.round.f64", 1), "ctpop8" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i8", 1), "ctpop16" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i16", 1), "ctpop32" => simple_llvm_intrinsic(bcx, "llvm.ctpop.i32", 1), diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index fce24e15bdc20..627216ea7b77b 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -3809,8 +3809,8 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) { } "fabsf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()), "fabsf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()), - "copysignf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()), - "copysignf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()), + "copysignf32" => (0, ~[ ty::mk_f32(), ty::mk_f32() ], ty::mk_f32()), + "copysignf64" => (0, ~[ ty::mk_f64(), ty::mk_f64() ], ty::mk_f64()), "floorf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()), "floorf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()), "ceilf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()), diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs index 8959d591c37eb..c9e1b5b3b008d 100644 --- a/src/libstd/unstable/intrinsics.rs +++ b/src/libstd/unstable/intrinsics.rs @@ -414,9 +414,9 @@ extern "rust-intrinsic" { pub fn fabsf64(x: f64) -> f64; #[cfg(not(stage0))] - pub fn copysignf32(x: f32) -> f32; + pub fn copysignf32(x: f32, y: f32) -> f32; #[cfg(not(stage0))] - pub fn copysignf64(x: f64) -> f64; + pub fn copysignf64(x: f64, y: f64) -> f64; pub fn floorf32(x: f32) -> f32; pub fn floorf64(x: f64) -> f64;