Fix load.i64 and store legalization

This commit is contained in:
bjorn3
2019-08-15 13:24:34 +02:00
committed by Dan Gohman
parent ffa1e946a7
commit 2426bce9ac
2 changed files with 23 additions and 3 deletions

View File

@@ -588,9 +588,12 @@ fn narrow_load(
_ => panic!("Expected load: {}", pos.func.dfg.display_inst(inst, None)),
};
let al = pos.ins().load(ir::types::I64, flags, ptr, offset);
let res_ty = pos.func.dfg.ctrl_typevar(inst);
let small_ty = res_ty.half_width().expect("Can't narrow load");
let al = pos.ins().load(small_ty, flags, ptr, offset);
let ah = pos.ins().load(
ir::types::I64,
small_ty,
flags,
ptr,
offset.try_add_i64(8).expect("load offset overflow"),
@@ -618,7 +621,7 @@ fn narrow_store(
_ => panic!("Expected store: {}", pos.func.dfg.display_inst(inst, None)),
};
let (al, ah) = pos.func.dfg.replace(inst).isplit(val);
let (al, ah) = pos.ins().isplit(val);
pos.ins().store(flags, al, ptr, offset);
pos.ins().store(
flags,
@@ -626,4 +629,5 @@ fn narrow_store(
ptr,
offset.try_add_i64(8).expect("store offset overflow"),
);
pos.remove_inst();
}

View File

@@ -0,0 +1,16 @@
test compile
target i686
function u0:0(i64, i32) system_v {
ebb0(v0: i64, v1: i32):
v2 = bor v0, v0
store v2, v1
return
}
function u0:1(i32) -> i64 system_v {
ebb0(v1: i32):
v0 = load.i64 v1
v2 = bor v0, v0
return v2
}