Files
wasmtime/cranelift/filetests/filetests/runtests/fpromote.clif
Nick Fitzgerald c0b587ac5f Remove heaps from core Cranelift, push them into cranelift-wasm (#5386)
* cranelift-wasm: translate Wasm loads into lower-level CLIF operations

Rather than using `heap_{load,store,addr}`.

* cranelift: Remove the `heap_{addr,load,store}` instructions

These are now legalized in the `cranelift-wasm` frontend.

* cranelift: Remove the `ir::Heap` entity from CLIF

* Port basic memory operation tests to .wat filetests

* Remove test for verifying CLIF heaps

* Remove `heap_addr` from replace_branching_instructions_and_cfg_predecessors.clif test

* Remove `heap_addr` from readonly.clif test

* Remove `heap_addr` from `table_addr.clif` test

* Remove `heap_addr` from the simd-fvpromote_low.clif test

* Remove `heap_addr` from simd-fvdemote.clif test

* Remove `heap_addr` from the load-op-store.clif test

* Remove the CLIF heap runtest

* Remove `heap_addr` from the global_value.clif test

* Remove `heap_addr` from fpromote.clif runtests

* Remove `heap_addr` from fdemote.clif runtests

* Remove `heap_addr` from memory.clif parser test

* Remove `heap_addr` from reject_load_readonly.clif test

* Remove `heap_addr` from reject_load_notrap.clif test

* Remove `heap_addr` from load_readonly_notrap.clif test

* Remove `static-heap-without-guard-pages.clif` test

Will be subsumed when we port `make-heap-load-store-tests.sh` to generating
`.wat` tests.

* Remove `static-heap-with-guard-pages.clif` test

Will be subsumed when we port `make-heap-load-store-tests.sh` over to `.wat`
tests.

* Remove more heap tests

These will be subsumed by porting `make-heap-load-store-tests.sh` over to `.wat`
tests.

* Remove `heap_addr` from `simple-alias.clif` test

* Remove `heap_addr` from partial-redundancy.clif test

* Remove `heap_addr` from multiple-blocks.clif test

* Remove `heap_addr` from fence.clif test

* Remove `heap_addr` from extends.clif test

* Remove runtests that rely on heaps

Heaps are not a thing in CLIF or the interpreter anymore

* Add generated load/store `.wat` tests

* Enable memory-related wasm features in `.wat` tests

* Remove CLIF heap from fcmp-mem-bug.clif test

* Add a mode for compiling `.wat` all the way to assembly in filetests

* Also generate WAT to assembly tests in `make-load-store-tests.sh`

* cargo fmt

* Reinstate `f{de,pro}mote.clif` tests without the heap bits

* Remove undefined doc link

* Remove outdated SVG and dot file from docs

* Add docs about `None` returns for base address computation helpers

* Factor out `env.heap_access_spectre_mitigation()` to a local

* Expand docs for `FuncEnvironment::heaps` trait method

* Restore f{de,pro}mote+load clif runtests with stack memory
2022-12-15 00:26:45 +00:00

97 lines
2.8 KiB
Plaintext

test interpret
test run
target x86_64
target s390x
target aarch64
target riscv64
function %fpromote(f32) -> f64 {
block0(v0: f32):
v1 = fpromote.f64 v0
return v1
}
; run: %fpromote(0x0.0) == 0x0.0
; run: %fpromote(-0x0.0) == -0x0.0
; run: %fpromote(0x0.1) == 0x0.1
; run: %fpromote(0x0.2) == 0x0.2
; run: %fpromote(0x3.2) == 0x3.2
; run: %fpromote(0x1.5) == 0x1.5
; run: %fpromote(0x1.1p10) == 0x1.1p10
; run: %fpromote(0x1.4cccccp0) == 0x1.4cccccp0
; run: %fpromote(0x1.b33334p0) == 0x1.b33334p0
; run: %fpromote(-0x1.b33334p0) == -0x1.b33334p0
; run: %fpromote(0x1.333334p-1) == 0x1.333334p-1
; run: %fpromote(0x0.5) == 0x0.5
; run: %fpromote(-0x0.5) == -0x0.5
; run: %fpromote(0x1.5) == 0x1.5
; run: %fpromote(-0x1.5) == -0x1.5
; run: %fpromote(0x1.1p10) == 0x1.1p10
; run: %fpromote(-0x1.1p10) == -0x1.1p10
; run: %fpromote(0x1.99999ap-2) == 0x1.99999ap-2
; run: %fpromote(-0x1.99999ap-2) == -0x1.99999ap-2
; run: %fpromote(0x1.8p0) == 0x1.8p0
; run: %fpromote(-0x1.8p0) == -0x1.8p0
; run: %fpromote(0x1.4p1) == 0x1.4p1
; run: %fpromote(-0x1.4p1) == -0x1.4p1
;; Inf
; run: %fpromote(Inf) == Inf
; run: %fpromote(-Inf) == -Inf
;; Epsilon / Max / Min Positive
; run: %fpromote(0x1.000000p-23) == 0x1.000000p-23
; run: %fpromote(-0x1.000000p-23) == -0x1.000000p-23
; run: %fpromote(0x1.fffffep127) == 0x1.fffffep127
; run: %fpromote(-0x1.fffffep127) == -0x1.fffffep127
; run: %fpromote(0x1.000000p-126) == 0x1.000000p-126
; run: %fpromote(-0x1.000000p-126) == -0x1.000000p-126
;; Subnormals
; run: %fpromote(0x0.800000p-126) == 0x0.800000p-126
; run: %fpromote(-0x0.800000p-126) == -0x0.800000p-126
; run: %fpromote(0x0.000002p-126) == 0x0.000002p-126
; run: %fpromote(-0x0.000002p-126) == -0x0.000002p-126
;; NaN's
; For NaN's this operation is specified as producing a value that is a NaN
function %fpromote_is_nan(f32) -> i8 {
block0(v0: f32):
v1 = fpromote.f64 v0
v2 = fcmp ne v1, v1
return v2
}
; run: %fpromote_is_nan(+NaN) == 1
; run: %fpromote_is_nan(-NaN) == 1
; run: %fpromote_is_nan(+NaN:0x0) == 1
; run: %fpromote_is_nan(+NaN:0x1) == 1
; run: %fpromote_is_nan(+NaN:0x300001) == 1
; run: %fpromote_is_nan(-NaN:0x0) == 1
; run: %fpromote_is_nan(-NaN:0x1) == 1
; run: %fpromote_is_nan(-NaN:0x300001) == 1
; run: %fpromote_is_nan(+sNaN:0x1) == 1
; run: %fpromote_is_nan(-sNaN:0x1) == 1
; run: %fpromote_is_nan(+sNaN:0x200001) == 1
; run: %fpromote_is_nan(-sNaN:0x200001) == 1
;; Tests a fpromote+load combo which some backends may optimize
function %fpromote_load(i64, f32) -> f64 {
ss0 = explicit_slot 16
block0(v1: i64, v2: f32):
v3 = stack_addr.i64 ss0
store.f32 v2, v3
v4 = load.f32 v3
v5 = fpromote.f64 v4
return v5
}
; run: %fpromote_load(0, 0x0.0) == 0x0.0
; run: %fpromote_load(1, 0x0.1) == 0x0.1
; run: %fpromote_load(2, 0x0.2) == 0x0.2
; run: %fpromote_load(3, 0x3.2) == 0x3.2
; run: %fpromote_load(0xC, 0x3.2) == 0x3.2