http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50498
Bug #: 50498 Summary: __sync_bool_compare_and_swap_16 isn't supported for x86_64 Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: ubiz...@gmail.com Target: x86_64 [hjl@gnu-6 tmp]$ gcc -S -O2 y.c [hjl@gnu-6 tmp]$ cat y.s .file "y.c" .text .p2align 4,,15 .globl f8 .type f8, @function f8: .LFB0: .cfi_startproc xorl %eax, %eax movl $1, %edx lock cmpxchgq %rdx, -8(%rsp) ret .cfi_endproc .LFE0: .size f8, .-f8 .p2align 4,,15 .globl f16 .type f16, @function f16: .LFB1: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 movl $1, %ecx xorl %r8d, %r8d movq %rsp, %rdi xorl %esi, %esi xorl %edx, %edx call __sync_bool_compare_and_swap_16 addq $24, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE1: .size f16, .-f16 .ident "GCC: (GNU) 4.6.0 20110603 (Red Hat 4.6.0-10)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 tmp]$ gcc -S -O2 y.c -m32 [hjl@gnu-6 tmp]$ cat y.s .file "y.c" .text .p2align 4,,15 .globl f8 .type f8, @function f8: .LFB0: .cfi_startproc pushl %ebx .cfi_def_cfa_offset 8 .cfi_offset 3, -8 xorl %eax, %eax subl $16, %esp .cfi_def_cfa_offset 24 xorl %edx, %edx movl $1, %ebx xorl %ecx, %ecx lock cmpxchg8b 8(%esp) addl $16, %esp .cfi_def_cfa_offset 8 popl %ebx .cfi_def_cfa_offset 4 .cfi_restore 3 ret .cfi_endproc .LFE0: .size f8, .-f8 .ident "GCC: (GNU) 4.6.0 20110603 (Red Hat 4.6.0-10)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 tmp]$ I am using cmpxchg16b for __sync_bool_compare_and_swap_16.