https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122525
Bug ID: 122525
Summary: uaddc5 and usubc5 optab is not implemented
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
Take:
```
struct h2
{
unsigned long lo1;
unsigned long lo2;
long hi;
};
struct h2 g2(struct h2 t0, struct h2 t1)
{
struct h2 t;
unsigned long c;
t.lo1 = __builtin_addcl(t0.lo1, t1.lo1, 0, &c);
t.lo2 = __builtin_addcl(t0.lo2, t1.lo2, c, &c);
t.hi = __builtin_addcl(t0.hi, t1.hi, c, &c);
return t;
}
```
This should just be:
```
ldp x9, x12, [x1]
ldr x13, [x1, #16]
ldp x10, x11, [x0]
adds x9, x10, x9
ldr x10, [x0, #16]
adcs x11, x11, x12
stp x9, x11, [x8]
adc x9, x13, x10
str x9, [x8, #16]
```
But current GCC produces:
```
ldp x4, x5, [x1]
ldp x3, x2, [x0]
ldr x0, [x0, 16]
adds x3, x3, x4
cset x4, cs
adds x2, x2, x5
ldr x5, [x1, 16]
cset x1, cs
adds x4, x4, x2
stp x3, x4, [x8]
cset x2, cs
add x0, x0, x5
orr x1, x1, x2
add x0, x0, x1
str x0, [x8, 16]
```
This is because the uaddc5 optab is not implemented for DImode.