Skip to content

Commit ae437c5

Browse files
committed
AArch64: add support for enforce all .<dt*> specifiers are equal during parsing.
- This commit enforcing that all <dt*> are equal during parsing. - Here is an example: - For src: "smlsl <Vd>.<dt0>, <Va>.<dt1>, <Vb>.<dt1> - When parsing: - smlsl v6.4s, v7.4h, v8.4h -> Passed, - smlsl v6.4s, v7.4h, v8.4s -> Failed, return "Inconsistent datatype for <dt1>: 4h vs 4s" Signed-off-by: willieyz <willie.zhao@chelpis.com>
1 parent 1ef212e commit ae437c5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

slothy/targets/aarch64/aarch64_neon.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,29 @@ def _parse(line):
917917
raise Instruction.ParsingException(
918918
f"Does not match instruction pattern {src}" f"[regex: {regexp_txt}]"
919919
)
920+
# Enforcing that all <dt*> are equal during parsing.
921+
# Here is an example:
922+
# For src: "smlsl <Vd>.<dt0>, <Va>.<dt1>, <Vb>.<dt1>""
923+
# When parsing:
924+
# smlsl v6.4s, v7.4h, v8.4h -> Passed
925+
# smlsl v6.4s, v7.4h, v8.4s -> Failed, return "Inconsistent datatype for <dt1>: 4h vs 4s"
926+
datatypes = {}
927+
928+
for s_op, l_op in zip(src.split(","), line.split(",")):
929+
930+
if "." in s_op.strip() and "." in l_op.strip():
931+
dt_name = s_op.split(".", 1)[1]
932+
dt_value = l_op.split(".", 1)[1]
933+
934+
if dt_name in datatypes:
935+
if datatypes[dt_name] != dt_value:
936+
raise Instruction.ParsingException(
937+
f"Inconsistent datatype for {dt_name}: "
938+
f"{datatypes[dt_name]} vs {dt_value}"
939+
)
940+
else:
941+
datatypes[dt_name] = dt_value
942+
920943
res = regexp.match(line).groupdict()
921944
items = list(res.items())
922945
for k, v in items:

0 commit comments

Comments
 (0)