| Issue |
83586
|
| Summary |
[x86] Consider not optimizing away `andn` when it can save a `mov` instruction
|
| Labels |
|
| Assignees |
|
| Reporter |
Validark
|
This code:
```c
#include <stdint.h>
uint64_t select(uint64_t a, uint64_t x, uint64_t y) {
return (a & x) | (~a & y);
}
```
Currently gives this on x86:
```asm
select: # @select
mov rax, rsi
xor rax, rdx
and rax, rdi
xor rax, rdx
ret
```
Alternatively, this could be:
```asm
select:
and rsi, rdi
andn rax, rdi, rdx
or rax, rsi
ret
```
`andn` helps us eliminate a `mov`, in this particular case. Would it be possible to take this effect into consideration when deciding whether to apply this optimization? Should it be taken into consideration?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs