diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-03-10 02:17:45 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-03-17 22:48:07 +0200 |
| commit | 5739ed1f8018943236826b4c0ce8b4ddebaad4e7 (patch) | |
| tree | 31d255eb2f3bb2059a892e386c0b46abba5131eb | |
| parent | 7912f94b2db78e69d032b2e6ac47e5e3980d56bd (diff) | |
trans: Do not depend on having Expr's around for generic_simd_intrinsic.
| -rw-r--r-- | src/librustc_trans/trans/intrinsic.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 736803c573e..1140edeaec0 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -1506,22 +1506,26 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a> let total_len = in_len as u64 * 2; - let vector = match args { - Some(args) => &args[2], - None => bcx.sess().span_bug(span, - "intrinsic call with unexpected argument shape"), - }; - let vector = match consts::const_expr(bcx.ccx(), vector, substs, None, - consts::TrueConst::Yes, // this should probably help simd error reporting - ) { - Ok((vector, _)) => vector, - Err(err) => bcx.sess().span_fatal(span, &err.description()), + let (vector, indirect) = match args { + Some(args) => { + match consts::const_expr(bcx.ccx(), &args[2], substs, None, + // this should probably help simd error reporting + consts::TrueConst::Yes) { + Ok((vector, _)) => (vector, false), + 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) .map(|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); match c { None => { |
