From: Jacob Lifshay Date: Tue, 1 Nov 2022 01:03:01 +0000 (-0700) Subject: add op.properties to repr tests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1728deed181351d1031b82ec7acfa847848571bf;p=bigint-presentation-code.git add op.properties to repr tests --- diff --git a/src/bigint_presentation_code/_tests/test_compiler_ir2.py b/src/bigint_presentation_code/_tests/test_compiler_ir2.py index eecca10..74c38e9 100644 --- a/src/bigint_presentation_code/_tests/test_compiler_ir2.py +++ b/src/bigint_presentation_code/_tests/test_compiler_ir2.py @@ -66,6 +66,82 @@ class TestCompilerIR(unittest.TestCase): "immediates=[0], " "outputs=(), name='st')", ]) + self.assertEqual([repr(op.properties) for op in fn.ops], [ + "OpProperties(kind=OpKind.FuncArgR3, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([3])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SvLd, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SvLI, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetCA, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SvAddE, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), maxvl=32)", + "OpProperties(kind=OpKind.SvStd, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(), maxvl=32)", + ]) def test_pre_ra_insert_copies(self): fn, _arg = self.make_add_fn() @@ -161,6 +237,229 @@ class TestCompilerIR(unittest.TestCase): "immediates=[0], " "outputs=(), name='st')", ]) + self.assertEqual([repr(op.properties) for op in fn.ops], [ + "OpProperties(kind=OpKind.FuncArgR3, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([3])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.CopyFromReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None),), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)]), " + "LocKind.StackI64: FBitSet(range(0, 1024))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.CopyToReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)]), " + "LocKind.StackI64: FBitSet(range(0, 1024))}), ty=), " + "tied_input_index=None, spread_index=None),), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SvLd, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyFromReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SvLI, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyFromReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetCA, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyToReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyToReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SvAddE, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.CA: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), maxvl=32)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyFromReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.SetVLI, " + "inputs=(), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.VecCopyToReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97)), " + "LocKind.StackI64: FBitSet(range(0, 993))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None),), maxvl=32)", + "OpProperties(kind=OpKind.CopyToReg, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)]), " + "LocKind.StackI64: FBitSet(range(0, 1024))}), ty=), " + "tied_input_index=None, spread_index=None),), " + "outputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None),), maxvl=1)", + "OpProperties(kind=OpKind.SvStd, " + "inputs=(" + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet(range(14, 97))}), ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.GPR: FBitSet([*range(3, 13), *range(14, 128)])}), " + "ty=), " + "tied_input_index=None, spread_index=None), " + "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({" + "LocKind.VL_MAXVL: FBitSet([0])}), ty=), " + "tied_input_index=None, spread_index=None)), " + "outputs=(), maxvl=32)", + ]) def test_sim(self): fn, arg = self.make_add_fn()