https://bugs.llvm.org/show_bug.cgi?id=44895
Bug ID: 44895
Summary: Use ROL to swap scalars
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
#include <utility>
void swap (std::pair<int, int> &x)
{
int y[2], t;
__builtin_memcpy (y, &x, sizeof x);
t = y[0]; y[0] = y[1]; y[1] = t;
__builtin_memcpy (&x, y, sizeof x);
}
Clang -Oz/O3:
movl (%rdi), %eax
movl 4(%rdi), %ecx
movl %ecx, (%rdi)
movl %eax, 4(%rdi)
retq
GCC 9.2:
rol QWORD PTR [rdi], 32
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs