public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96176] New: Failure to omit extraneous movzx in atomic compare exchange with unsigned char
@ 2020-07-12 23:49 gabravier at gmail dot com
  2020-07-13 10:48 ` [Bug target/96176] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2020-07-12 23:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96176
           Summary: Failure to omit extraneous movzx in atomic compare
                    exchange with unsigned char
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

void f(unsigned char *addr, unsigned char old_val, unsigned char new_val)
{
    __atomic_compare_exchange_n(addr, &old_val, new_val, 0, 0, 0);
}

On x86 with -O3, LLVM generates this :

f(unsigned char*, unsigned char, unsigned char): # @f(unsigned char*, unsigned
char, unsigned char)
  mov eax, esi
  lock cmpxchg byte ptr [rdi], dl
  ret

GCC generates this :

f(unsigned char*, unsigned char, unsigned char):
  mov eax, esi
  movzx edx, dl
  lock cmpxchg BYTE PTR [rdi], dl
  ret

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-20 17:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 23:49 [Bug target/96176] New: Failure to omit extraneous movzx in atomic compare exchange with unsigned char gabravier at gmail dot com
2020-07-13 10:48 ` [Bug target/96176] " jakub at gcc dot gnu.org
2020-07-13 10:48 ` jakub at gcc dot gnu.org
2020-07-15  9:29 ` cvs-commit at gcc dot gnu.org
2020-07-15 10:00 ` jakub at gcc dot gnu.org
2024-01-20 17:16 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).