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

Dávid Bolvanský <david.bolvansky at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david.bolvansky at gmail dot 
com

--- Comment #6 from Dávid Bolvanský <david.bolvansky at gmail dot com> ---
void swap (std::pair<int, int> &x)
  {
    int y[2], t;
    static_assert (sizeof x == sizeof y);
    __builtin_memcpy (y, &x, sizeof x);
    t = y[0]; y[0] = y[1]; y[1] = t;
    __builtin_memcpy (&x, y, sizeof x);
  }


-O3 x86-64 codegen is regressed in trunk, -O2/-Os is okay

_Z4swapRSt4pairIiiE:
  movq (%rdi), %rax
  movd (%rdi), %xmm1
  sarq $32, %rax
  movq %rax, %xmm0
  punpckldq %xmm1, %xmm0
  movq %xmm0, (%rdi)
  ret

Reply via email to