add fsubs unit test
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 23 Sep 2021 13:59:52 +0000 (14:59 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 23 Sep 2021 13:59:52 +0000 (14:59 +0100)
src/openpower/decoder/isa/test_caller_fp.py

index 615ff5d5efda3b685487d3d603a2017b4d3bdbaf..6dc4fd904fbf85aa3221eab632164ed4c87abe76 100644 (file)
@@ -176,6 +176,23 @@ class DecoderTestCase(FHDLTestCase):
             self.assertEqual(sim.fpr(2), SelectableInt(0x4040266660000000, 64))
             self.assertEqual(sim.fpr(3), SelectableInt(0, 64))
 
+    def test_fp_subs(self):
+        """>>> lst = ["fsubs 3, 1, 2",
+                     ]
+        """
+        lst = ["fsubs 3, 1, 2", # 0 - -32.3 = 32.3
+                     ]
+
+        fprs = [0] * 32
+        fprs[1] = 0x0
+        fprs[2] = 0xC040266660000000
+
+        with Program(lst, bigendian=False) as program:
+            sim = self.run_tst_program(program, initial_fprs=fprs)
+            self.assertEqual(sim.fpr(1), SelectableInt(0x0, 64))
+            self.assertEqual(sim.fpr(2), SelectableInt(0xC040266660000000, 64))
+            self.assertEqual(sim.fpr(3), SelectableInt(0x4040266660000000, 64))
+
     def test_fp_add(self):
         """>>> lst = ["fadd 3, 1, 2",
                      ]