Implemented `Smulhi` for the Cranelift interpreter, performing signed integer multiplication and producing the high half of a double-length result. Copyright (c) 2021, Arm Limited
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
test interpret
|
|
; The AArch64 and x86_64 backends only support scalar values.
|
|
|
|
function %smulhi_i8x16(i8x16, i8x16) -> i8x16 {
|
|
block0(v0: i8x16, v1: i8x16):
|
|
v2 = smulhi v0, v1
|
|
return v2
|
|
}
|
|
; run: %smulhi_i8x16([1 -2 3 -4 5 -6 7 -8 127 127 127 127 -128 -128 -128 -128], [9 10 -11 -12 13 14 -15 -16 17 18 -19 -20 21 22 -128 127]) == [0 -1 -1 0 0 -1 -1 0 8 8 -10 -10 -11 -11 64 -64]
|
|
|
|
function %smulhi_i16x8(i16x8, i16x8) -> i16x8 {
|
|
block0(v0: i16x8, v1: i16x8):
|
|
v2 = smulhi v0, v1
|
|
return v2
|
|
}
|
|
; run: %smulhi_i16x8([1 -2 255 -255 255 -255 32767 -32768], [3 4 -5 -6 7 8 -32768 -32768]) == [0 -1 -1 0 0 -1 -16384 16384]
|
|
|
|
function %smulhi_i32x4(i32x4, i32x4) -> i32x4 {
|
|
block0(v0: i32x4, v1: i32x4):
|
|
v2 = smulhi v0, v1
|
|
return v2
|
|
}
|
|
; run: %smulhi_i32x4([1 -255 65535 -2147483648], [2 65535 -2147483647 -2147483647]) == [0 -1 -32768 1073741823]
|
|
|
|
function %smulhi_i64x2(i64x2, i64x2) -> i64x2 {
|
|
block0(v0: i64x2, v1: i64x2):
|
|
v2 = smulhi v0, v1
|
|
return v2
|
|
}
|
|
; run: %smulhi_i64x2([-1 9223372036854775807], [-2 -9223372036854775808]) == [0 -4611686018427387904] |