Skip to content

Commit

Permalink
Restore f{de,pro}mote+load clif runtests with stack memory
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Dec 14, 2022
1 parent 5a53cd0 commit 1cd66b5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cranelift/filetests/filetests/runtests/fdemote.clif
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,21 @@ block0(v0: f64):
; run: %fdemote_is_nan(-sNaN:0x1) == 1
; run: %fdemote_is_nan(+sNaN:0x4000000000001) == 1
; run: %fdemote_is_nan(-sNaN:0x4000000000001) == 1


;; Tests a fdemote+load combo which some backends may optimize
function %fdemote_load(i64, f64) -> f32 {
ss0 = explicit_slot 16

block0(v1: i64, v2: f64):
v3 = stack_addr.i64 ss0
store.f64 v2, v3
v4 = load.f64 v3
v5 = fdemote.f32 v4
return v5
}
; run: %fdemote_load(0, 0x0.0) == 0x0.0
; run: %fdemote_load(1, 0x0.1) == 0x0.1
; run: %fdemote_load(2, 0x0.2) == 0x0.2
; run: %fdemote_load(3, 0x3.2) == 0x3.2
; run: %fdemote_load(0x8, 0x3.2) == 0x3.2
18 changes: 18 additions & 0 deletions cranelift/filetests/filetests/runtests/fpromote.clif
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,21 @@ block0(v0: f32):
; 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

0 comments on commit 1cd66b5

Please sign in to comment.