--- /dev/null
+From cc175e6a3f59c7fe1523fd441214e0303f8fee80 Mon Sep 17 00:00:00 2001
+From: bjorn3 <bjorn3@users.noreply.github.com>
+Date: Sat, 30 Jun 2018 12:30:30 +0200
+Subject: [PATCH] Disable stdsimd in libcore
+
+---
+ src/libcore/lib.rs | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
+index 40caee8554..f038d155a1 100644
+--- a/src/libcore/lib.rs
++++ b/src/libcore/lib.rs
+@@ -240,6 +240,7 @@ macro_rules! test_v256 { ($item:item) => {}; }
+ macro_rules! test_v512 { ($item:item) => {}; }
+ #[allow(unused_macros)]
+ macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*);)* } }
++/*
+ #[path = "../stdsimd/coresimd/mod.rs"]
+ #[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
+ #[unstable(feature = "stdsimd", issue = "48556")]
+@@ -252,3 +253,4 @@ pub use coresimd::simd;
+ #[stable(feature = "simd_arch", since = "1.27.0")]
+ #[cfg(not(stage0))]
+ pub use coresimd::arch;
++*/
+--
+2.15.2 (Apple Git-101.1)
+
offset: None,
});
let ty = mir.local_decls[local].ty;
- let cton_type = ::common::fixup_cton_ty(fx.cton_type(ty).unwrap_or(types::I64));
+ let cton_type = fx.cton_type(ty).unwrap_or(types::I64);
(local, fx.bcx.append_ebb_param(start_ebb, cton_type), ty, stack_slot)
}).collect::<Vec<(Local, Value, Ty, StackSlot)>>();
trans_stmt(fx, stmt);
}
- match &bb_data.terminator().kind {
+ let inst = match &bb_data.terminator().kind {
TerminatorKind::Goto { target } => {
let ebb = fx.get_ebb(*target);
- fx.bcx.ins().jump(ebb, &[]);
+ fx.bcx.ins().jump(ebb, &[])
}
TerminatorKind::Return => {
- fx.bcx.ins().return_(&[]);
+ fx.bcx.ins().return_(&[])
}
TerminatorKind::Assert { cond, expected, msg: _, target, cleanup: _ } => {
let cond = trans_operand(fx, cond).load_value(fx);
let target = fx.get_ebb(*target);
- if *expected {
- fx.bcx.ins().brz(cond, target, &[]);
+ let inst = if *expected {
+ fx.bcx.ins().brz(cond, target, &[])
} else {
- fx.bcx.ins().brnz(cond, target, &[]);
- }
+ fx.bcx.ins().brnz(cond, target, &[])
+ };
fx.bcx.ins().trap(TrapCode::User(!0));
+ inst
}
TerminatorKind::SwitchInt { discr, switch_ty, values, targets } => {
jt_data.set_entry(*value as usize, ebb);
}
let mut jump_table = fx.bcx.create_jump_table(jt_data);
- fx.bcx.ins().br_table(discr, jump_table);
+ let inst = fx.bcx.ins().br_table(discr, jump_table);
let otherwise_ebb = fx.get_ebb(targets[targets.len() - 1]);
fx.bcx.ins().jump(otherwise_ebb, &[]);
+ inst
}
TerminatorKind::Call { func, args, destination, cleanup: _ } => {
let func_ty = func.ty(&fx.mir.local_decls, fx.tcx);
}
})
).collect::<Vec<_>>();
- match func {
+ let inst = match func {
CValue::Func(func, _) => {
- fx.bcx.ins().call(func, &args);
+ fx.bcx.ins().call(func, &args)
}
func => {
let func = func.load_value(fx);
_ => bug!("Calling non function type {:?}", func_ty),
};
let sig = fx.bcx.import_signature(cton_sig_from_fn_sig(fx.tcx, sig, fx.param_substs));
- fx.bcx.ins().call_indirect(sig, func, &args);
+ fx.bcx.ins().call_indirect(sig, func, &args)
}
- }
+ };
if let Some((_, dest)) = *destination {
let ret_ebb = fx.get_ebb(dest);
fx.bcx.ins().jump(ret_ebb, &[]);
} else {
fx.bcx.ins().trap(TrapCode::User(!0));
}
+ inst
}
TerminatorKind::Resume | TerminatorKind::Abort | TerminatorKind::Unreachable => {
- fx.bcx.ins().trap(TrapCode::User(!0));
+ fx.bcx.ins().trap(TrapCode::User(!0))
}
TerminatorKind::Yield { .. } |
TerminatorKind::FalseEdges { .. } |
// TODO call drop impl
// unimplemented!("terminator {:?}", bb_data.terminator());
let target_ebb = fx.get_ebb(*target);
- fx.bcx.ins().jump(target_ebb, &[]);
+ fx.bcx.ins().jump(target_ebb, &[])
}
TerminatorKind::GeneratorDrop => {
unimplemented!("terminator GeneratorDrop");
}
- }
+ };
+
+ let mut terminator_head = "\n".to_string();
+ bb_data.terminator().kind.fmt_head(&mut terminator_head).unwrap();
+ fx.bcx.func.comments[inst] = terminator_head;
}
fx.bcx.seal_all_blocks();
}
fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, stmt: &Statement<'tcx>) {
+ let nop_inst = fx.bcx.ins().nop();
+
match &stmt.kind {
StatementKind::SetDiscriminant { place, variant_index } => {
let place = trans_place(fx, place);
rval => unimplemented!("rval {:?}", rval),
}
}
- StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::Nop => {}
+ StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::Nop => {
+ fx.bcx.ins().nop();
+ }
_ => unimplemented!("stmt {:?}", stmt),
}
+
+ let inst = fx.bcx.func.layout.next_inst(nop_inst).unwrap();
+ fx.bcx.func.layout.remove_inst(nop_inst);
+ fx.bcx.func.comments[inst] = format!("{:?}", stmt);
}
fn trans_int_binop<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, bin_op: BinOp, lhs: Value, rhs: Value, ty: Ty<'tcx>, signed: bool, checked: bool) -> CValue<'tcx> {
})
}
-// FIXME(cretonne) fix types smaller than I32
-pub fn fixup_cton_ty(ty: Type) -> Type {
- match ty {
- types::I64X2 | types::I64 | types::I32 => ty,
- _ => types::I32,
- }
-}
-
-// FIXME(cretonne) fix load.i8
-fn load_workaround(fx: &mut FunctionCx, ty: Type, addr: Value, offset: i32) -> Value {
- use cretonne::codegen::ir::types::*;
- match ty {
- I8 => fx.bcx.ins().uload8(I32, MemFlags::new(), addr, offset),
- I16 => fx.bcx.ins().uload16(I32, MemFlags::new(), addr, offset),
- // I32 and I64 work
- _ => fx.bcx.ins().load(ty, MemFlags::new(), addr, offset),
- }
-}
-
-// FIXME(cretonne) fix store.i8
-fn store_workaround(fx: &mut FunctionCx, ty: Type, addr: Value, val: Value, offset: i32) {
- use cretonne::codegen::ir::types::*;
- match ty {
- I8 => fx.bcx.ins().istore8(MemFlags::new(), val, addr, offset),
- I16 => fx.bcx.ins().istore16(MemFlags::new(), val, addr, offset),
- // I32 and I64 work
- _ => fx.bcx.ins().store(MemFlags::new(), val, addr, offset),
- };
-}
-
#[derive(Debug, Copy, Clone)]
pub enum CValue<'tcx> {
ByRef(Value, TyLayout<'tcx>),
pub fn load_value<'a>(self, fx: &mut FunctionCx<'a, 'tcx>) -> Value where 'tcx: 'a{
match self {
- CValue::ByRef(value, layout) => {
+ CValue::ByRef(addr, layout) => {
let cton_ty = fx.cton_type(layout.ty).expect(&format!("{:?}", layout.ty));
- load_workaround(fx, cton_ty, value, 0)
+ fx.bcx.ins().load(cton_ty, MemFlags::new(), addr, 0)
}
CValue::ByVal(value, _layout) => value,
CValue::Func(func, _layout) => {
pub fn const_val<'a>(fx: &mut FunctionCx<'a, 'tcx>, ty: Ty<'tcx>, const_val: i64) -> CValue<'tcx> where 'tcx: 'a {
let cton_ty = fx.cton_type(ty).unwrap();
- let cton_ty = fixup_cton_ty(cton_ty);
let layout = fx.layout_of(ty);
CValue::ByVal(fx.bcx.ins().iconst(cton_ty, const_val), layout)
}
if let Some(cton_ty) = fx.cton_type(layout.ty) {
let data = from.load_value(fx);
- store_workaround(fx, cton_ty, addr, data, 0);
+ fx.bcx.ins().store(MemFlags::new(), data, addr, 0);
} else {
for i in 0..size {
let from = from.expect_byref();
- let byte = load_workaround(fx, types::I8, from.0, i);
- store_workaround(fx, types::I8, addr, byte, i);
+ let byte = fx.bcx.ins().load(types::I8, MemFlags::new(), from.0, i);
+ fx.bcx.ins().store(MemFlags::new(), byte, addr, i);
}
}
}
};
Signature {
params: Some(types::I64).into_iter() // First param is place to put return val
- .chain(inputs.into_iter().map(|ty| fixup_cton_ty(cton_type_from_ty(ty).unwrap_or(types::I64))))
+ .chain(inputs.into_iter().map(|ty| cton_type_from_ty(ty).unwrap_or(types::I64)))
.map(AbiParam::new).collect(),
returns: vec![],
call_conv,
#![feature(rustc_private)]
+#![allow(intra_doc_link_resolution_failure)]
extern crate syntax;
#[macro_use]