aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vsadd_vi.h
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/insns/vsadd_vi.h')
-rw-r--r--riscv/insns/vsadd_vi.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/riscv/insns/vsadd_vi.h b/riscv/insns/vsadd_vi.h
new file mode 100644
index 0000000..de2cb83
--- /dev/null
+++ b/riscv/insns/vsadd_vi.h
@@ -0,0 +1,27 @@
+// vsadd.vi vd, vs2 simm5
+VI_LOOP_BASE
+bool sat = false;
+switch(sew) {
+case e8: {
+ VI_PARAMS(e8);
+ vd = sat_add<int8_t, uint8_t>(vs2, vsext(simm5, sew), sat);
+ break;
+}
+case e16: {
+ VI_PARAMS(e16);
+ vd = sat_add<int16_t, uint16_t>(vs2, vsext(simm5, sew), sat);
+ break;
+}
+case e32: {
+ VI_PARAMS(e32);
+ vd = sat_add<int32_t, uint32_t>(vs2, vsext(simm5, sew), sat);
+ break;
+}
+default: {
+ VI_PARAMS(e64);
+ vd = sat_add<int64_t, uint64_t>(vs2, vsext(simm5, sew), sat);
+ break;
+}
+}
+P.VU.vxsat |= sat;
+VI_LOOP_END