Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8251885: aarch64: aarch64-asmtest.py script generates unpredictable i…
…nstructions

Reviewed-by: aph
  • Loading branch information
dgbo authored and Fei Yang committed Aug 18, 2020
1 parent 0bf6901 commit 754006d60b0a992ab8bbd9b43e3b5f6ccf3cc10c
Show file tree
Hide file tree
Showing 2 changed files with 981 additions and 968 deletions.
@@ -741,6 +741,9 @@ def generate(self):

regMode = FloatRegister if isFloat else GeneralRegister
self.reg = regMode().generate()
kindStr = Address.kindToStr(self.kind);
if (not isFloat) and (kindStr is "pre" or kindStr is "post"):
(self.reg.number, self.adr.base.number) = random.sample(range(31), 2)
return self

def cstr(self):
@@ -777,6 +780,14 @@ def generate(self):
self.reg = [OperandFactory.create(self.mode).generate()
for i in range(self.numRegs)]
self.base = OperandFactory.create('x').generate()
kindStr = Address.kindToStr(self.kind);
if kindStr is "pre" or kindStr is "post":
if self._name.startswith("ld"):
(self.reg[0].number, self.reg[1].number, self.base.number) = random.sample(range(31), 3)
if self._name.startswith("st"):
self.base.number = random.choice(list(set(range(31)) - set([self.reg[0].number, self.reg[1].number])))
elif self._name.startswith("ld"):
(self.reg[0].number, self.reg[1].number) = random.sample(range(31), 2)
return self

def astr(self):
@@ -972,6 +983,8 @@ def generate(kind, names):

outfile = open("aarch64ops.s", "w")

random.seed(0)

print "// BEGIN Generated code -- do not edit"
print "// Generated by aarch64-asmtest.py"

0 comments on commit 754006d

Please sign in to comment.