aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/clz.h
blob: d334e40ba0dc68d3a70b8f6c0d68a9ec4ab7d965 (plain)
1
2
3
4
5
require_extension(EXT_ZBB);
reg_t x = xlen;
for (int i = 0; i < xlen; i++)
  if (1 & (RS1 >> (xlen-i-1))) { x = i; break; }
WRITE_RD(sext_xlen(x));