rv_xxx convert c_xxx
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 05:41:04 +0000 (06:41 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 05:41:04 +0000 (06:41 +0100)
27 files changed:
riscv/insns/c_add.h
riscv/insns/c_addi.h
riscv/insns/c_addi4spn.h
riscv/insns/c_addw.h
riscv/insns/c_and.h
riscv/insns/c_andi.h
riscv/insns/c_beqz.h
riscv/insns/c_bnez.h
riscv/insns/c_fld.h
riscv/insns/c_fldsp.h
riscv/insns/c_flw.h
riscv/insns/c_flwsp.h
riscv/insns/c_fsd.h
riscv/insns/c_fsdsp.h
riscv/insns/c_fsw.h
riscv/insns/c_fswsp.h
riscv/insns/c_lw.h
riscv/insns/c_lwsp.h
riscv/insns/c_or.h
riscv/insns/c_slli.h
riscv/insns/c_srai.h
riscv/insns/c_srli.h
riscv/insns/c_sub.h
riscv/insns/c_subw.h
riscv/insns/c_sw.h
riscv/insns/c_swsp.h
riscv/insns/c_xor.h

index ab7d4d4c8e643f252c80f6df73077d34a46f0d66..d9ecc32400422642935cc0678c9e8593aa4d1b32 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_rs2() != 0);
-WRITE_RD(sext_xlen(RVC_RS1 + RVC_RS2));
+WRITE_RD(sext_xlen(rv_add(RVC_RS1, RVC_RS2)));
index eb983442a37e1407e1eb2240737a5ab76f7820ae..172475f3580f0a35823a44a041bdc8db8edd17b9 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RD(sext_xlen(RVC_RS1 + insn.rvc_imm()));
+WRITE_RD(sext_xlen(rv_add(RVC_RS1, insn.rvc_imm())));
index e5f3832f605b43ccc35106fe5b61570eca4ce6d6..c4ff389b86c0dd76e7304a6bf4bfaba5f17d7282 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_addi4spn_imm() != 0);
-WRITE_RVC_RS2S(sext_xlen(RVC_SP + insn.rvc_addi4spn_imm()));
+WRITE_RVC_RS2S(sext_xlen(rv_add(RVC_SP, insn.rvc_addi4spn_imm())));
index 6e0ae3a52c2dab09dbe545d357b50fae493457f8..c05b5bd4697ff07be551ff36dcb2084a237900a8 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require_rv64;
-WRITE_RVC_RS1S(sext32(RVC_RS1S + RVC_RS2S));
+WRITE_RVC_RS1S(sext32(rv_add(RVC_RS1S, RVC_RS2S)));
index 4d7bab6c58997478d6542312f78282820df1bdd6..aefdd03a8f3c513957eba33efb5761d79bd9d7e3 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S & RVC_RS2S);
+WRITE_RVC_RS1S(rv_and(RVC_RS1S, RVC_RS2S));
index 9de5a1acb08b0190797bd94d5be3b0ff4bb4c9fc..73fe0a21ab68feab4414c830ed58af200870f990 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S & insn.rvc_imm());
+WRITE_RVC_RS1S(rv_and(RVC_RS1S, insn.rvc_imm()));
index 35c119603d08ab51bc87d391a324e24a7d0cf972..01bec6c1efd23cbc99a4f0ddfbadb32f72008e6e 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
-if (RVC_RS1S == 0)
-  set_pc(pc + insn.rvc_b_imm());
+if (rv_eq(RVC_RS1S, 0))
+  set_pc(rv_add(pc, insn.rvc_b_imm()));
index 1e40ea78e19fc05b6edc74baf09ed2e8f525c321..300de43c6c451dfc6d10ed0f90d7d8a93c004005 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
-if (RVC_RS1S != 0)
-  set_pc(pc + insn.rvc_b_imm());
+if (rv_ne(RVC_RS1S, 0))
+  set_pc(rv_add(pc, insn.rvc_b_imm()));
index 319615b8e4303bf952cd0306a526f8d7fa68f5cd..273e8c1d04c0cdf5c224d3f1b174c85d31c3b56b 100644 (file)
@@ -1,4 +1,4 @@
 require_extension('C');
 require_extension('D');
 require_fp;
-WRITE_RVC_FRS2S(f64(MMU.load_uint64(RVC_RS1S + insn.rvc_ld_imm())));
+WRITE_RVC_FRS2S(f64(MMU.load_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()))));
index 534eef7d2877967ca9963a5eb67dace673073435..7d5598054395cb209d65781e63bc018f7bdd4813 100644 (file)
@@ -1,4 +1,4 @@
 require_extension('C');
 require_extension('D');
 require_fp;
-WRITE_FRD(f64(MMU.load_uint64(RVC_SP + insn.rvc_ldsp_imm())));
+WRITE_FRD(f64(MMU.load_uint64(rv_add(RVC_SP, insn.rvc_ldsp_imm()))));
index 682566c705b764366f4681b6eff3dd85a2c27efa..efe1c867e6c6460b34dcb1fc18238dd486ff8f16 100644 (file)
@@ -2,7 +2,7 @@ require_extension('C');
 if (xlen == 32) {
   require_extension('F');
   require_fp;
-  WRITE_RVC_FRS2S(f32(MMU.load_uint32(RVC_RS1S + insn.rvc_lw_imm())));
+  WRITE_RVC_FRS2S(f32(MMU.load_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()))));
 } else { // c.ld
-  WRITE_RVC_RS2S(MMU.load_int64(RVC_RS1S + insn.rvc_ld_imm()));
+  WRITE_RVC_RS2S(MMU.load_int64(rv_add(RVC_RS1S, insn.rvc_ld_imm())));
 }
index 79058c40a37d7b971640fc9877dc4be9ee91303b..22222d209b8c68d0a26aa86c31507c862445f00d 100644 (file)
@@ -2,8 +2,8 @@ require_extension('C');
 if (xlen == 32) {
   require_extension('F');
   require_fp;
-  WRITE_FRD(f32(MMU.load_uint32(RVC_SP + insn.rvc_lwsp_imm())));
+  WRITE_FRD(f32(MMU.load_uint32(rv_add(RVC_SP, insn.rvc_lwsp_imm()))));
 } else { // c.ldsp
   require(insn.rvc_rd() != 0);
-  WRITE_RD(MMU.load_int64(RVC_SP + insn.rvc_ldsp_imm()));
+  WRITE_RD(MMU.load_int64(rv_add(RVC_SP, insn.rvc_ldsp_imm())));
 }
index 6f2c8f4c3ac1743a40d94598eb1a8b49f969893e..3b8e040809555656fe62b6ed2d3ecf45898c0274 100644 (file)
@@ -1,4 +1,4 @@
 require_extension('C');
 require_extension('D');
 require_fp;
-MMU.store_uint64(RVC_RS1S + insn.rvc_ld_imm(), RVC_FRS2S.v[0]);
+MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_FRS2S.v[0]);
index 27b933191930f3fc8413cfb0668139de7e946b7b..1a4d50c3b3989391dff11394c8ec090acc24b141 100644 (file)
@@ -1,4 +1,4 @@
 require_extension('C');
 require_extension('D');
 require_fp;
-MMU.store_uint64(RVC_SP + insn.rvc_sdsp_imm(), RVC_FRS2.v[0]);
+MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_FRS2.v[0]);
index 70858229652189553e792b82a5a2178570107145..e400d727cfaf0eb3339c534ba439aeebeeb7b35a 100644 (file)
@@ -2,7 +2,7 @@ require_extension('C');
 if (xlen == 32) {
   require_extension('F');
   require_fp;
-  MMU.store_uint32(RVC_RS1S + insn.rvc_lw_imm(), RVC_FRS2S.v[0]);
+  MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), RVC_FRS2S.v[0]);
 } else { // c.sd
-  MMU.store_uint64(RVC_RS1S + insn.rvc_ld_imm(), RVC_RS2S);
+  MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_RS2S);
 }
index c5a003fcd1f057df93f407747173772f3ab7a4df..cbf92641054ef7fa3e53de7a2e977189d4eec6da 100644 (file)
@@ -2,7 +2,7 @@ require_extension('C');
 if (xlen == 32) {
   require_extension('F');
   require_fp;
-  MMU.store_uint32(RVC_SP + insn.rvc_swsp_imm(), RVC_FRS2.v[0]);
+  MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), RVC_FRS2.v[0]);
 } else { // c.sdsp
-  MMU.store_uint64(RVC_SP + insn.rvc_sdsp_imm(), RVC_RS2);
+  MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_RS2);
 }
index ef49dd90904f1608b9a5320cb8ccd17228020ee1..d08bab56c1d880e493b167f2cc7dcb410548fdb2 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS2S(MMU.load_int32(RVC_RS1S + insn.rvc_lw_imm()));
+WRITE_RVC_RS2S(MMU.load_int32(rv_add(RVC_RS1S, insn.rvc_lw_imm())));
index b3d74dbf087fb09553ca438bf4c44629ecfdc032..b0f2549a9799711e1fadf05f4a0cc35f01d38774 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_rd() != 0);
-WRITE_RD(MMU.load_int32(RVC_SP + insn.rvc_lwsp_imm()));
+WRITE_RD(MMU.load_int32(rv_add(RVC_SP, insn.rvc_lwsp_imm())));
index 56436d1a18739fc418d373d771b2542e28b03d4f..7a888a1ef4928ab4696764b5029085bdc996ef51 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S | RVC_RS2S);
+WRITE_RVC_RS1S(rv_or(RVC_RS1S, RVC_RS2S));
index 24fbb1335be3060dd7b9b1d2c2dd96a1585608ba..91fff82100bf55f85ca265646aa96fe5ebef69ed 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_zimm() < xlen);
-WRITE_RD(sext_xlen(RVC_RS1 << insn.rvc_zimm()));
+WRITE_RD(sext_xlen(rv_sl(RVC_RS1, insn.rvc_zimm())));
index f6638b1e2747c7bc2ec8bb268230658ff4f77052..171375d6a91ee788b3aba98f60a051b5bc4b38cf 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_zimm() < xlen);
-WRITE_RVC_RS1S(sext_xlen(sext_xlen(RVC_RS1S) >> insn.rvc_zimm()));
+WRITE_RVC_RS1S(sext_xlen(rv_sr(sext_xlen(RVC_RS1S), insn.rvc_zimm())));
index f410fefda56322c0aa7d4d39caa2d5af3c75fbee..904dbf16f97019882fb4f042b9ac8ca09e6aed5f 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require(insn.rvc_zimm() < xlen);
-WRITE_RVC_RS1S(sext_xlen(zext_xlen(RVC_RS1S) >> insn.rvc_zimm()));
+WRITE_RVC_RS1S(sext_xlen(rv_sr(zext_xlen(RVC_RS1S), insn.rvc_zimm())));
index 1b8e3735c60ad1174f88adb091a47fd285b90e74..e6ed2af7b98fdbdaa7bbf7efed65c9465223f6c4 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS1S(sext_xlen(RVC_RS1S - RVC_RS2S));
+WRITE_RVC_RS1S(sext_xlen(rv_sub(RVC_RS1S, RVC_RS2S)));
index 580f5b54e402e8a4b782b262e3b268e88fe95fda..e777ae27a31d519be9c751f71c418a852633aae7 100644 (file)
@@ -1,3 +1,3 @@
 require_extension('C');
 require_rv64;
-WRITE_RVC_RS1S(sext32(RVC_RS1S - RVC_RS2S));
+WRITE_RVC_RS1S(sext32(rv_sub(RVC_RS1S, RVC_RS2S)));
index 3073e9d623dcb98265b2c1d1d3c59f51530ab386..098b4b423254eba22273c3c31f70ece18d140a39 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-MMU.store_uint32(RVC_RS1S + insn.rvc_lw_imm(), RVC_RS2S);
+MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), RVC_RS2S);
index b8995ab05fd0596626e8c6a5d1770fc45cbd67d9..57b17351f5c6d31e45829fb12f22e0c49f8ea0d7 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-MMU.store_uint32(RVC_SP + insn.rvc_swsp_imm(), RVC_RS2);
+MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), RVC_RS2);
index 9981c1af90ee35fc603e9f4ce363bf0ec3744162..6039f87aecca6cc8bc3b229a6c1a1aeebca4432d 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S ^ RVC_RS2S);
+WRITE_RVC_RS1S(rv_xor(RVC_RS1S, RVC_RS2S));