aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/kdmabt.h
blob: d542cfc6a5e04f5e685af3e2151b4e95391f268f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_extension('P');
sreg_t res;
sreg_t aop = P_SH(RS1, 0);
sreg_t bop = P_SH(RS2, 1);

if ((INT16_MIN != aop) | (INT16_MIN != bop)) {
  res = aop * bop;
  res <<= 1;
} else {
  res = INT32_MAX;
  P_SET_OV(1);
}

res += sext32(RD);
P_SAT(res, 32);
WRITE_RD(sext32(res));