aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/div.h
blob: fb62437bb4242fc370daf895ca40d7aea6ab6a1f (plain)
1
2
3
4
5
6
7
8
9
require_extension('M');
sreg_t lhs = sext_xlen(RS1);
sreg_t rhs = sext_xlen(RS2);
if (rhs == 0)
  WRITE_RD(UINT64_MAX);
else if (lhs == INT64_MIN && rhs == -1)
  WRITE_RD(lhs);
else
  WRITE_RD(sext_xlen(lhs / rhs));