Unified · Split
| @@ -744,11 +744,11 @@ returns 1 when the first argument is smaller than the second one. · 743 unmodified lines | |||
| 744 | ~ Conversions | 744 | ~ Conversions |
| 745 | ~~~~~~~~~~~~~ | 745 | ~~~~~~~~~~~~~ |
| 746 | 746 | ||
| 747 | Conversion operations allow to change the representation of | 747 | Conversion operations change the representation of a value, |
| 748 | a value, possibly modifying it if the target type cannot hold | 748 | possibly modifying it if the target type cannot hold the value |
| 749 | the value of the source type. Conversions can extend the | 749 | of the source type. Conversions can extend the precision of a |
| 750 | precision of a temporary (e.g., from signed 8-bit to 32-bit), | 750 | temporary (e.g., from signed 8-bit to 32-bit), or convert a |
| 751 | or convert a floating point into an integer and vice versa. | 751 | floating point into an integer and vice versa. |
| 752 | 752 | ||
| 753 | * `extsw`, `extuw` -- `l(w)` | 753 | * `extsw`, `extuw` -- `l(w)` |
| 754 | * `extsh`, `extuh` -- `I(ww)` | 754 | * `extsh`, `extuh` -- `I(ww)` |
| @@ -766,17 +766,17 @@ or convert a floating point into an integer and vice versa. · 11 unmodified lines | |||
| 766 | 766 | ||
| 767 | Extending the precision of a temporary is done using the | 767 | Extending the precision of a temporary is done using the |
| 768 | `ext` family of instructions. Because QBE types do not | 768 | `ext` family of instructions. Because QBE types do not |
| 769 | precise the signedness (like in LLVM), extension instructions | 769 | specify the signedness (like in LLVM), extension instructions |
| 770 | exist to sign-extend and zero-extend a value. For example, | 770 | exist to sign-extend and zero-extend a value. For example, |
| 771 | `extsb` takes a word argument and sign-extends the 8 | 771 | `extsb` takes a word argument and sign-extends the 8 |
| 772 | least-significant bits to a full word or long, depending on | 772 | least-significant bits to a full word or long, depending on |
| 773 | the return type. | 773 | the return type. |
| 774 | 774 | ||
| 775 | The instructions `exts` and `truncd` are provided to change | 775 | The instructions `exts` (extend single) and `truncd` (truncate |
| 776 | the precision of a floating point value. When the double | 776 | double) are provided to change the precision of a floating |
| 777 | argument of `truncd` cannot be represented as a | 777 | point value. When the double argument of `truncd` cannot |
| 778 | single-precision floating point, it is truncated towards | 778 | be represented as a single-precision floating point, it is |
| 779 | zero. | 779 | truncated towards zero. |
| 780 | 780 | ||
| 781 | Converting between signed integers and floating points is done | 781 | Converting between signed integers and floating points is done |
| 782 | using `stosi` (single to signed integer), `stoui` (single to | 782 | using `stosi` (single to signed integer), `stoui` (single to |