Files
wasmtime/cranelift/filetests/filetests/runtests/i128-conversion.clif
Damian Heaton cae7c196bb Interpreter: Implement floating point conversions (#4884)
* Interpreter: Implement floating point conversions

Implemented the following opcodes for the interpreter:
- `FcvtToUint`
- `FcvtToSint`
- `FcvtToUintSat`
- `FcvtToSintSat`
- `FcvtFromUint`
- `FcvtFromSint`
- `FcvtLowFromSint`
- `FvpromoteLow`
- `Fvdemote`

Copyright (c) 2022 Arm Limited

* Fix `I128` bounds checks for `FcvtTo{U,S}int{_,Sat}`

Copyright (c) 2022 Arm Limited

* Fix broken test

Copyright (c) 2022 Arm Limited
2022-09-20 11:10:20 -07:00

53 lines
1.9 KiB
Plaintext

test interpret
; `fcvt_to_{u,s}int.i128` not currently supported by any backend.
function %fcvt_to_uint_i128(f32) -> i128 {
block0(v0: f32):
v1 = fcvt_to_uint.i128 v0
return v1
}
; run: %fcvt_to_uint_i128(0x0.0) == 0
; run: %fcvt_to_uint_i128(0x1.0) == 1
; run: %fcvt_to_uint_i128(0x1.0p31) == 2147483648
; run: %fcvt_to_uint_i128(0x1.fffffp31) == 4294965248
; run: %fcvt_to_uint_i128(0x1.0p63) == 9223372036854775808
; run: %fcvt_to_uint_i128(0x1.fffffep127) == 170141183460469231731687303715884105727
function %fcvt_to_sint_i128(f32) -> i128 {
block0(v0: f32):
v1 = fcvt_to_sint.i128 v0
return v1
}
; run: %fcvt_to_sint_i128(0x0.0) == 0
; run: %fcvt_to_sint_i128(0x1.0) == 1
; run: %fcvt_to_sint_i128(0x1.0p31) == 2147483648
; run: %fcvt_to_sint_i128(0x1.fffffp31) == 4294965248
; run: %fcvt_to_sint_i128(-0x1.fffffp31) == -4294965248
; run: %fcvt_to_sint_i128(0x1.0p63) == 9223372036854775808
; run: %fcvt_to_sint_i128(-0x1.0p63) == -9223372036854775808
; run: %fcvt_to_sint_i128(0x1.fffffep127) == 170141183460469231731687303715884105727
function %fcvt_to_uint_sat_i128(f32) -> i128 {
block0(v0: f32):
v1 = fcvt_to_uint_sat.i128 v0
return v1
}
; run: %fcvt_to_uint_sat_i128(0x0.0) == 0
; run: %fcvt_to_uint_sat_i128(0x1.0) == 1
; run: %fcvt_to_uint_sat_i128(0x1.0p31) == 2147483648
; run: %fcvt_to_uint_sat_i128(0x1.fffffp31) == 4294965248
; run: %fcvt_to_uint_sat_i128(-0x1.fffffp31) == 0
; run: %fcvt_to_uint_sat_i128(0x1.fffffep127) == 170141183460469231731687303715884105727
function %fcvt_to_sint_sat_i128(f32) -> i128 {
block0(v0: f32):
v1 = fcvt_to_sint_sat.i128 v0
return v1
}
; run: %fcvt_to_sint_sat_i128(0x0.0) == 0
; run: %fcvt_to_sint_sat_i128(0x1.0) == 1
; run: %fcvt_to_sint_sat_i128(0x1.0p31) == 2147483648
; run: %fcvt_to_sint_sat_i128(0x1.fffffp31) == 4294965248
; run: %fcvt_to_sint_sat_i128(-0x1.fffffp31) == -4294965248
; run: %fcvt_to_sint_sat_i128(0x1.fffffep127) == 170141183460469231731687303715884105727