trans: Do not depend on having Expr's around for generic_simd_intrinsic.

This commit is contained in:
Eduard Burtescu 2016-03-10 02:17:45 +02:00
parent 7912f94b2d
commit 5739ed1f80

View File

@ -1506,22 +1506,26 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
let total_len = in_len as u64 * 2; let total_len = in_len as u64 * 2;
let vector = match args { let (vector, indirect) = match args {
Some(args) => &args[2], Some(args) => {
None => bcx.sess().span_bug(span, match consts::const_expr(bcx.ccx(), &args[2], substs, None,
"intrinsic call with unexpected argument shape"), // this should probably help simd error reporting
}; consts::TrueConst::Yes) {
let vector = match consts::const_expr(bcx.ccx(), vector, substs, None, Ok((vector, _)) => (vector, false),
consts::TrueConst::Yes, // this should probably help simd error reporting Err(err) => bcx.sess().span_fatal(span, &err.description()),
) { }
Ok((vector, _)) => vector, }
Err(err) => bcx.sess().span_fatal(span, &err.description()), None => (llargs[2], !type_is_immediate(bcx.ccx(), arg_tys[2]))
}; };
let indices: Option<Vec<_>> = (0..n) let indices: Option<Vec<_>> = (0..n)
.map(|i| { .map(|i| {
let arg_idx = i; let arg_idx = i;
let val = const_get_elt(vector, &[i as libc::c_uint]); let val = if indirect {
Load(bcx, StructGEP(bcx, vector, i))
} else {
const_get_elt(vector, &[i as libc::c_uint])
};
let c = const_to_opt_uint(val); let c = const_to_opt_uint(val);
match c { match c {
None => { None => {