ARM: Implement the ssub instructions.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:06 +0000 (12:58 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:06 +0000 (12:58 -0500)
src/arch/arm/isa/insts/data.isa

index 1a42a4ca8426d6463e292450cef51ca712af21b5..206c218e1abb0619b0bae45ef7ddc9e8c75b167a 100644 (file)
@@ -369,8 +369,8 @@ let {{
             for (unsigned i = 0; i < 4; i++) {
                 int high = (i + 1) * 8 - 1;
                 int low = i * 8;
-                int32_t midRes = sext<8>(bits(Op1, high, low)) +
-                                 sext<8>(bits(Op2, high, low));
+                int32_t midRes = sext<8>(bits(Op1.sw, high, low)) +
+                                 sext<8>(bits(Op2.sw, high, low));
                 replaceBits(resTemp, high, low, midRes);
                 if (midRes >= 0) {
                     geBits = geBits | (1 << i);
@@ -385,8 +385,41 @@ let {{
             for (unsigned i = 0; i < 2; i++) {
                 int high = (i + 1) * 16 - 1;
                 int low = i * 16;
-                int32_t midRes = sext<16>(bits(Op1, high, low)) +
-                                 sext<16>(bits(Op2, high, low));
+                int32_t midRes = sext<16>(bits(Op1.sw, high, low)) +
+                                 sext<16>(bits(Op2.sw, high, low));
+                replaceBits(resTemp, high, low, midRes);
+                if (midRes >= 0) {
+                    geBits = geBits | (0x3 << (i * 2));
+                }
+            }
+            Dest = resTemp;
+            resTemp = geBits;
+        ''', flagType="ge", buildNonCc=False)
+
+    buildRegDataInst("ssub8", '''
+            uint32_t geBits = 0;
+            resTemp = 0;
+            for (unsigned i = 0; i < 4; i++) {
+                int high = (i + 1) * 8 - 1;
+                int low = i * 8;
+                int32_t midRes = sext<8>(bits(Op1.sw, high, low)) -
+                                 sext<8>(bits(Op2.sw, high, low));
+                replaceBits(resTemp, high, low, midRes);
+                if (midRes >= 0) {
+                    geBits = geBits | (1 << i);
+                }
+            }
+            Dest = resTemp;
+            resTemp = geBits;
+        ''', flagType="ge", buildNonCc=False)
+    buildRegDataInst("ssub16", '''
+            uint32_t geBits = 0;
+            resTemp = 0;
+            for (unsigned i = 0; i < 2; i++) {
+                int high = (i + 1) * 16 - 1;
+                int low = i * 16;
+                int32_t midRes = sext<16>(bits(Op1.sw, high, low)) -
+                                 sext<16>(bits(Op2.sw, high, low));
                 replaceBits(resTemp, high, low, midRes);
                 if (midRes >= 0) {
                     geBits = geBits | (0x3 << (i * 2));