| Issue |
60941
|
| Summary |
[Missing optimization] Atomic add or subtract a pointer
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
youngbe
|
src:
```c
#include <stdatomic.h>
#include <stdint.h>
_Atomic(uintptr_t) y;
_Atomic(uint8_t *) x;
void ppp()
{
++x;
++y;
}
```
gcc-12 -Ofast:
```
ppp:
lock addq $1, x(%rip)
lock addq $1, y(%rip)
ret
```
clang 15.0.6 -Ofast:
```
ppp: # @ppp
.Lppp$local:
movq .Lx$local(%rip), %rax
.p2align 4, 0x90
.LBB0_1: # =>This Inner Loop Header: Depth=1
leaq 1(%rax), %rcx
lock cmpxchgq %rcx, .Lx$local(%rip)
jne .LBB0_1
lock incq .Ly$local(%rip)
retq
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs