aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/pusati_dh.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/pusati_dh.h')
-rw-r--r--riscv/insns/pusati_dh.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/riscv/insns/pusati_dh.h b/riscv/insns/pusati_dh.h
new file mode 100644
index 00000000..16eb4332
--- /dev/null
+++ b/riscv/insns/pusati_dh.h
@@ -0,0 +1,13 @@
+require_rv32;
+P_RD_RS1_DW_ULOOP(16, 16, {
+ uint64_t uint_max = insn.shamth() ? UINT64_MAX >> (64 - insn.shamth()) : 0;
+ int16_t s = (int16_t)p_rs1;
+ p_rd = p_rs1;
+ if (s < 0) {
+ p_rd = 0;
+ P.VU.vxsat->write(1);
+ } else if ((uint64_t)s > uint_max) {
+ p_rd = uint_max;
+ P.VU.vxsat->write(1);
+ }
+}) \ No newline at end of file