[Bug tree-optimization/115976] New: Missing uadd_sat/usub_sat vectorization
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 17 21:38:05 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115976
Bug ID: 115976
Summary: Missing uadd_sat/usub_sat vectorization
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: riscv
Take:
```
void f1(unsigned *__restrict__ a, unsigned * __restrict__ b)
{
for(int i = 0;i < 1024;i ++)
{
unsigned long long ta = a[i];
unsigned long long tb = b[i];
unsigned long long tt = ta + tb;
if (tt > -1u)
tt = -1u;
a[i] = tt;
}
}
void f2(unsigned *__restrict__ a, unsigned * __restrict__ b)
{
for(int i = 0;i < 1024;i ++)
{
unsigned long long ta = a[i];
unsigned long long tb = b[i];
unsigned long long tt = ta - tb;
if (tt < 0)
tt = 0;
if (tt > -1u)
tt = -1u;
a[i] = tt;
}
}
```
f1 should produce a SAT_ADD (unsigned) but currently it produces an widening
add followed by a SAT_TRUNC.
f2 should produce a SAT_SUB (unsigned) but currently it produces an widening
sub followed by a SAT_TRUNC.
Note this is forwarded from https://github.com/llvm/llvm-project/pull/99250.
More information about the Gcc-bugs
mailing list