-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generator
Description
I've minimized a test case that currently fails on 32-bit platforms:
target i686
function u0:1516(i32) -> i32 system_v {
block0(v0: i32):
v1 = load.i32 notrap aligned readonly v0
;v2 = load.i32 v1
;v3 = sextend.i64 v2
v3 = sload32 v1
v4, v5 = isplit v3
return v4
}
I've tried writing a legalizer for it that would produce the commented instructions but it doesn't do anything (same lack of result for expand, widen, narrow). What gives?
--- a/cranelift/codegen/meta/src/shared/legalize.rs
+++ b/cranelift/codegen/meta/src/shared/legalize.rs
@@ -107,6 +107,7 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
let sdiv_imm = insts.by_name("sdiv_imm");
let select = insts.by_name("select");
let sextend = insts.by_name("sextend");
+ let sload32 = insts.by_name("sload32");
let sshr = insts.by_name("sshr");
let sshr_imm = insts.by_name("sshr_imm");
let srem = insts.by_name("srem");
@@ -213,6 +214,14 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
// embedded as part of arguments), so use a custom legalization for now.
narrow.custom_legalize(iconst, "narrow_iconst");
+ narrow.legalize(
+ def!(a = sload32.I64(flags, ptr, offset)),
+ vec![
+ def!(b = load.I32(flags, ptr, offset)),
+ def!(a = sextend.I64(b)),
+ ]
+ );
+
for &(ty, ty_half) in &[(I128, I64), (I64, I32)] {
let inst = uextend.bind(ty).bind(ty_half);
narrow.legalize(Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIncorrect behavior in the current implementation that needs fixingIncorrect behavior in the current implementation that needs fixingcraneliftIssues related to the Cranelift code generatorIssues related to the Cranelift code generator