Update Cranelift and use the new ineg instruction

This commit is contained in:
bjorn3 2020-02-15 11:59:38 +01:00
parent a3f27a4428
commit 6156f48ffe
4 changed files with 18 additions and 14 deletions

20
Cargo.lock generated
View File

@ -33,7 +33,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cranelift-bforest"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
]
@ -41,7 +41,7 @@ dependencies = [
[[package]]
name = "cranelift-codegen"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-bforest 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
@ -58,7 +58,7 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen-shared 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
@ -67,17 +67,17 @@ dependencies = [
[[package]]
name = "cranelift-codegen-shared"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
[[package]]
name = "cranelift-entity"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
[[package]]
name = "cranelift-frontend"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -88,7 +88,7 @@ dependencies = [
[[package]]
name = "cranelift-module"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
@ -99,7 +99,7 @@ dependencies = [
[[package]]
name = "cranelift-native"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -109,7 +109,7 @@ dependencies = [
[[package]]
name = "cranelift-object"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
@ -120,7 +120,7 @@ dependencies = [
[[package]]
name = "cranelift-simplejit"
version = "0.58.0"
source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0"
source = "git+https://github.com/bytecodealliance/cranelift/#f1aa07265b3b25c1859f7184e92fd600316b4b25"
dependencies = [
"cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",
"cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)",

View File

@ -360,10 +360,14 @@ fn trans_stmt<'tcx>(
}
}
UnOp::Neg => match layout.ty.kind {
ty::Int(_) => {
ty::Int(IntTy::I128) => {
// FIXME remove this case once ineg.i128 works
let zero = CValue::const_val(fx, layout, 0);
crate::num::trans_int_binop(fx, BinOp::Sub, zero, operand)
}
ty::Int(_) => {
CValue::by_val(fx.bcx.ins().ineg(val), layout)
}
ty::Float(_) => {
CValue::by_val(fx.bcx.ins().fneg(val), layout)
}

View File

@ -225,8 +225,7 @@ pub fn size_and_align_of_dst<'tcx>(
// `(size + (align-1)) & -align`
let addend = fx.bcx.ins().iadd_imm(align, -1);
let add = fx.bcx.ins().iadd(size, addend);
let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
let neg = fx.bcx.ins().isub(zero, align);
let neg = fx.bcx.ins().ineg(align);
let size = fx.bcx.ins().band(add, neg);
(size, align)

View File

@ -509,13 +509,14 @@ impl<'tcx> CPlace<'tcx> {
let size = dst_layout.size.bytes();
let src_align = src_layout.align.abi.bytes() as u8;
let dst_align = dst_layout.align.abi.bytes() as u8;
fx.bcx.emit_small_memcpy(
fx.bcx.emit_small_memory_copy(
fx.module.target_config(),
to_addr,
from_addr,
size,
dst_align,
src_align,
true,
);
}
CValueInner::ByRef(_, Some(_)) => todo!(),