summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorBor Grošelj Simić <bor.groseljsimic@telemach.net>2022-01-28 02:06:17 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-01-28 09:24:15 +0100
commit74d022f975f22fda20c0d1fe09a3f6fc7680f64f (patch)
treea8b7e9e1e822d8eee5eb694984f7d45d8a7f43f0 /doc
parentb0d27d8a019811d6a4e0c0cb7ec804ab27fcec80 (diff)
downloadroux-74d022f975f22fda20c0d1fe09a3f6fc7680f64f.tar.gz
implement unsigned -> float casts
amd64 lacks an instruction for this so it has to be implemented with
signed -> float casts:
 - Word casting is done by zero-extending the word to a long and then doing
   a regular signed cast.
 - Long casting is done by dividing by two with correct rounding if the
   highest bit is set and casting that to float, then adding
   1 to mantissa with integer addition
Diffstat (limited to 'doc')
-rw-r--r--doc/il.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/il.txt b/doc/il.txt
index 48ecb23..818f0a4 100644
--- a/doc/il.txt
+++ b/doc/il.txt
@@ -698,7 +698,9 @@ or convert a floating point into an integer and vice versa.
   * `stosi` -- `I(ss)`
   * `dtosi` -- `I(dd)`
   * `swtof` -- `F(ww)`
+  * `uwtof` -- `F(ww)`
   * `sltof` -- `F(ll)`
+  * `ultof` -- `F(ll)`
 
 Extending the precision of a temporary is done using the
 `ext` family of instructions.  Because QBE types do not
@@ -717,9 +719,9 @@ zero.
 Converting between signed integers and floating points is
 done using `stosi` (single to signed integer), `dtosi`
 (double to signed integer), `swtof` (signed word to float),
-and `sltof` (signed long to float).  These instructions
-only handle signed integers, conversion to and from
-unsigned types are not yet supported.
+`uwtof` (unsigned word to float), `sltof` (signed long
+to float) and `ultof` (unsigned long to float).  Conversion
+from unsigned types is not yet supported.
 
 Because of <@ Subtyping >, there is no need to have an
 instruction to lower the precision of an integer temporary.
@@ -990,8 +992,10 @@ instructions unless you know exactly what you are doing.
       * `extuh`
       * `extuw`
       * `sltof`
+      * `ultof`
       * `stosi`
       * `swtof`
+      * `uwtof`
       * `truncd`
 
   * <@ Cast and Copy > :