llvm / llvm/llvm-project

[X86] meaningless vzeroupper

Open
#215,488 3 comments 0 reactions 0 assignees View on GitHub
backend:X86 missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

noticed from #40250

```llvm
define double @copysign_v4f64(<4 x double> %x, <4 x double> %y) nounwind {
%v = call <4 x double> @llvm.copysign.v4f64(<4 x double> %x, <4 x double> %y)
%r = extractelement <4 x double> %v, i32 0
ret double %r
}
```
```asm
.LCPI0_0:
.quad 0x7fffffffffffffff # double NaN
copysign_v4f64: # @copysign_v4f64
vpternlogq $228, .LCPI0_0(%rip){1to2}, %xmm1, %xmm0 # xmm0 = xmm1 ^ (m64bcst & (xmm0 ^ xmm1))
vzeroupper
retq
```
https://godbolt.org/z/6vYTb4xhx

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the LLVM IR and x86 assembly shown in the issue, using the linked Compiler Explorer example as a reference. Trace the compiler's handling of this vector operation and verify that the completed change no longer emits the meaningless vzeroupper while preserving the generated result.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.