This commit migrates these existing instructions to ISLE from the manual
lowerings implemented today. This was mostly straightforward but while I
was at it I fixed what appeared to be broken translations for I{8,16}
for `clz`, `cls`, and `ctz`. Previously the lowerings would produce
results as-if the input was 32-bits, but now I believe they all
correctly account for the bit-width.
41 lines
703 B
Plaintext
41 lines
703 B
Plaintext
test interpret
|
|
test run
|
|
target aarch64
|
|
target x86_64
|
|
|
|
function %clz_i8(i8) -> i8 {
|
|
block0(v0: i8):
|
|
v1 = clz v0
|
|
return v1
|
|
}
|
|
; run: %clz_i8(1) == 7
|
|
; run: %clz_i8(0x40) == 1
|
|
; run: %clz_i8(-1) == 0
|
|
|
|
function %clz_i16(i16) -> i16 {
|
|
block0(v0: i16):
|
|
v1 = clz v0
|
|
return v1
|
|
}
|
|
; run: %clz_i16(1) == 15
|
|
; run: %clz_i16(0x4000) == 1
|
|
; run: %clz_i16(-1) == 0
|
|
|
|
function %clz_i32(i32) -> i32 {
|
|
block0(v0: i32):
|
|
v1 = clz v0
|
|
return v1
|
|
}
|
|
; run: %clz_i32(1) == 31
|
|
; run: %clz_i32(0x40000000) == 1
|
|
; run: %clz_i32(-1) == 0
|
|
|
|
function %clz_i64(i64) -> i64 {
|
|
block0(v0: i64):
|
|
v1 = clz v0
|
|
return v1
|
|
}
|
|
; run: %clz_i64(1) == 63
|
|
; run: %clz_i64(0x4000000000000000) == 1
|
|
; run: %clz_i64(-1) == 0
|