https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108818
Bug ID: 108818
Summary: [aarch64] use a extra mov instruction compare to llvm
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zhongyunde at huawei dot com
Target Milestone: ---
* test:https://gcc.godbolt.org/z/res6aTYqP
```
unsigned sel(unsigned X) {
return X == 6 ? 6 : 8;
}
```
* gcc:
```
sel:
cmp w0, 6
mov w1, 8
mov w0, 6
csel w0, w1, w0, ne
ret
```
* llvm:
```
sel: // @sel
mov w8, #8
cmp w0, #6
csel w0, w0, w8, eq
ret
```