-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aarch64: Implement lowering uextend/sextend for i128 values
- Loading branch information
Showing
4 changed files
with
228 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
test run | ||
target aarch64 | ||
target x86_64 machinst | ||
; TODO: Merge this file with i128-extend once the x86 legacy backend is removed | ||
|
||
function %i128_uextend_i32(i32) -> i64, i64 { | ||
block0(v0: i32): | ||
v1 = uextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_uextend_i32(0) == [0, 0] | ||
; run: %i128_uextend_i32(-1) == [0xffff_ffff, 0] | ||
; run: %i128_uextend_i32(0xffff_eeee) == [0xffff_eeee, 0] | ||
|
||
function %i128_sextend_i32(i32) -> i64, i64 { | ||
block0(v0: i32): | ||
v1 = sextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_sextend_i32(0) == [0, 0] | ||
; run: %i128_sextend_i32(-1) == [-1, -1] | ||
; run: %i128_sextend_i32(0x7fff_ffff) == [0x7fff_ffff, 0x0000_0000_0000_0000] | ||
; run: %i128_sextend_i32(0xffff_eeee) == [0xffff_ffff_ffff_eeee, 0xffff_ffff_ffff_ffff] | ||
|
||
|
||
function %i128_uextend_i16(i16) -> i64, i64 { | ||
block0(v0: i16): | ||
v1 = uextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_uextend_i16(0) == [0, 0] | ||
; run: %i128_uextend_i16(-1) == [0xffff, 0] | ||
; run: %i128_uextend_i16(0xffee) == [0xffee, 0] | ||
|
||
function %i128_sextend_i16(i16) -> i64, i64 { | ||
block0(v0: i16): | ||
v1 = sextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_sextend_i16(0) == [0, 0] | ||
; run: %i128_sextend_i16(-1) == [-1, -1] | ||
; run: %i128_sextend_i16(0x7fff) == [0x7fff, 0x0000_0000_0000_0000] | ||
; run: %i128_sextend_i16(0xffee) == [0xffff_ffff_ffff_ffee, 0xffff_ffff_ffff_ffff] | ||
|
||
|
||
function %i128_uextend_i8(i8) -> i64, i64 { | ||
block0(v0: i8): | ||
v1 = uextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_uextend_i8(0) == [0, 0] | ||
; run: %i128_uextend_i8(-1) == [0xff, 0] | ||
; run: %i128_uextend_i8(0xfe) == [0xfe, 0] | ||
|
||
function %i128_sextend_i8(i8) -> i64, i64 { | ||
block0(v0: i8): | ||
v1 = sextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_sextend_i8(0) == [0, 0] | ||
; run: %i128_sextend_i8(-1) == [-1, -1] | ||
; run: %i128_sextend_i8(0x7f) == [0x7f, 0x0000_0000_0000_0000] | ||
; run: %i128_sextend_i8(0xfe) == [0xffff_ffff_ffff_fffe, 0xffff_ffff_ffff_ffff] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
test run | ||
; target aarch64 TODO: Not yet implemented on aarch64 | ||
target aarch64 | ||
; target s390x TODO: Not yet implemented on s390x | ||
target x86_64 machinst | ||
target x86_64 legacy | ||
|
||
function %i128_uextend(i64) -> i64, i64 { | ||
function %i128_uextend_i64(i64) -> i64, i64 { | ||
block0(v0: i64): | ||
v1 = uextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; run: %i128_uextend(0) == [0, 0] | ||
; run: %i128_uextend(-1) == [-1, 0] | ||
; run: %i128_uextend(0xffff_ffff_eeee_0000) == [0xffff_ffff_eeee_0000, 0] | ||
; run: %i128_uextend_i64(0) == [0, 0] | ||
; run: %i128_uextend_i64(-1) == [-1, 0] | ||
; run: %i128_uextend_i64(0xffff_ffff_eeee_0000) == [0xffff_ffff_eeee_0000, 0] | ||
|
||
function %i128_sextend(i64) -> i64, i64 { | ||
function %i128_sextend_i64(i64) -> i64, i64 { | ||
block0(v0: i64): | ||
v1 = sextend.i128 v0 | ||
v2, v3 = isplit v1 | ||
return v2, v3 | ||
} | ||
; 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] | ||
; run: %i128_sextend_i64(0) == [0, 0] | ||
; run: %i128_sextend_i64(-1) == [-1, -1] | ||
; run: %i128_sextend_i64(0x7fff_ffff_ffff_ffff) == [0x7fff_ffff_ffff_ffff, 0x0000_0000_0000_0000] | ||
; run: %i128_sextend_i64(0xffff_ffff_eeee_0000) == [0xffff_ffff_eeee_0000, 0xffff_ffff_ffff_ffff] |