Skip to content

Commit 6156f48

Browse files
committed
Update Cranelift and use the new ineg instruction
1 parent a3f27a4 commit 6156f48

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,14 @@ fn trans_stmt<'tcx>(
360360
}
361361
}
362362
UnOp::Neg => match layout.ty.kind {
363-
ty::Int(_) => {
363+
ty::Int(IntTy::I128) => {
364+
// FIXME remove this case once ineg.i128 works
364365
let zero = CValue::const_val(fx, layout, 0);
365366
crate::num::trans_int_binop(fx, BinOp::Sub, zero, operand)
366367
}
368+
ty::Int(_) => {
369+
CValue::by_val(fx.bcx.ins().ineg(val), layout)
370+
}
367371
ty::Float(_) => {
368372
CValue::by_val(fx.bcx.ins().fneg(val), layout)
369373
}

src/unsize.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ pub fn size_and_align_of_dst<'tcx>(
225225
// `(size + (align-1)) & -align`
226226
let addend = fx.bcx.ins().iadd_imm(align, -1);
227227
let add = fx.bcx.ins().iadd(size, addend);
228-
let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
229-
let neg = fx.bcx.ins().isub(zero, align);
228+
let neg = fx.bcx.ins().ineg(align);
230229
let size = fx.bcx.ins().band(add, neg);
231230

232231
(size, align)

src/value_and_place.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,14 @@ impl<'tcx> CPlace<'tcx> {
509509
let size = dst_layout.size.bytes();
510510
let src_align = src_layout.align.abi.bytes() as u8;
511511
let dst_align = dst_layout.align.abi.bytes() as u8;
512-
fx.bcx.emit_small_memcpy(
512+
fx.bcx.emit_small_memory_copy(
513513
fx.module.target_config(),
514514
to_addr,
515515
from_addr,
516516
size,
517517
dst_align,
518518
src_align,
519+
true,
519520
);
520521
}
521522
CValueInner::ByRef(_, Some(_)) => todo!(),

0 commit comments

Comments
 (0)