FreeBSD Bugzilla – Attachment 198890 Details for
Bug 232911
Assembly code crashes clang
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
c++ testcase
clang-test.cpp (text/plain), 3.97 KB, created by
Yuri Victorovich
on 2018-11-02 16:15:34 UTC
(
hide
)
Description:
c++ testcase
Filename:
MIME Type:
Creator:
Yuri Victorovich
Created:
2018-11-02 16:15:34 UTC
Size:
3.97 KB
patch
obsolete
>#include <sys/types.h> >#include <stdint.h> > >#define ARCH_X86_ASM(...) __asm__ __volatile__ ( __VA_ARGS__ ) >#define __ASM_EMIT(code) code "\n\t" > >namespace sse >{ > void fill(float *dst, float value, size_t count) > { > #define FILL_CORE \ > /* Blocks of 32 items */ \ > __ASM_EMIT("sub $0x20, %[count]") \ > __ASM_EMIT("jb 4f") \ > __ASM_EMIT("movaps %%xmm0, %%xmm4") \ > __ASM_EMIT("movaps %%xmm1, %%xmm5") \ > __ASM_EMIT("movaps %%xmm2, %%xmm6") \ > __ASM_EMIT("movaps %%xmm3, %%xmm7") \ > __ASM_EMIT("3:") \ > __ASM_EMIT("movaps %%xmm0, 0x00(%[dst])") \ > __ASM_EMIT("movaps %%xmm1, 0x10(%[dst])") \ > __ASM_EMIT("movaps %%xmm2, 0x20(%[dst])") \ > __ASM_EMIT("movaps %%xmm3, 0x30(%[dst])") \ > __ASM_EMIT("movaps %%xmm4, 0x40(%[dst])") \ > __ASM_EMIT("movaps %%xmm5, 0x50(%[dst])") \ > __ASM_EMIT("movaps %%xmm6, 0x60(%[dst])") \ > __ASM_EMIT("movaps %%xmm7, 0x70(%[dst])") \ > __ASM_EMIT("add $0x80, %[dst]") \ > __ASM_EMIT("sub $0x20, %[count]") \ > __ASM_EMIT("jae 3b") \ > /* Blocks of 16 items */ \ > __ASM_EMIT("4:") \ > __ASM_EMIT("add $0x20, %[count]") \ > __ASM_EMIT("test $0x10, %[count]") \ > __ASM_EMIT("jz 5f") \ > __ASM_EMIT("movaps %%xmm0, 0x00(%[dst])") \ > __ASM_EMIT("movaps %%xmm1, 0x10(%[dst])") \ > __ASM_EMIT("movaps %%xmm2, 0x20(%[dst])") \ > __ASM_EMIT("movaps %%xmm3, 0x30(%[dst])") \ > __ASM_EMIT("add $0x40, %[dst]") \ > /* Blocks of 8 items */ \ > __ASM_EMIT("5:") \ > __ASM_EMIT("test $0x08, %[count]") \ > __ASM_EMIT("jz 6f") \ > __ASM_EMIT("movaps %%xmm0, 0x00(%[dst])") \ > __ASM_EMIT("movaps %%xmm1, 0x10(%[dst])") \ > __ASM_EMIT("add $0x20, %[dst]") \ > /* Blocks of 4 items */ \ > __ASM_EMIT("6:") \ > __ASM_EMIT("test $0x04, %[count]") \ > __ASM_EMIT("jz 7f") \ > __ASM_EMIT("movaps %%xmm0, 0x00(%[dst])") \ > __ASM_EMIT("add $0x10, %[dst]") \ > /* Tail */ \ > __ASM_EMIT("7:") \ > __ASM_EMIT("and $0x03, %[count]") \ > __ASM_EMIT("jz 2000f") \ > __ASM_EMIT("8:") \ > __ASM_EMIT("movss %%xmm0, 0x00(%[dst])") \ > __ASM_EMIT("add $0x04, %[dst]") \ > __ASM_EMIT("dec %[count]") \ > __ASM_EMIT("jnz 8b") > > ARCH_X86_ASM > ( > __ASM_EMIT("test %[count], %[count]") > __ASM_EMIT("jz 2000f") > __ASM_EMIT("shufps $0x00, %%xmm0, %%xmm0") > > /* Align destination */ > __ASM_EMIT("1:") > __ASM_EMIT("test $0x0f, %[dst]") > __ASM_EMIT("jz 2f") > __ASM_EMIT("movss %%xmm0, 0x00(%[dst])") > __ASM_EMIT("add $0x4, %[dst]") > __ASM_EMIT("dec %[count]") > __ASM_EMIT("jnz 1b") > __ASM_EMIT("jmp 2000f") > > __ASM_EMIT("2:") > __ASM_EMIT("movaps %%xmm0, %%xmm1") > __ASM_EMIT("movaps %%xmm0, %%xmm2") > __ASM_EMIT("movaps %%xmm1, %%xmm3") > > /* Destination is aligned */ > FILL_CORE > > __ASM_EMIT("2000:") > > : [dst] "+r"(dst), [count] "+r" (count), "+Yz"(value) : > : "cc", "memory", > "%xmm1", "%xmm2", "%xmm3", > "%xmm4", "%xmm5", "%xmm6", "%xmm7" > ); > > #undef FILL_CORE > } >} > >float test[0x100]; > >int main() >{ > sse::fill(test, 1.0f, sizeof(test)/sizeof(float)); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 232911
: 198890