llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.47k stars 11.77k forks source link

clang-10 fails to compile C-embedded assembly with SSE and AVX instructions #47541

Open yurivict opened 3 years ago

yurivict commented 3 years ago
Bugzilla Link 48197
Version 10.0
OS FreeBSD
Attachments test_sse.cpp, test_avx.cpp
CC @DougGregor,@zygoloid

Extended Description

The attached testcases test_sse.cpp and test_avx.cpp fail on FreeBSD 12.2 with clang-10:

[yuri@yv /tmp/llvm-asm-failure]$ c++ -O2 -fPIC -o test_sse.gcc.o -msse -c test_sse.cpp
test_sse.cpp:9:39: error: expected relocatable expression
        "movups 0x00 + %[xs], %%xmm0\n\t"
                                      ^
<inline asm>:2:2: note: instantiated into assembly here
        movups %xmm0, 0x00 + (%rax)
        ^
1 error generated.
[yuri@yv /tmp/llvm-asm-failure]$ c++ -O2 -fPIC -o test_sse.gcc.o -msse -c test_avx.cpp 
test_avx.cpp:9:40: error: expected relocatable expression
        "vmovups 0x00 + %[xs], %%ymm0\n\t"
                                       ^
<inline asm>:2:2: note: instantiated into assembly here
        vmovups %ymm0, 0x00 + (%rax)
        ^
1 error generated.

Originally spotted by the author of LSP-plugins Vladimir Sadovnikov: https://github.com/sadko4u/lsp-plugins/issues/154#issuecomment-728394467

llvmbot commented 2 months ago

@llvm/issue-subscribers-backend-x86

Author: yuri@FreeBSD (yurivict)

| | | | --- | --- | | Bugzilla Link | [48197](https://llvm.org/bz48197) | | Version | 10.0 | | OS | FreeBSD | | Attachments | [test_sse.cpp](https://user-images.githubusercontent.com/95090477/143761419-f0a9f71e-b713-4d40-ad6b-3196f20732c6.gz), [test_avx.cpp](https://user-images.githubusercontent.com/95090477/143761420-190be23d-b1f8-41dc-87d6-8ecc2617571e.gz) | | CC | @DougGregor,@zygoloid | ## Extended Description The attached testcases `test_sse.cpp` and `test_avx.cpp` fail on FreeBSD 12.2 with clang-10: ``` [yuri@yv /tmp/llvm-asm-failure]$ c++ -O2 -fPIC -o test_sse.gcc.o -msse -c test_sse.cpp test_sse.cpp:9:39: error: expected relocatable expression "movups 0x00 + %[xs], %%xmm0\n\t" ^ <inline asm>:2:2: note: instantiated into assembly here movups %xmm0, 0x00 + (%rax) ^ 1 error generated. [yuri@yv /tmp/llvm-asm-failure]$ c++ -O2 -fPIC -o test_sse.gcc.o -msse -c test_avx.cpp test_avx.cpp:9:40: error: expected relocatable expression "vmovups 0x00 + %[xs], %%ymm0\n\t" ^ <inline asm>:2:2: note: instantiated into assembly here vmovups %ymm0, 0x00 + (%rax) ^ 1 error generated. ``` Originally spotted by the author of LSP-plugins Vladimir Sadovnikov: https://github.com/sadko4u/lsp-plugins/issues/154#issuecomment-728394467