[X86][AVX512] suboptimal scalar source vecinit codegen on avx512
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
found from https://github.com/gcc-mirror/gcc/commit/f0bd50e831792692ffcedf288b312167a9339260
https://godbolt.org/z/he11xG4z6
```c
typedef float v4sf __attribute__ ((__vector_size__ (16)));
v4sf fabab(float a, float b) { return (v4sf){a,b,a,b}; }
```
-O3 -march=x86-64-v3:
```asm
fabab:
vinsertps xmm0, xmm0, xmm1, 16
vmovddup xmm0, xmm0
ret
```
-O3 -march=x86-64-v3 -mavx512vl:
```asm
.LCPI0_0:
.long 0
.long 4
fabab:
vmovddup xmm2, qword ptr [rip + .LCPI0_0]
vpermt2ps xmm0, xmm2, xmm1
ret
```
Contributor guide
Research direction
Start by compiling the provided C reproducer with -O3 -march=x86-64-v3, then repeat with -mavx512vl and compare the Godbolt assembly. Trace the x86 AVX512 vector-initialization code generation responsible for the vmovddup/vpermt2ps sequence. Done means the AVX512 case produces code at least as efficient as the non-AVX512 case, with regression coverage for the reproducer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100