Revert "[xcc, sim] added slei/sleui in lieu of slti/sltiu"
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>
Fri, 10 Sep 2010 00:50:10 +0000 (17:50 -0700)
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>
Fri, 10 Sep 2010 00:50:10 +0000 (17:50 -0700)
This reverts commit bf5406d4df625678bc6ec20ce1d48541541dba54.

We found a clever way to efficiently implement slti/sltiu despite the
reversed operands.  The trick is because of the following fact:

(a < b) === !(b <= a) === !(b-1 < a)

So just turn off the carry-in when doing the subtraction for the comparison.

riscv/execute.h
riscv/insns/slei.h [deleted file]
riscv/insns/sleiu.h [deleted file]
riscv/insns/slti.h [new file with mode: 0644]
riscv/insns/sltiu.h [new file with mode: 0644]

index 69bdeb05e042c1e483152e2b8b6347a1ca5e83ed..15f90efcd67800172974b9c9d62e1c7c11fe845d 100644 (file)
@@ -480,12 +480,12 @@ switch((insn.bits >> 0x19) & 0x7f)
       }
       case 0x2:
       {
-        #include "insns/slei.h"
+        #include "insns/slti.h"
         break;
       }
       case 0x3:
       {
-        #include "insns/sleiu.h"
+        #include "insns/sltiu.h"
         break;
       }
       case 0x4:
diff --git a/riscv/insns/slei.h b/riscv/insns/slei.h
deleted file mode 100644 (file)
index 2f4fe29..0000000
+++ /dev/null
@@ -1 +0,0 @@
-RA = !(sreg_t(cmp_trunc(SIMM)) < sreg_t(cmp_trunc(RB)));
diff --git a/riscv/insns/sleiu.h b/riscv/insns/sleiu.h
deleted file mode 100644 (file)
index 2519eb4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-RA = !(cmp_trunc(SIMM) < cmp_trunc(RB));
diff --git a/riscv/insns/slti.h b/riscv/insns/slti.h
new file mode 100644 (file)
index 0000000..a5ef31e
--- /dev/null
@@ -0,0 +1 @@
+RA = sreg_t(cmp_trunc(RB)) < sreg_t(cmp_trunc(SIMM));
diff --git a/riscv/insns/sltiu.h b/riscv/insns/sltiu.h
new file mode 100644 (file)
index 0000000..a09f3ec
--- /dev/null
@@ -0,0 +1 @@
+RA = cmp_trunc(RB) < cmp_trunc(SIMM);