summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgentests.py41
-rw-r--r--testcases.txt17
2 files changed, 43 insertions, 15 deletions
diff --git a/gentests.py b/gentests.py
index edfb55b..000f73e 100755
--- a/gentests.py
+++ b/gentests.py
@@ -72,6 +72,16 @@ class Program(object):
def get_dreg(self):
return Register('d', self.avail_dregs.pop())
+class Dummy(object):
+ def __str__(self):
+ return ''
+ def write_init(self, outfile, size, already):
+ pass
+ def consume_regs(self, program):
+ pass
+
+dummy_op = Dummy()
+
class Register(object):
def __init__(self, kind, num):
self.kind = kind
@@ -441,30 +451,47 @@ class Inst2Op(object):
self.src.consume_regs(program)
self.dst.consume_regs(program)
+class Inst1Op(Inst2Op):
+ def __init__(self, name, size, dst):
+ super(Inst1Op, self).__init__(name, size, dummy_op, dst)
+
+ def __str__(self):
+ return self.name + '.' + self.size + ' ' + str(self.dst)
+
class Entry(object):
def __init__(self, line):
fields = split_fields(line)
self.name = fields[0]
sizes = fields[1]
sources = fields[2].split(';')
- dests = fields[3].split(';')
+ if len(fields) > 3:
+ dests = fields[3].split(';')
+ else:
+ dests = None
combos = []
for size in sizes:
for source in sources:
if size != 'b' or source != 'a':
- for dest in dests:
- if size != 'b' or dest != 'a':
- combos.append((size, source, dest))
+ if dests:
+ for dest in dests:
+ if size != 'b' or dest != 'a':
+ combos.append((size, source, dest))
+ else:
+ combos.append((size, None, source))
self.cases = combos
def programs(self):
res = []
for (size, src, dst) in self.cases:
- sources = get_variations(src, size)
dests = get_variations(dst, size)
- for source in sources:
+ if src:
+ sources = get_variations(src, size)
+ for source in sources:
+ for dest in dests:
+ res.append(Program(Inst2Op(self.name, size, source, dest)))
+ else:
for dest in dests:
- res.append(Program(Inst2Op(self.name, size, source, dest)))
+ res.append(Program(Inst1Op(self.name, size, dest)))
return res
def process_entries(f):
diff --git a/testcases.txt b/testcases.txt
index b9b92fd..bf988de 100644
--- a/testcases.txt
+++ b/testcases.txt
@@ -48,12 +48,13 @@ Name Sizes Src Modes Dst Modes
#cmpa wl d;a;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) a
#cmpi bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
#cmpm bwl (a)+ (a)+
-eor bwl d d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
-eori bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
-exg l d d;a
-exg l a a
-link w a #n
-or bwl d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
-or bwl d (a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
-ori bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+#eor bwl d d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+#eori bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+#exg l d d;a
+#exg l a a
+#link w a #n
+#or bwl d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l;#n;(n,pc);(n,pc,x) d
+#or bwl d (a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+#ori bwl #n d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l
+clr bwl d;(a);(a)+;-(a);(n,a);(n,a,x);(n).w;(n).l