-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compiler: Add [f32|f64].convert_[i32|i64]_[s|u] opcodes
This uses conv.r4 and conv.r8 in the signed cases, and conv.r.un + conv.r4/conv.r8 in the unsigned cases. It might not be strictly needed to do the extra conversion in the unsigned case, but conv.r.un can seemingly return either single or double precision values depending on its input, while the WASM opcodes expect a specific type.
- Loading branch information
Showing
11 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f32:-42) | ||
|
||
(module | ||
(func (export "convert") (result f32) | ||
i32.const -42 | ||
f32.convert_i32_s | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f32:42) | ||
|
||
(module | ||
(func (export "convert") (result f32) | ||
i32.const 42 | ||
f32.convert_i32_u | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f32:-42000000000) | ||
|
||
(module | ||
(func (export "convert") (result f32) | ||
i64.const -42000000000 | ||
f32.convert_i64_s | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f32:42000000000) | ||
|
||
(module | ||
(func (export "convert") (result f32) | ||
i64.const 42000000000 | ||
f32.convert_i64_u | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f64:-42) | ||
|
||
(module | ||
(func (export "convert") (result f64) | ||
i32.const -42 | ||
f64.convert_i32_s | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f64:42) | ||
|
||
(module | ||
(func (export "convert") (result f64) | ||
i32.const 42 | ||
f64.convert_i32_u | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f64:-42000000000) | ||
|
||
(module | ||
(func (export "convert") (result f64) | ||
i64.const -42000000000 | ||
f64.convert_i64_s | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
;; invoke: convert | ||
;; expect: (f64:42000000000) | ||
|
||
(module | ||
(func (export "convert") (result f64) | ||
i64.const 42000000000 | ||
f64.convert_i64_u | ||
) | ||
) |