Add x86 legalization for imul.i64x2 for non-AVX CPUs
The `convert_i64x2_imul` custom legalization checks the ISA flags for AVX512DQ or AVX512VL support and legalizes `imul.i64x2` to an `x86_pmullq` in this case; if not, it uses a lengthy SSE2-compatible instruction sequence.
This commit is contained in:
@@ -70,9 +70,16 @@ block0:
|
||||
return
|
||||
}
|
||||
|
||||
function %imul(i64x2, i64x2) {
|
||||
function %imul_i64x2(i64x2, i64x2) {
|
||||
block0(v0:i64x2, v1:i64x2):
|
||||
v2 = imul v0, v1
|
||||
; check: v2 = x86_pmullq v0, v1
|
||||
; check: v3 = ushr_imm v0, 32
|
||||
; nextln: v4 = x86_pmuludq v3, v1
|
||||
; nextln: v5 = ushr_imm v1, 32
|
||||
; nextln: v6 = x86_pmuludq v5, v0
|
||||
; nextln: v7 = iadd v4, v6
|
||||
; nextln: v8 = ishl_imm v7, 32
|
||||
; nextln: v9 = x86_pmuludq v0, v1
|
||||
; nextln: v2 = iadd v9, v8
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,6 +49,13 @@ block0:
|
||||
}
|
||||
; run
|
||||
|
||||
function %imul_i64x2(i64x2, i64x2) -> i64x2 {
|
||||
block0(v0: i64x2, v1: i64x2):
|
||||
v2 = imul v0, v1
|
||||
return v2
|
||||
}
|
||||
; run: %imul_i64x2([0 2], [0 2]) == [0 4]
|
||||
|
||||
function %imul_i32x4() -> b1 {
|
||||
block0:
|
||||
v0 = vconst.i32x4 [-1 0 1 0x80_00_00_01]
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
test legalizer
|
||||
set enable_simd
|
||||
target x86_64 skylake has_avx512dq=true
|
||||
|
||||
function %imul_i64x2(i64x2, i64x2) {
|
||||
block0(v0:i64x2, v1:i64x2):
|
||||
v2 = imul v0, v1
|
||||
; check: v2 = x86_pmullq v0, v1
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user