Legalize [su]extend.i64 to iconst/sshr_imm + iconcat.

This was already done for [su]extend.i128, and is necessary for
codegen for 32-bit x86.
This commit is contained in:
whitequark
2020-04-28 05:23:42 +00:00
committed by iximeow
parent 14bdaf3ce3
commit 162fcd3d75
4 changed files with 70 additions and 7 deletions

View File

@@ -22,8 +22,8 @@ function %split_call_arg(i32) {
block0(v0: i32):
v1 = uextend.i64 v0
call fn1(v1)
; check: $(v1l=$V), $(v1h=$V) = isplit v1
; check: call fn1($v1l, $v1h)
; check: $(v1h=$V) = iconst.i32 0
; check: call fn1(v0, $v1h)
call fn2(v0, v1)
; check: call fn2(v0, $V, $V)
return

View File

@@ -0,0 +1,26 @@
test run
target i686
function u0:0() -> b1 {
block0:
v0 = iconst.i32 0xffff_ee00
v1 = uextend.i64 v0
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ee00
v5 = icmp_imm eq v3, 0
v6 = band v4, v5
return v6
}
; run
function u0:1() -> b1 {
block0:
v0 = iconst.i32 0xffff_ee00
v1 = sextend.i64 v0
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ee00
v5 = icmp_imm eq v3, 0xffff_ffff
v6 = band v4, v5
return v6
}
; run

View File

@@ -0,0 +1,37 @@
test compile
target i686
function u0:0() -> b1 {
block0:
v0 = iconst.i32 0xffff_ee00
; check: v0 = iconst.i32 0xffff_ee00
; nextln: v2 -> v0
v1 = uextend.i64 v0
; nextln: v7 = iconst.i32 0
; nextln: v3 -> v7
; nextln: v1 = iconcat v0, v7
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ee00
v5 = icmp_imm eq v3, 0
v6 = band v4, v5
return v6
}
function u0:1() -> b1 {
block0:
v0 = iconst.i32 0xffff_ee00
; check: v0 = iconst.i32 0xffff_ee00
; nextln: v2 -> v0
v1 = sextend.i64 v0
; nextln: v10 = copy v0
; nextln: v7 = sshr_imm v10, 31
; nextln: v3 -> v7
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ee00
v5 = icmp_imm eq v3, 0xffff_ffff
v6 = band v4, v5
return v6
}