Commit f363317
authored
[APFloat] Add support for f8E4M3 IEEE 754 type (#97179)
This PR adds `f8E4M3` type to APFloat.
`f8E4M3` type follows IEEE 754 convention
```c
f8E4M3 (IEEE 754)
- Exponent bias: 7
- Maximum stored exponent value: 14 (binary 1110)
- Maximum unbiased exponent value: 14 - 7 = 7
- Minimum stored exponent value: 1 (binary 0001)
- Minimum unbiased exponent value: 1 − 7 = −6
- Precision specifies the total number of bits used for the significand (mantisa),
including implicit leading integer bit = 3 + 1 = 4
- Follows IEEE 754 conventions for representation of special values
- Has Positive and Negative zero
- Has Positive and Negative infinity
- Has NaNs
Additional details:
- Max exp (unbiased): 7
- Min exp (unbiased): -6
- Infinities (+/-): S.1111.000
- Zeros (+/-): S.0000.000
- NaNs: S.1111.{001, 010, 011, 100, 101, 110, 111}
- Max normal number: S.1110.111 = +/-2^(7) x (1 + 0.875) = +/-240
- Min normal number: S.0001.000 = +/-2^(-6)
- Max subnormal number: S.0000.111 = +/-2^(-6) x 0.875 = +/-2^(-9) x 7
- Min subnormal number: S.0000.001 = +/-2^(-6) x 0.125 = +/-2^(-9)
```
Related PRs:
- [PR-97118](#97118) Add f8E4M3
IEEE 754 type to mlir1 parent 1e6672a commit f363317
File tree
5 files changed
+96
-3
lines changed- clang
- include/clang/AST
- lib/AST
- llvm
- include/llvm/ADT
- lib/Support
- unittests/ADT
5 files changed
+96
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
464 | | - | |
| 463 | + | |
| 464 | + | |
465 | 465 | | |
466 | | - | |
| 466 | + | |
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
981 | 981 | | |
982 | 982 | | |
983 | 983 | | |
| 984 | + | |
984 | 985 | | |
985 | 986 | | |
986 | 987 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| 223 | + | |
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
| |||
638 | 642 | | |
639 | 643 | | |
640 | 644 | | |
| 645 | + | |
641 | 646 | | |
642 | 647 | | |
643 | 648 | | |
| |||
656 | 661 | | |
657 | 662 | | |
658 | 663 | | |
| 664 | + | |
659 | 665 | | |
660 | 666 | | |
661 | 667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| 212 | + | |
| 213 | + | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| |||
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| 252 | + | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
276 | 281 | | |
277 | 282 | | |
278 | 283 | | |
| 284 | + | |
279 | 285 | | |
280 | 286 | | |
281 | 287 | | |
| |||
3617 | 3623 | | |
3618 | 3624 | | |
3619 | 3625 | | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
3620 | 3631 | | |
3621 | 3632 | | |
3622 | 3633 | | |
| |||
3681 | 3692 | | |
3682 | 3693 | | |
3683 | 3694 | | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
3684 | 3698 | | |
3685 | 3699 | | |
3686 | 3700 | | |
| |||
3902 | 3916 | | |
3903 | 3917 | | |
3904 | 3918 | | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
3905 | 3923 | | |
3906 | 3924 | | |
3907 | 3925 | | |
| |||
3951 | 3969 | | |
3952 | 3970 | | |
3953 | 3971 | | |
| 3972 | + | |
| 3973 | + | |
3954 | 3974 | | |
3955 | 3975 | | |
3956 | 3976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2133 | 2133 | | |
2134 | 2134 | | |
2135 | 2135 | | |
| 2136 | + | |
| 2137 | + | |
2136 | 2138 | | |
2137 | 2139 | | |
2138 | 2140 | | |
| |||
6532 | 6534 | | |
6533 | 6535 | | |
6534 | 6536 | | |
| 6537 | + | |
| 6538 | + | |
| 6539 | + | |
| 6540 | + | |
| 6541 | + | |
| 6542 | + | |
| 6543 | + | |
| 6544 | + | |
| 6545 | + | |
| 6546 | + | |
| 6547 | + | |
| 6548 | + | |
| 6549 | + | |
| 6550 | + | |
| 6551 | + | |
| 6552 | + | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
| 6557 | + | |
| 6558 | + | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
| 6563 | + | |
| 6564 | + | |
6535 | 6565 | | |
6536 | 6566 | | |
6537 | 6567 | | |
| |||
6846 | 6876 | | |
6847 | 6877 | | |
6848 | 6878 | | |
| 6879 | + | |
| 6880 | + | |
| 6881 | + | |
| 6882 | + | |
| 6883 | + | |
| 6884 | + | |
| 6885 | + | |
| 6886 | + | |
| 6887 | + | |
| 6888 | + | |
| 6889 | + | |
| 6890 | + | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
| 6895 | + | |
| 6896 | + | |
| 6897 | + | |
| 6898 | + | |
| 6899 | + | |
| 6900 | + | |
| 6901 | + | |
| 6902 | + | |
| 6903 | + | |
| 6904 | + | |
| 6905 | + | |
| 6906 | + | |
| 6907 | + | |
| 6908 | + | |
| 6909 | + | |
| 6910 | + | |
| 6911 | + | |
| 6912 | + | |
| 6913 | + | |
| 6914 | + | |
6849 | 6915 | | |
6850 | 6916 | | |
6851 | 6917 | | |
| |||
0 commit comments