[llvm-bugs] [Bug 45651] New: target attribute "cx16" is ignored
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 23 13:34:14 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: myriachan at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200423/09d9fb3a/attachment.html>
More information about the llvm-bugs
mailing list