Skip to content

Reenable X25519 selftest and use .equ instead of define#380

Draft
mkannwischer wants to merge 9 commits into
mainfrom
x25519-selftest
Draft

Reenable X25519 selftest and use .equ instead of define#380
mkannwischer wants to merge 9 commits into
mainfrom
x25519-selftest

Conversation

@mkannwischer
Copy link
Copy Markdown
Collaborator

mkannwischer and others added 9 commits December 17, 2025 11:07
LLVM-MC fails to assemble
ldr x24, #=121666
while GAS assembles this without complaints.

LLVM seems to be right - the correct syntax for literal pool loads is
ldr x255, =121666.
This commit fixes the wrong syntax in all places in slothy.

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
SLOTHY accepts literals as #=1234 and =1234 just like GAS, and unlike LLVM
which only accepts the proper =1234.
However, SLOTHY before incorrectly always outputs #=1234 which breaks if you
want to assembly it using LLVM (or if you are in a multi-step optimization
and run SLOTHY on the output again).
This commit fixes SLOTHY by separating the parsing and writing of immediates
and literals.

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
* Introduces register aliases for dform registers into the clean source.
For the selftest to properly detect which registers are used as addresses,
the model needs to set the addr property. This was missing for 3 instructions:

1) ld2 { <Va>.<dt>, <Vb>.<dt> }[<index>], [<Xa>], <imm>"
2) ldr <Wd>, [<Xa>, <Wb>, SXTW <imm>]
3) ld1r {<Va>.<dt>}, [<Xa>], <imm>

This commit fixes that and also adds a unit test for all memory operations
(some currently can't be tested as they are not supported by the A55 model).

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
I noticed that our equ parsing cannot handle underscores and spaces well.
This commit fixes that and adds a test.

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
SLOTHY cannot understand constants defined as preprocessor macros and,
hence, the selftest fails on X25519 as the stack offsets are not defined.
This commit fixes that using equ instead of define.

- Resolves #358

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
@mkannwischer
Copy link
Copy Markdown
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Several Problems when running tutorial-7.py

2 participants