Skip to content

Commit

Permalink
cranelift: Expand i128 extend testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
afonso360 committed Jun 20, 2021
1 parent 7ce4604 commit da4daa6
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions cranelift/filetests/filetests/runtests/i128-extend.clif
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ test run
target x86_64 machinst
target x86_64 legacy

function %i128_uextend() -> b1 {
block0:
v0 = iconst.i64 0xffff_ffff_eeee_0000
function %i128_uextend(i64) -> i64, i64 {
block0(v0: i64):
v1 = uextend.i128 v0
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ffff_eeee_0000
v5 = icmp_imm eq v3, 0
v6 = band v4, v5
return v6
return v2, v3
}
; run
; run: %i128_uextend(0) == [0, 0]
; run: %i128_uextend(-1) == [-1, 0]
; run: %i128_uextend(0xffff_ffff_eeee_0000) == [0xffff_ffff_eeee_0000, 0]

function %i128_sextend() -> b1 {
block0:
v0 = iconst.i64 0xffff_ffff_eeee_0000
function %i128_sextend(i64) -> i64, i64 {
block0(v0: i64):
v1 = sextend.i128 v0
v2, v3 = isplit v1
v4 = icmp_imm eq v2, 0xffff_ffff_eeee_0000
v5 = icmp_imm eq v3, 0xffff_ffff_ffff_ffff
v6 = band v4, v5
return v6
return v2, v3
}
; run
; run: %i128_sextend(0) == [0, 0]
; run: %i128_sextend(-1) == [-1, -1]
; run: %i128_sextend(0x7fff_ffff_ffff_ffff) == [0x7fff_ffff_ffff_ffff, 0x0000_0000_0000_0000]
; run: %i128_sextend(0xffff_ffff_eeee_0000) == [0xffff_ffff_eeee_0000, 0xffff_ffff_ffff_ffff]

0 comments on commit da4daa6

Please sign in to comment.