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

index 276310dd2ba59b865548084c2c06139c2d0ee65c..015f93805d69f30f5eef82257fb34d8eeb7a176a 100644 (file)
@@ -369,4 +369,22 @@ let {{
     header_output += RegRegRegImmOpDeclare.subst(uxtahIop)
     decoder_output += RegRegRegImmOpConstructor.subst(uxtahIop)
     exec_output += PredOpExecute.subst(uxtahIop)
+
+    selCode = '''
+        uint32_t resTemp = 0;
+        for (unsigned i = 0; i < 4; i++) {
+            int low = i * 8;
+            int high = low + 7;
+            replaceBits(resTemp, high, low,
+                        bits(CondCodes, 16 + i) ?
+                            bits(Op1, high, low) : bits(Op2, high, low));
+        }
+        Dest = resTemp;
+    '''
+    selIop = InstObjParams("sel", "Sel", "RegRegRegOp",
+                           { "code": selCode,
+                             "predicate_test": predicateTest }, [])
+    header_output += RegRegRegOpDeclare.subst(selIop)
+    decoder_output += RegRegRegOpConstructor.subst(selIop)
+    exec_output += PredOpExecute.subst(selIop)
 }};