Commit beec8ab
committed
[X86] Prefer
Originally opened as https://reviews.llvm.org/D129947
LLVM currently emits `mfence` for `__atomic_thread_fence(seq_cst)`. On
modern CPUs lock or is more efficient and provides the same sequential
consistency. GCC 11 made this switch as well (see https://gcc.gnu.org/pipermail/gcc-cvs/2020-July/314418.html)
and https://reviews.llvm.org/D61863 and https://reviews.llvm.org/D58632
moved into this direction as well, but didn't touch fence seq_cst.
Amusingly this came up elsewhere: https://www.reddit.com/r/cpp_questions/comments/16uer2g/how_do_i_stop_clang_generating_mfence/
After another 2 years it doesn't look like anyone complained about the
GCC switch. And there is still `__builtin_ia32_mfence` for folks who
want this precise instruction.lock or over mfence1 parent fa93be4 commit beec8ab
File tree
3 files changed
+34
-18
lines changed- llvm
- lib/Target/X86
- test/CodeGen/X86
3 files changed
+34
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
754 | 754 | | |
755 | 755 | | |
756 | 756 | | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
757 | 761 | | |
758 | 762 | | |
759 | 763 | | |
| |||
882 | 886 | | |
883 | 887 | | |
884 | 888 | | |
885 | | - | |
| 889 | + | |
| 890 | + | |
886 | 891 | | |
887 | 892 | | |
888 | 893 | | |
| |||
903 | 908 | | |
904 | 909 | | |
905 | 910 | | |
906 | | - | |
| 911 | + | |
| 912 | + | |
907 | 913 | | |
908 | 914 | | |
909 | 915 | | |
| |||
969 | 975 | | |
970 | 976 | | |
971 | 977 | | |
972 | | - | |
| 978 | + | |
| 979 | + | |
973 | 980 | | |
974 | 981 | | |
975 | 982 | | |
| |||
1004 | 1011 | | |
1005 | 1012 | | |
1006 | 1013 | | |
1007 | | - | |
| 1014 | + | |
| 1015 | + | |
1008 | 1016 | | |
1009 | 1017 | | |
1010 | 1018 | | |
| |||
1047 | 1055 | | |
1048 | 1056 | | |
1049 | 1057 | | |
1050 | | - | |
| 1058 | + | |
| 1059 | + | |
1051 | 1060 | | |
1052 | 1061 | | |
1053 | 1062 | | |
| |||
1076 | 1085 | | |
1077 | 1086 | | |
1078 | 1087 | | |
1079 | | - | |
| 1088 | + | |
| 1089 | + | |
1080 | 1090 | | |
1081 | 1091 | | |
1082 | 1092 | | |
| |||
1222 | 1232 | | |
1223 | 1233 | | |
1224 | 1234 | | |
1225 | | - | |
| 1235 | + | |
| 1236 | + | |
1226 | 1237 | | |
1227 | 1238 | | |
1228 | 1239 | | |
| |||
1429 | 1440 | | |
1430 | 1441 | | |
1431 | 1442 | | |
1432 | | - | |
| 1443 | + | |
| 1444 | + | |
1433 | 1445 | | |
1434 | 1446 | | |
1435 | 1447 | | |
| |||
1509 | 1521 | | |
1510 | 1522 | | |
1511 | 1523 | | |
1512 | | - | |
| 1524 | + | |
| 1525 | + | |
1513 | 1526 | | |
1514 | 1527 | | |
1515 | 1528 | | |
| |||
1664 | 1677 | | |
1665 | 1678 | | |
1666 | 1679 | | |
1667 | | - | |
| 1680 | + | |
| 1681 | + | |
1668 | 1682 | | |
1669 | 1683 | | |
1670 | 1684 | | |
| |||
1684 | 1698 | | |
1685 | 1699 | | |
1686 | 1700 | | |
1687 | | - | |
| 1701 | + | |
| 1702 | + | |
1688 | 1703 | | |
1689 | 1704 | | |
1690 | 1705 | | |
| |||
1703 | 1718 | | |
1704 | 1719 | | |
1705 | 1720 | | |
1706 | | - | |
| 1721 | + | |
| 1722 | + | |
1707 | 1723 | | |
1708 | 1724 | | |
1709 | 1725 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31103 | 31103 | | |
31104 | 31104 | | |
31105 | 31105 | | |
31106 | | - | |
| 31106 | + | |
31107 | 31107 | | |
31108 | 31108 | | |
31109 | 31109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2096 | 2096 | | |
2097 | 2097 | | |
2098 | 2098 | | |
2099 | | - | |
| 2099 | + | |
2100 | 2100 | | |
2101 | 2101 | | |
2102 | 2102 | | |
| |||
2170 | 2170 | | |
2171 | 2171 | | |
2172 | 2172 | | |
2173 | | - | |
| 2173 | + | |
2174 | 2174 | | |
2175 | 2175 | | |
2176 | 2176 | | |
| |||
2197 | 2197 | | |
2198 | 2198 | | |
2199 | 2199 | | |
2200 | | - | |
| 2200 | + | |
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
| |||
2321 | 2321 | | |
2322 | 2322 | | |
2323 | 2323 | | |
2324 | | - | |
| 2324 | + | |
2325 | 2325 | | |
2326 | 2326 | | |
2327 | 2327 | | |
| |||
2335 | 2335 | | |
2336 | 2336 | | |
2337 | 2337 | | |
2338 | | - | |
| 2338 | + | |
2339 | 2339 | | |
2340 | 2340 | | |
2341 | 2341 | | |
| |||
0 commit comments