Remove some SIMD codepaths from trans.
This commit is contained in:
parent
2d3e8379c8
commit
bb6be30d6f
2 changed files with 9 additions and 43 deletions
|
@ -501,14 +501,9 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||||
debug!("const_expr_unadjusted: te1={}, ty={:?}",
|
debug!("const_expr_unadjusted: te1={}, ty={:?}",
|
||||||
cx.tn().val_to_string(te1),
|
cx.tn().val_to_string(te1),
|
||||||
ty);
|
ty);
|
||||||
let is_simd = ty.is_simd();
|
assert!(!ty.is_simd());
|
||||||
let intype = if is_simd {
|
let is_float = ty.is_fp();
|
||||||
ty.simd_type(cx.tcx())
|
let signed = ty.is_signed();
|
||||||
} else {
|
|
||||||
ty
|
|
||||||
};
|
|
||||||
let is_float = intype.is_fp();
|
|
||||||
let signed = intype.is_signed();
|
|
||||||
|
|
||||||
let (te2, _) = const_expr(cx, &**e2, param_substs, fn_args);
|
let (te2, _) = const_expr(cx, &**e2, param_substs, fn_args);
|
||||||
|
|
||||||
|
@ -552,14 +547,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||||
ConstFCmp(cmp, te1, te2)
|
ConstFCmp(cmp, te1, te2)
|
||||||
} else {
|
} else {
|
||||||
let cmp = base::bin_op_to_icmp_predicate(cx, b.node, signed);
|
let cmp = base::bin_op_to_icmp_predicate(cx, b.node, signed);
|
||||||
let bool_val = ConstICmp(cmp, te1, te2);
|
ConstICmp(cmp, te1, te2)
|
||||||
if is_simd {
|
|
||||||
// LLVM outputs an `< size x i1 >`, so we need to perform
|
|
||||||
// a sign extension to get the correctly sized type.
|
|
||||||
llvm::LLVMConstIntCast(bool_val, val_ty(te1).to_ref(), True)
|
|
||||||
} else {
|
|
||||||
bool_val
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
} } // unsafe { match b.node {
|
} } // unsafe { match b.node {
|
||||||
|
|
|
@ -1693,14 +1693,9 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
let _icx = push_ctxt("trans_eager_binop");
|
let _icx = push_ctxt("trans_eager_binop");
|
||||||
|
|
||||||
let tcx = bcx.tcx();
|
let tcx = bcx.tcx();
|
||||||
let is_simd = lhs_t.is_simd();
|
assert!(!lhs_t.is_simd());
|
||||||
let intype = if is_simd {
|
let is_float = lhs_t.is_fp();
|
||||||
lhs_t.simd_type(tcx)
|
let is_signed = lhs_t.is_signed();
|
||||||
} else {
|
|
||||||
lhs_t
|
|
||||||
};
|
|
||||||
let is_float = intype.is_fp();
|
|
||||||
let is_signed = intype.is_signed();
|
|
||||||
let info = expr_info(binop_expr);
|
let info = expr_info(binop_expr);
|
||||||
|
|
||||||
let binop_debug_loc = binop_expr.debug_loc();
|
let binop_debug_loc = binop_expr.debug_loc();
|
||||||
|
@ -1710,8 +1705,6 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
ast::BiAdd => {
|
ast::BiAdd => {
|
||||||
if is_float {
|
if is_float {
|
||||||
FAdd(bcx, lhs, rhs, binop_debug_loc)
|
FAdd(bcx, lhs, rhs, binop_debug_loc)
|
||||||
} else if is_simd {
|
|
||||||
Add(bcx, lhs, rhs, binop_debug_loc)
|
|
||||||
} else {
|
} else {
|
||||||
let (newbcx, res) = with_overflow_check(
|
let (newbcx, res) = with_overflow_check(
|
||||||
bcx, OverflowOp::Add, info, lhs_t, lhs, rhs, binop_debug_loc);
|
bcx, OverflowOp::Add, info, lhs_t, lhs, rhs, binop_debug_loc);
|
||||||
|
@ -1722,8 +1715,6 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
ast::BiSub => {
|
ast::BiSub => {
|
||||||
if is_float {
|
if is_float {
|
||||||
FSub(bcx, lhs, rhs, binop_debug_loc)
|
FSub(bcx, lhs, rhs, binop_debug_loc)
|
||||||
} else if is_simd {
|
|
||||||
Sub(bcx, lhs, rhs, binop_debug_loc)
|
|
||||||
} else {
|
} else {
|
||||||
let (newbcx, res) = with_overflow_check(
|
let (newbcx, res) = with_overflow_check(
|
||||||
bcx, OverflowOp::Sub, info, lhs_t, lhs, rhs, binop_debug_loc);
|
bcx, OverflowOp::Sub, info, lhs_t, lhs, rhs, binop_debug_loc);
|
||||||
|
@ -1734,8 +1725,6 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
ast::BiMul => {
|
ast::BiMul => {
|
||||||
if is_float {
|
if is_float {
|
||||||
FMul(bcx, lhs, rhs, binop_debug_loc)
|
FMul(bcx, lhs, rhs, binop_debug_loc)
|
||||||
} else if is_simd {
|
|
||||||
Mul(bcx, lhs, rhs, binop_debug_loc)
|
|
||||||
} else {
|
} else {
|
||||||
let (newbcx, res) = with_overflow_check(
|
let (newbcx, res) = with_overflow_check(
|
||||||
bcx, OverflowOp::Mul, info, lhs_t, lhs, rhs, binop_debug_loc);
|
bcx, OverflowOp::Mul, info, lhs_t, lhs, rhs, binop_debug_loc);
|
||||||
|
@ -1828,11 +1817,7 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
ast::BiEq | ast::BiNe | ast::BiLt | ast::BiGe | ast::BiLe | ast::BiGt => {
|
ast::BiEq | ast::BiNe | ast::BiLt | ast::BiGe | ast::BiLe | ast::BiGt => {
|
||||||
if is_simd {
|
base::compare_scalar_types(bcx, lhs, rhs, lhs_t, op.node, binop_debug_loc)
|
||||||
base::compare_simd_types(bcx, lhs, rhs, intype, val_ty(lhs), op.node, binop_debug_loc)
|
|
||||||
} else {
|
|
||||||
base::compare_scalar_types(bcx, lhs, rhs, intype, op.node, binop_debug_loc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
bcx.tcx().sess.span_bug(binop_expr.span, "unexpected binop");
|
bcx.tcx().sess.span_bug(binop_expr.span, "unexpected binop");
|
||||||
|
@ -2533,14 +2518,7 @@ fn build_unchecked_rshift<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||||
let rhs = base::cast_shift_expr_rhs(bcx, ast::BinOp_::BiShr, lhs, rhs);
|
let rhs = base::cast_shift_expr_rhs(bcx, ast::BinOp_::BiShr, lhs, rhs);
|
||||||
// #1877, #10183: Ensure that input is always valid
|
// #1877, #10183: Ensure that input is always valid
|
||||||
let rhs = shift_mask_rhs(bcx, rhs, binop_debug_loc);
|
let rhs = shift_mask_rhs(bcx, rhs, binop_debug_loc);
|
||||||
let tcx = bcx.tcx();
|
let is_signed = lhs_t.is_signed();
|
||||||
let is_simd = lhs_t.is_simd();
|
|
||||||
let intype = if is_simd {
|
|
||||||
lhs_t.simd_type(tcx)
|
|
||||||
} else {
|
|
||||||
lhs_t
|
|
||||||
};
|
|
||||||
let is_signed = intype.is_signed();
|
|
||||||
if is_signed {
|
if is_signed {
|
||||||
AShr(bcx, lhs, rhs, binop_debug_loc)
|
AShr(bcx, lhs, rhs, binop_debug_loc)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue