https://bugs.llvm.org/show_bug.cgi?id=45651
Bug ID: 45651
Summary: target attribute "cx16" is ignored
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangb...@nondot.org
Reporter: myriac...@gmail.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
Compile the following with -O2 on x86_64:
__attribute__((__target__("cx16")))
void write128(_Atomic(__int128)* p, __int128 v)
{
__c11_atomic_store(p, v, __ATOMIC_SEQ_CST);
}
That generates:
<source>:4:5: warning: large atomic operation may incur significant performance
penalty [-Watomic-alignment]
__c11_atomic_store(p, v, __ATOMIC_SEQ_CST);
^
1 warning generated.
_Z8write128Pnn: # @_Z8write128Pnn
sub rsp, 24
mov rax, rdi
mov qword ptr [rsp + 8], rdx
mov qword ptr [rsp], rsi
mov rdx, rsp
mov edi, 16
mov rsi, rax
mov ecx, 5
call __atomic_store
add rsp, 24
ret
If you add -mcx16 to the command line, Clang generates the intended code:
_Z8write128Pnn: # @_Z8write128Pnn
push rbx
mov rcx, rdx
mov rbx, rsi
mov rax, qword ptr [rdi]
mov rdx, qword ptr [rdi + 8]
.LBB0_1: # =>This Inner Loop Header: Depth=1
lock cmpxchg16b xmmword ptr [rdi]
jne .LBB0_1
pop rbx
ret
--
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