8251885: aarch64: aarch64-asmtest.py script generates unpredictable instructions

Reviewed-by: aph
This commit is contained in:
Dong Bo 2020-08-18 10:20:23 +08:00 committed by Fei Yang
parent 70c0815335
commit f779affda0
2 changed files with 981 additions and 968 deletions

View File

@ -741,6 +741,9 @@ class LoadStoreOp(InstructionWithModes):
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 @@ class LoadStorePairOp(InstructionWithModes):
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"

File diff suppressed because it is too large Load Diff