https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126982
Bug ID: 126982
Summary: [17 Regression] ICE in decompose, at wide-int.h:1049
with saturating matchers
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
#define N 64
/* A variable shift keeps the shift result in int, so the comparison of the
saturating truncation runs at a narrower precision than the value being
truncated. The comparison then only looks at the low bits, and the
truncation is not a saturating one. */
__attribute__ ((noipa)) void
sat_trunc (signed char *__restrict out, const short *__restrict in,
const unsigned short *__restrict shifts, int n)
{
for (int i = 0; i < n; ++i)
{
short x = in[i] >> (shifts[i] & 15);
signed char t = (signed char) x;
out[i] = (-128 <= x && x <= 127 ? t : x < 0 ? -128 : 127);
}
}
ICEs at -O3 on aarch64:
during GIMPLE pass: vect
<source>: In function 'sat_trunc':
<source>:9:1: internal compiler error: in decompose, at wide-int.h:1049
9 | sat_trunc (signed char *__restrict out, const short *__restrict in,
| ^~~~~~~~~