Normalize shift amount
The NSA (normalize shift amount) instruction returns the number of contiguous sign bits in the most significant bits of a 32-bit signed value. The NSAU instruction returns the number of contiguous zero bits in the most significant bits of a 32-bit unsigned value. These instructions are not inferred by the compiler. However, library routines provided by Xtensa, in particular integer division and modulo, make heavy use of these instructions when present. The instructions can be accessed via intrinsics as follows:
#include <xtensa/tie/xt_misc.h> int a, b; unsigned ub; ... a = XT_NSA(b); a = XT_NSAU(ub);