https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64991

            Bug ID: 64991
           Summary: Issues depending on atomic variable type.
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: u17263 at att dot net

Created attachment 34709
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34709&action=edit
test case

When a variable associated with an atomic update is an integer, the generated
gimple will contain a __atomic_fetch_add_4 (). The emitted instruction on an
x86 will load the value, add to it, and write it as a single atomic
instruction.

However, when the variable is a real, the generated gimple will contain an
atomic operation to load the variable (__atomic_load_4), the addition
operation, and an atomic operation to store the variable
(__sync_val_compare_and_swap_4). Given the integer example, I would have
expected that in the case of the real, that the load, addition, and store would
be an entire critical section.

Reply via email to