Commit f494131
committed
[APFloat] Fix getExactInverse for DoubleAPFloat
Some background: getExactInverse()'s callers expect that
the result is not subnormal.
DoubleAPFloat implemented getExactInverse() by going through
semPPCDoubleDoubleLegacy.
This means that numbers like 0x1p1022 which would have a normal inverse
in semPPCDoubleDouble would not in semPPCDoubleDoubleLegacy.
This commit refactors the logic into a single method on APFloat which
uses getExactLog2Abs() and scalbn() to calculate the inverse without
having to compute a reciprocal and test if it is inexact.
This approach works for both IEEEFloat and DoubleAPFloat.1 parent 4db8b64 commit f494131
File tree
3 files changed
+66
-52
lines changed- llvm
- include/llvm/ADT
- lib/Support
- unittests/ADT
3 files changed
+66
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | 608 | | |
613 | 609 | | |
614 | 610 | | |
| |||
886 | 882 | | |
887 | 883 | | |
888 | 884 | | |
889 | | - | |
890 | | - | |
891 | 885 | | |
892 | 886 | | |
893 | 887 | | |
| |||
1500 | 1494 | | |
1501 | 1495 | | |
1502 | 1496 | | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1506 | 1500 | | |
1507 | 1501 | | |
1508 | 1502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4575 | 4575 | | |
4576 | 4576 | | |
4577 | 4577 | | |
4578 | | - | |
4579 | | - | |
4580 | | - | |
4581 | | - | |
4582 | | - | |
4583 | | - | |
4584 | | - | |
4585 | | - | |
4586 | | - | |
4587 | | - | |
4588 | | - | |
4589 | | - | |
4590 | | - | |
4591 | | - | |
4592 | | - | |
4593 | | - | |
4594 | | - | |
4595 | | - | |
4596 | | - | |
4597 | | - | |
4598 | | - | |
4599 | | - | |
4600 | | - | |
4601 | | - | |
4602 | | - | |
4603 | | - | |
4604 | | - | |
4605 | | - | |
4606 | | - | |
4607 | 4578 | | |
4608 | 4579 | | |
4609 | 4580 | | |
| |||
5731 | 5702 | | |
5732 | 5703 | | |
5733 | 5704 | | |
5734 | | - | |
5735 | | - | |
5736 | | - | |
5737 | | - | |
5738 | | - | |
5739 | | - | |
5740 | | - | |
5741 | | - | |
5742 | | - | |
5743 | | - | |
5744 | | - | |
5745 | 5705 | | |
5746 | 5706 | | |
5747 | 5707 | | |
| |||
5926 | 5886 | | |
5927 | 5887 | | |
5928 | 5888 | | |
| 5889 | + | |
| 5890 | + | |
| 5891 | + | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
| 5896 | + | |
| 5897 | + | |
| 5898 | + | |
| 5899 | + | |
| 5900 | + | |
| 5901 | + | |
| 5902 | + | |
| 5903 | + | |
| 5904 | + | |
| 5905 | + | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
| 5909 | + | |
| 5910 | + | |
| 5911 | + | |
| 5912 | + | |
| 5913 | + | |
| 5914 | + | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
| 5918 | + | |
| 5919 | + | |
| 5920 | + | |
| 5921 | + | |
| 5922 | + | |
| 5923 | + | |
| 5924 | + | |
| 5925 | + | |
| 5926 | + | |
| 5927 | + | |
| 5928 | + | |
| 5929 | + | |
| 5930 | + | |
| 5931 | + | |
| 5932 | + | |
| 5933 | + | |
| 5934 | + | |
| 5935 | + | |
| 5936 | + | |
| 5937 | + | |
| 5938 | + | |
| 5939 | + | |
| 5940 | + | |
5929 | 5941 | | |
5930 | 5942 | | |
5931 | 5943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1921 | 1930 | | |
1922 | 1931 | | |
1923 | 1932 | | |
| |||
6661 | 6670 | | |
6662 | 6671 | | |
6663 | 6672 | | |
6664 | | - | |
| 6673 | + | |
6665 | 6674 | | |
6666 | | - | |
| 6675 | + | |
6667 | 6676 | | |
6668 | 6677 | | |
6669 | 6678 | | |
6670 | | - | |
6671 | 6679 | | |
6672 | 6680 | | |
6673 | 6681 | | |
| |||
0 commit comments