aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa/coverage_helper.py
blob: f886264c19bb5f6e59de2da69a82e387da0ba6dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import fileinput

occurs = {}

for line in fileinput.input():
    line_noc = line.replace('\n', '')
    if line_noc not in occurs:
        occurs[line_noc] = 0
    occurs[line_noc] += 1

# HACK: Removing all the instructions with "%a", replacing them with all their variations
# Also removing all instructions starting with '.'
pruned_occurs = dict(occurs)
for inst in occurs:
    if inst[0] == '.':
        del pruned_occurs[inst]
    if "%a" not in inst:
        continue
    inst_no_a = inst.replace(".%a", "")
    if inst_no_a in ("compw", "compd"):
        del pruned_occurs[inst]
        for mod in ("ne", "eq", "lt", "gt", "le", "ge", "ltu", "leu", "geu",
                    "gtu", "all", "any", "nall", "none"):
            pruned_occurs[inst_no_a + "." + mod] = 1
    elif inst_no_a in ("cb"):
        del pruned_occurs[inst]
        for mod in ("wnez", "weqz", "wltz", "wgez", "wlez", "wgtz", "dnez",
                    "dltz", "dgez", "dlez", "dgtz"):
            pruned_occurs[inst_no_a + "." + mod] = 1
    else:
        assert False, "Found instruction with %a: " + inst
occurs = pruned_occurs

for inst in sorted(occurs):
    print inst