From e3ebeaafbc0fc1864f05746c49c1b6b98b3e12ad Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 14 Sep 2022 08:35:03 -0700 Subject: [PATCH] add svp64 fptrans tests --- .../decoder/isa/test_caller_svp64_fptrans.py | 22 ++ src/openpower/test/fptrans/fptrans_cases.py | 284 ++++++++++++++++++ 2 files changed, 306 insertions(+) create mode 100644 src/openpower/decoder/isa/test_caller_svp64_fptrans.py diff --git a/src/openpower/decoder/isa/test_caller_svp64_fptrans.py b/src/openpower/decoder/isa/test_caller_svp64_fptrans.py new file mode 100644 index 00000000..c8529897 --- /dev/null +++ b/src/openpower/decoder/isa/test_caller_svp64_fptrans.py @@ -0,0 +1,22 @@ +""" svp64 fptrans tests +""" + +import unittest +from openpower.test.runner import TestRunnerBase +from openpower.test.fptrans.fptrans_cases import SVP64FPTransCases + +# writing the test_caller invocation this way makes it work with pytest + + +class TestSVP64FPTrans(TestRunnerBase): + def __init__(self, test): + assert test == 'test' + super().__init__(SVP64FPTransCases().test_data, fp=True) + + def test(self): + # dummy function to make unittest try to test this class + pass + + +if __name__ == "__main__": + unittest.main() diff --git a/src/openpower/test/fptrans/fptrans_cases.py b/src/openpower/test/fptrans/fptrans_cases.py index 0d05876c..f7e83bfe 100644 --- a/src/openpower/test/fptrans/fptrans_cases.py +++ b/src/openpower/test/fptrans/fptrans_cases.py @@ -2,6 +2,8 @@ from openpower.test.common import TestAccumulatorBase from openpower.sv.trans.svp64 import SVP64Asm from openpower.test.state import ExpectedState from openpower.simulator.program import Program +from openpower.decoder.isa.caller import SVP64State +import struct # FIXME: output values are just what my computer produces for the current @@ -2312,3 +2314,285 @@ class FPTransCases(TestAccumulatorBase): e.fpregs[3] = 0x0 e.crregs[1] = 0x2 self.add_case(Program(lst, False), gprs, fpregs=fprs, expected=e) + + +class SVP64FPTransCases(TestAccumulatorBase): + def case_sv_fatan2pi(self): + lst = list(SVP64Asm(["sv.fatan2pi *32,*64,*96"])) + gprs = [0] * 128 + fprs = [0] * 128 + svstate = SVP64State() + svstate.vl = 32 + svstate.maxvl = 32 + r = range(svstate.vl) + for i, rev_i in zip(r, reversed(r)): + fprs[64 + i] = struct.unpack("