https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120378

--- Comment #3 from Robin Dapp <rdapp at gcc dot gnu.org> ---
vnclipu is basically a scaling (narrowing), rounding shift with subsequent
"clip" i.e. saturation.  Its input and output is unsigned, though, so for the
function above we first need to "clip" the negative values to 0 and then shift
twice from unsigned int to unsigned char.

So far I'm only aware of the vector insn but I think there are discussions
about a scalar one for a future extension.

There's also vnclip (signed -> signed).

An alternative to vnclipu would be vmax (vmin (...)) but then we'd still need
to truncate the result 2x.  Truncations are narrowing shifts as well, meaning
we'd need 4 instructions instead of 3.

Reply via email to