add op.properties to repr tests
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 1 Nov 2022 01:03:01 +0000 (18:03 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 1 Nov 2022 01:03:01 +0000 (18:03 -0700)
src/bigint_presentation_code/_tests/test_compiler_ir2.py

index eecca1015b9722363d2ccbbc9f6130948fc5194c..74c38e90e5fc0339455c482e37be2a5a904fd6d2 100644 (file)
@@ -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=<I64>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None),), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<CA>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.CA: FBitSet([0])}), ty=<CA>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.CA: FBitSet([0])}), ty=<CA>), "
+            "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=<I64*32>), "
+            "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=<I64>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "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=<I64>), "
+            "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=<I64>), "
+            "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=<I64>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64>), "
+            "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=<I64>), "
+            "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=<I64>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None),), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "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=<CA>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.CA: FBitSet([0])}), ty=<CA>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.CA: FBitSet([0])}), ty=<CA>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "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=<VL_MAXVL>), "
+            "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=<I64*32>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=("
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.GPR: FBitSet(range(14, 97))}), ty=<I64*32>), "
+            "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=<I64>), "
+            "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=<I64>), "
+            "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=<I64*32>), "
+            "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=<I64>), "
+            "tied_input_index=None, spread_index=None), "
+            "OperandDesc(loc_set_before_spread=LocSet(starts=FMap({"
+            "LocKind.VL_MAXVL: FBitSet([0])}), ty=<VL_MAXVL>), "
+            "tied_input_index=None, spread_index=None)), "
+            "outputs=(), maxvl=32)",
+        ])
 
     def test_sim(self):
         fn, arg = self.make_add_fn()