aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/psabs_h.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/psabs_h.h')
-rw-r--r--riscv/insns/psabs_h.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/riscv/insns/psabs_h.h b/riscv/insns/psabs_h.h
new file mode 100644
index 00000000..54564afe
--- /dev/null
+++ b/riscv/insns/psabs_h.h
@@ -0,0 +1,5 @@
+P_RD_RS1_LOOP(16, 16, {
+ sreg_t abs_val = p_rs1 > 0 ? p_rs1 : -sext32(p_rs1);
+ p_rd = P_SAT(16, abs_val);
+ if (p_rd != abs_val) P.VU.vxsat->write(1);
+}) \ No newline at end of file