auditor

An aarch64 constant-time memory access auditing tool.
git clone git://git.ppad.tech/auditor.git
Log | Files | Refs | README | LICENSE

commit 78036c8e31d5d3df731c3050ec8413673400c37b
parent 353732bf0225db2e4289c805f584dd3e7ec64c2f
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 17 May 2026 21:06:56 -0230

test: add regression for shifted-immediate operand

Covers the case `cmp x8, #16, lsl #12` that motivated the
pImmShifted parser. Asserts the trailing shift is folded into the
literal (16 << 12 = 65536), giving `Cmp X8 (OpImm 65536)`.

Diffstat:
Mtest/Main.hs | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/test/Main.hs b/test/Main.hs @@ -129,6 +129,20 @@ parserTests = testGroup "Parser" [ other -> assertFailure $ "unexpected: " ++ show other + , testCase "parse shifted immediate operand" $ do + -- regression: `cmp x8, #16, lsl #12` is the uimm12 + -- shifted-immediate form (16 << 12 = 65536). The + -- parser must fold the shift into the literal. + let src = "cmp x8, #16, lsl #12\n" + case parseAsm src of + Left e -> assertFailure $ + "parse failed: " ++ show e + Right lns -> + case lineInstr (safeHead lns) of + Just (Cmp X8 (OpImm 65536)) -> pure () + other -> assertFailure $ + "unexpected: " ++ show other + , testCase "parse plain register operand" $ do let src = "add x0, x1, x2\n" case parseAsm src of