let usize_layout = fx.layout_of(fx.tcx.types.usize);
let ret = return_place.unwrap();
match intrinsic {
+ "abort" => {
+ fx.bcx.ins().trap(TrapCode::User(!0 - 1));
+ }
"copy" | "copy_nonoverlapping" => {
/*let elem_ty = substs.type_at(0);
assert_eq!(args.len(), 3);
let size_of = CValue::const_val(fx, usize_layout.ty, size_of as i64);
ret.write_cvalue(fx, size_of);
}
+ "type_id" => {
+ assert_eq!(args.len(), 0);
+ let type_id = fx.tcx.type_id_hash(substs.type_at(0));
+ let type_id = CValue::const_val(fx, usize_layout.ty, type_id as i64);
+ ret.write_cvalue(fx, type_id);
+ }
+ "min_align_of" => {
+ assert_eq!(args.len(), 0);
+ let min_align = fx.layout_of(substs.type_at(0)).align.abi();
+ let min_align = CValue::const_val(fx, usize_layout.ty, min_align as i64);
+ ret.write_cvalue(fx, min_align);
+ }
_ if intrinsic.starts_with("unchecked_") => {
assert_eq!(args.len(), 2);
let lhs = args[0].load_value(fx);
let dst_layout = fx.layout_of(dst_ty);
ret.write_cvalue(fx, CValue::ByRef(addr, dst_layout))
}
+ "uninit" => {
+ assert_eq!(args.len(), 0);
+ let ty = substs.type_at(0);
+ let layout = fx.layout_of(ty);
+ let stack_slot = fx.bcx.create_stack_slot(StackSlotData {
+ kind: StackSlotKind::ExplicitSlot,
+ size: layout.size.bytes() as u32,
+ offset: None,
+ });
+
+ let uninit_place = CPlace::from_stack_slot(fx, stack_slot, ty);
+ let uninit_val = uninit_place.to_cvalue(fx);
+ ret.write_cvalue(fx, uninit_val);
+ }
_ => fx.tcx.sess.fatal(&format!("unsupported intrinsic {}", intrinsic)),
}
if let Some((_, dest)) = *destination {
fn trans_float_binop<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, bin_op: BinOp, lhs: Value, rhs: Value, ty: Ty<'tcx>) -> CValue<'tcx> {
let res = binop_match! {
- fx, bin_op, false, lhs, rhs, "bool";
+ fx, bin_op, false, lhs, rhs, "float";
Add (_) fadd;
Sub (_) fsub;
Mul (_) fmul;