-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x86_32: legalize {istore,sload,uload}32.i64 #1789
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro | |
let isplit = insts.by_name("isplit"); | ||
let istore8 = insts.by_name("istore8"); | ||
let istore16 = insts.by_name("istore16"); | ||
let istore32 = insts.by_name("istore32"); | ||
let isub = insts.by_name("isub"); | ||
let isub_bin = insts.by_name("isub_bin"); | ||
let isub_bout = insts.by_name("isub_bout"); | ||
|
@@ -108,6 +109,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"); | ||
|
@@ -118,6 +120,7 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro | |
let uextend = insts.by_name("uextend"); | ||
let uload8 = insts.by_name("uload8"); | ||
let uload16 = insts.by_name("uload16"); | ||
let uload32 = insts.by_name("uload32"); | ||
let umulhi = insts.by_name("umulhi"); | ||
let ushr = insts.by_name("ushr"); | ||
let ushr_imm = insts.by_name("ushr_imm"); | ||
|
@@ -213,6 +216,30 @@ 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!(istore32.I64(flags, a, ptr, offset)), | ||
vec![ | ||
def!((al, ah) = isplit(a)), | ||
def!(store.I32(flags, al, ptr, offset)), | ||
], | ||
); | ||
|
||
expand.legalize( | ||
def!(a = sload32.I32(flags, ptr, offset)), | ||
vec![ | ||
def!(b = load.I32(flags, ptr, offset)), | ||
def!(a = sextend.I64(b)), | ||
], | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to use an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes. In cases that I see (and I get no new legalizer failures with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, yeah I see it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ctrl typevar is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good. Yeah, let's add that nice detail to the comment as well. |
||
|
||
expand.legalize( | ||
def!(a = uload32.I32(flags, ptr, offset)), | ||
vec![ | ||
def!(b = load.I32(flags, ptr, offset)), | ||
def!(a = uextend.I64(b)), | ||
], | ||
); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This uses an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct that this could be replaced with just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that is exactly how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
for &(ty, ty_half) in &[(I128, I64), (I64, I32)] { | ||
let inst = uextend.bind(ty).bind(ty_half); | ||
narrow.legalize( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; Test the legalization of load32/store32.i64 instructions on x86_32. | ||
|
||
test compile | ||
target i686 | ||
|
||
function u0:0(i32, i32, i32) { | ||
block0(v0: i32, v1: i32, v2: i32): | ||
v3 = iconcat v1, v2 | ||
; check: v4 = fill v1 | ||
; nextln: v5 = fill v0 | ||
; nextln: store v4, v5 | ||
istore32.i64 v3, v0 | ||
return | ||
} | ||
|
||
function u0:1(i32) -> i32 { | ||
block0(v0: i32): | ||
; check: v7 = fill v0 | ||
; nextln: v4 = load.i32 v7 | ||
v1 = sload32.i32 v0 | ||
v2, v3 = isplit v1 | ||
; check: return v4 | ||
return v2 | ||
} | ||
|
||
function u0:2(i32) -> i32 { | ||
block0(v0: i32): | ||
; check: v6 = fill v0 | ||
; nextln: v4 = load.i32 v6 | ||
v1 = uload32.i32 v0 | ||
v2, v3 = isplit v1 | ||
; check: return v4 | ||
return v2 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this legalization we are trying to store the lower 32 bits of an
I64
(the controlling type is for the value to store). It makes sense to me that this would be innarrow
.