Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26720

Suboptimal translation of single-bit std::atomic::fetch_or() and fetch_and()

    XMLWordPrintable

    Details

      Description

      This is actually a compiler bug. The Intel 80386 processor introduced some bit operations that would be the perfect translation for atomic single-bit read-modify-and-write operations. Alas, even the latest compilers as of today (GCC, clang, Microsoft C compiler) would generate a loop around LOCK CMPXCHG instead of emitting the instructions LOCK BTS (fetch_or()), LOCK BTR (fetch_and()), LOCK BTC (fetch_xor()).

      We have several single-bit fetch_and() and fetch_or() operations that can be optimized to LOCK BTS or LOCK BTR, similar to (this fix of MDEV-26467).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration