ARM: Implement the VFP version of vneg.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:14 +0000 (12:58 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 2 Jun 2010 17:58:14 +0000 (12:58 -0500)
src/arch/arm/isa/formats/fp.isa
src/arch/arm/isa/insts/fp.isa

index 2222b1e62f06524a7af58e3d06850d90904a41d8..080174318b0be9199cea886418a6e023d1ccb34e 100644 (file)
@@ -558,7 +558,21 @@ let {{
                 }
               case 0x1:
                 if (opc3 == 1) {
-                    return new WarnUnimplemented("vneg", machInst);
+                    uint32_t vd;
+                    uint32_t vm;
+                    if (bits(machInst, 8) == 0) {
+                        vd = bits(machInst, 22) | (bits(machInst, 15, 12) << 1);
+                        vm = bits(machInst, 5) | (bits(machInst, 3, 0) << 1);
+                        return new VnegS(machInst,
+                                (IntRegIndex)vd, (IntRegIndex)vm);
+                    } else {
+                        vd = (bits(machInst, 22) << 5) |
+                             (bits(machInst, 15, 12) << 1);
+                        vm = (bits(machInst, 5) << 5) |
+                             (bits(machInst, 3, 0) << 1);
+                        return new VnegD(machInst,
+                                (IntRegIndex)vd, (IntRegIndex)vm);
+                    }
                 } else {
                     return new WarnUnimplemented("vsqrt", machInst);
                 }
index ef79ea420f97f77fa6f0946cd9fc723e1690d45b..bffdde235a45a6b5bb8398b0c10b0e60b6c5bd84 100644 (file)
@@ -258,4 +258,28 @@ let {{
     header_output += RegRegRegOpDeclare.subst(vmulDIop);
     decoder_output += RegRegRegOpConstructor.subst(vmulDIop);
     exec_output += PredOpExecute.subst(vmulDIop);
+
+    vnegSCode = '''
+        FpDest = -FpOp1;
+    '''
+    vnegSIop = InstObjParams("vnegs", "VnegS", "RegRegOp",
+                                     { "code": vnegSCode,
+                                       "predicate_test": predicateTest }, [])
+    header_output += RegRegOpDeclare.subst(vnegSIop);
+    decoder_output += RegRegOpConstructor.subst(vnegSIop);
+    exec_output += PredOpExecute.subst(vnegSIop);
+
+    vnegDCode = '''
+        IntDoubleUnion cOp1, cDest;
+        cOp1.bits = ((uint64_t)FpOp1P0.uw | ((uint64_t)FpOp1P1.uw << 32));
+        cDest.fp = -cOp1.fp;
+        FpDestP0.uw = cDest.bits;
+        FpDestP1.uw = cDest.bits >> 32;
+    '''
+    vnegDIop = InstObjParams("vnegd", "VnegD", "RegRegOp",
+                                     { "code": vnegDCode,
+                                       "predicate_test": predicateTest }, [])
+    header_output += RegRegOpDeclare.subst(vnegDIop);
+    decoder_output += RegRegOpConstructor.subst(vnegDIop);
+    exec_output += PredOpExecute.subst(vnegDIop);
 }};