aarch64: Implement lowering i128 select

This commit is contained in:
Afonso Bordado
2021-06-24 16:19:25 +01:00
parent 8172620763
commit 7a5948f729
3 changed files with 60 additions and 11 deletions

View File

@@ -53,3 +53,14 @@ block0(v0: i32, v1: i8, v2: i8):
; check: subs wzr, w0, #42
; nextln: csel x0, x1, x2, eq
function %i128_select(b1, i128, i128) -> i128 {
block0(v0: b1, v1: i128, v2: i128):
v3 = select.i128 v0, v1, v2
return v3
}
; check: subs wzr, w0, wzr
; nextln: csel x0, x2, x4, ne
; nextln: csel x1, x3, x5, ne

View File

@@ -0,0 +1,21 @@
test run
target aarch64
target x86_64 machinst
function %i128_select(i8, i64, i64, i64, i64) -> i64, i64 {
block0(v0: i8, v1: i64, v2: i64, v3: i64, v4: i64):
v5 = icmp_imm ne v0, 0
v6 = iconcat v1, v2
v7 = iconcat v3, v4
v8 = select.i128 v5, v6, v7
v9, v10 = isplit v8
return v9, v10
}
; run: %i128_select(1, 0, 0, 1, 1) == [0, 0]
; run: %i128_select(0, 0, 0, 1, 1) == [1, 1]
; run: %i128_select(1, 1, 2, 3, 4) == [1, 2]
; run: %i128_select(0, 1, 2, 3, 4) == [3, 4]