Skip to content

Commit 0c3e152

Browse files
committed
Remove unchecked_add/sub/mul/shl/shr from CTFE/cg_ssa/cg_clif
1 parent 9efe5e7 commit 0c3e152

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/intrinsics/mod.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -472,25 +472,11 @@ fn codegen_regular_intrinsic_call<'tcx>(
472472
ret.write_cvalue(fx, CValue::by_val(align, usize_layout));
473473
}
474474

475-
sym::unchecked_add
476-
| sym::unchecked_sub
477-
| sym::unchecked_mul
478-
| sym::exact_div
479-
| sym::unchecked_shl
480-
| sym::unchecked_shr => {
475+
sym::exact_div => {
481476
intrinsic_args!(fx, args => (x, y); intrinsic);
482477

483-
// FIXME trap on overflow
484-
let bin_op = match intrinsic {
485-
sym::unchecked_add => BinOp::Add,
486-
sym::unchecked_sub => BinOp::Sub,
487-
sym::unchecked_mul => BinOp::Mul,
488-
sym::exact_div => BinOp::Div,
489-
sym::unchecked_shl => BinOp::Shl,
490-
sym::unchecked_shr => BinOp::Shr,
491-
_ => unreachable!(),
492-
};
493-
let res = crate::num::codegen_int_binop(fx, bin_op, x, y);
478+
// FIXME trap on inexact
479+
let res = crate::num::codegen_int_binop(fx, BinOp::Div, x, y);
494480
ret.write_cvalue(fx, res);
495481
}
496482
sym::saturating_add | sym::saturating_sub => {

0 commit comments

Comments
 (0)