Skip to content

Commit bb6be30

Browse files
committed
Remove some SIMD codepaths from trans.
1 parent 2d3e837 commit bb6be30

File tree

2 files changed

+9
-43
lines changed

2 files changed

+9
-43
lines changed

src/librustc_trans/trans/consts.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,9 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
501501
debug!("const_expr_unadjusted: te1={}, ty={:?}",
502502
cx.tn().val_to_string(te1),
503503
ty);
504-
let is_simd = ty.is_simd();
505-
let intype = if is_simd {
506-
ty.simd_type(cx.tcx())
507-
} else {
508-
ty
509-
};
510-
let is_float = intype.is_fp();
511-
let signed = intype.is_signed();
504+
assert!(!ty.is_simd());
505+
let is_float = ty.is_fp();
506+
let signed = ty.is_signed();
512507

513508
let (te2, _) = const_expr(cx, &**e2, param_substs, fn_args);
514509

@@ -552,14 +547,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
552547
ConstFCmp(cmp, te1, te2)
553548
} else {
554549
let cmp = base::bin_op_to_icmp_predicate(cx, b.node, signed);
555-
let bool_val = ConstICmp(cmp, te1, te2);
556-
if is_simd {
557-
// LLVM outputs an `< size x i1 >`, so we need to perform
558-
// a sign extension to get the correctly sized type.
559-
llvm::LLVMConstIntCast(bool_val, val_ty(te1).to_ref(), True)
560-
} else {
561-
bool_val
562-
}
550+
ConstICmp(cmp, te1, te2)
563551
}
564552
},
565553
} } // unsafe { match b.node {

src/librustc_trans/trans/expr.rs

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,14 +1693,9 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
16931693
let _icx = push_ctxt("trans_eager_binop");
16941694

16951695
let tcx = bcx.tcx();
1696-
let is_simd = lhs_t.is_simd();
1697-
let intype = if is_simd {
1698-
lhs_t.simd_type(tcx)
1699-
} else {
1700-
lhs_t
1701-
};
1702-
let is_float = intype.is_fp();
1703-
let is_signed = intype.is_signed();
1696+
assert!(!lhs_t.is_simd());
1697+
let is_float = lhs_t.is_fp();
1698+
let is_signed = lhs_t.is_signed();
17041699
let info = expr_info(binop_expr);
17051700

17061701
let binop_debug_loc = binop_expr.debug_loc();
@@ -1710,8 +1705,6 @@ fn trans_eager_binop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
17101705
ast::BiAdd => {
17111706
if is_float {
17121707
FAdd(bcx, lhs, rhs, binop_debug_loc)
1713-
} else if is_simd {
1714-
Add(bcx, lhs, rhs, binop_debug_loc)
17151708
} else {
17161709
let (newbcx, res) = with_overflow_check(
17171710
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>,
17221715
ast::BiSub => {
17231716
if is_float {
17241717
FSub(bcx, lhs, rhs, binop_debug_loc)
1725-
} else if is_simd {
1726-
Sub(bcx, lhs, rhs, binop_debug_loc)
17271718
} else {
17281719
let (newbcx, res) = with_overflow_check(
17291720
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>,
17341725
ast::BiMul => {
17351726
if is_float {
17361727
FMul(bcx, lhs, rhs, binop_debug_loc)
1737-
} else if is_simd {
1738-
Mul(bcx, lhs, rhs, binop_debug_loc)
17391728
} else {
17401729
let (newbcx, res) = with_overflow_check(
17411730
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>,
18281817
res
18291818
}
18301819
ast::BiEq | ast::BiNe | ast::BiLt | ast::BiGe | ast::BiLe | ast::BiGt => {
1831-
if is_simd {
1832-
base::compare_simd_types(bcx, lhs, rhs, intype, val_ty(lhs), op.node, binop_debug_loc)
1833-
} else {
1834-
base::compare_scalar_types(bcx, lhs, rhs, intype, op.node, binop_debug_loc)
1835-
}
1820+
base::compare_scalar_types(bcx, lhs, rhs, lhs_t, op.node, binop_debug_loc)
18361821
}
18371822
_ => {
18381823
bcx.tcx().sess.span_bug(binop_expr.span, "unexpected binop");
@@ -2533,14 +2518,7 @@ fn build_unchecked_rshift<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
25332518
let rhs = base::cast_shift_expr_rhs(bcx, ast::BinOp_::BiShr, lhs, rhs);
25342519
// #1877, #10183: Ensure that input is always valid
25352520
let rhs = shift_mask_rhs(bcx, rhs, binop_debug_loc);
2536-
let tcx = bcx.tcx();
2537-
let is_simd = lhs_t.is_simd();
2538-
let intype = if is_simd {
2539-
lhs_t.simd_type(tcx)
2540-
} else {
2541-
lhs_t
2542-
};
2543-
let is_signed = intype.is_signed();
2521+
let is_signed = lhs_t.is_signed();
25442522
if is_signed {
25452523
AShr(bcx, lhs, rhs, binop_debug_loc)
25462524
} else {

0 commit comments

Comments
 (0)