Commit 616289e
committed
[LegalizeTypes][RISCV] Correctly sign-extend comparison for ATOMIC_CMP_XCHG
Summary:
Currently, the comparison argument used for ATOMIC_CMP_XCHG is legalised
with GetPromotedInteger, which leaves the upper bits of the value
undefind. Since this is used for comparing in an LR/SC loop with a
full-width comparison, we must sign extend it. We introduce a new
getExtendForAtomicCmpSwapArg to complement getExtendForAtomicOps, since
many targets have compare-and-swap instructions (or pseudos) that
correctly handle an any-extend input, and the existing function
determines the extension of the result, whereas we are concerned with
the input.
This is related to https://reviews.llvm.org/D58829, which solved the
issue for ATOMIC_CMP_SWAP_WITH_SUCCESS, but not the simpler
ATOMIC_CMP_SWAP.
Reviewers: asb, lenary, efriedma
Reviewed By: asb
Subscribers: arichardson, hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, evandro, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D744531 parent e3033c0 commit 616289e
File tree
4 files changed
+43
-1
lines changed- llvm
- include/llvm/CodeGen
- lib
- CodeGen/SelectionDAG
- Target/RISCV
- test/CodeGen/RISCV
4 files changed
+43
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1962 | 1962 | | |
1963 | 1963 | | |
1964 | 1964 | | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
1965 | 1977 | | |
1966 | 1978 | | |
1967 | 1979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
283 | 299 | | |
284 | 300 | | |
285 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1628 | 1628 | | |
1629 | 1629 | | |
1630 | 1630 | | |
| 1631 | + | |
1631 | 1632 | | |
1632 | 1633 | | |
1633 | 1634 | | |
| |||
1680 | 1681 | | |
1681 | 1682 | | |
1682 | 1683 | | |
| 1684 | + | |
1683 | 1685 | | |
1684 | 1686 | | |
1685 | 1687 | | |
| |||
1732 | 1734 | | |
1733 | 1735 | | |
1734 | 1736 | | |
| 1737 | + | |
1735 | 1738 | | |
1736 | 1739 | | |
1737 | 1740 | | |
| |||
1784 | 1787 | | |
1785 | 1788 | | |
1786 | 1789 | | |
| 1790 | + | |
1787 | 1791 | | |
1788 | 1792 | | |
1789 | 1793 | | |
| |||
1836 | 1840 | | |
1837 | 1841 | | |
1838 | 1842 | | |
| 1843 | + | |
1839 | 1844 | | |
1840 | 1845 | | |
1841 | 1846 | | |
| |||
1888 | 1893 | | |
1889 | 1894 | | |
1890 | 1895 | | |
| 1896 | + | |
1891 | 1897 | | |
1892 | 1898 | | |
1893 | 1899 | | |
| |||
1940 | 1946 | | |
1941 | 1947 | | |
1942 | 1948 | | |
| 1949 | + | |
1943 | 1950 | | |
1944 | 1951 | | |
1945 | 1952 | | |
| |||
1992 | 1999 | | |
1993 | 2000 | | |
1994 | 2001 | | |
| 2002 | + | |
1995 | 2003 | | |
1996 | 2004 | | |
1997 | 2005 | | |
| |||
2044 | 2052 | | |
2045 | 2053 | | |
2046 | 2054 | | |
| 2055 | + | |
2047 | 2056 | | |
2048 | 2057 | | |
2049 | 2058 | | |
| |||
2096 | 2105 | | |
2097 | 2106 | | |
2098 | 2107 | | |
| 2108 | + | |
2099 | 2109 | | |
2100 | 2110 | | |
2101 | 2111 | | |
| |||
0 commit comments