Added a nanosecond timer to time.rs, support for some floating point casts, and a commandline-driven mode for pfib.rs

This commit is contained in:
Eric Holk 2011-06-28 17:58:44 -07:00
parent 441c7e0610
commit b4a145e60f
7 changed files with 95 additions and 33 deletions

View file

@ -5113,7 +5113,22 @@ fn trans_cast(&@block_ctxt cx, &@ast::expr e, ast::node_id id) -> result {
int_cast(e_res.bcx, lldsttype, llsrctype, e_res.val,
ty::type_is_signed(cx.fcx.lcx.ccx.tcx, t)));
}
} else { cx.fcx.lcx.ccx.sess.unimpl("fp cast"); }
}
else {
if (ty::type_is_integral(cx.fcx.lcx.ccx.tcx,
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e))) {
if (ty::type_is_signed(cx.fcx.lcx.ccx.tcx,
ty::expr_ty(cx.fcx.lcx.ccx.tcx, e))) {
e_res = rslt(e_res.bcx,
e_res.bcx.build.SIToFP(e_res.val, lldsttype));
}
else {
e_res = rslt(e_res.bcx,
e_res.bcx.build.UIToFP(e_res.val, lldsttype));
}
}
else { cx.fcx.lcx.ccx.sess.unimpl("fp cast"); }
}
ret e_res;
}