AArch64: fix Rt operand of the integer STLUR forms - #3046
Merged
Conversation
2 tasks
STLURB, STLURH and the two STLUR integer forms were generated with CS_OP_MEM set on their Rt data operand and CS_AC_WRITE for its access. Both are wrong: Rt is a plain source register, exactly as in the STUR forms these mirror. The stray CS_OP_MEM made the mapping fold Rt into the memory operand, so the data register became mem.base, the real base became mem.index, and the displacement started a second MEM operand -- leaving the instruction with no register operand at all: stlur x10, [x8, capstone-engine#8] op_count: 2 operands[0].type: MEM base: x10 index: x8 access: WRITE operands[1].type: MEM disp: 0x8 access: WRITE against STUR's correct stur x10, [x8, capstone-engine#8] op_count: 2 operands[0].type: REG = x10 access: READ operands[1].type: MEM base: x8 disp: 0x8 access: WRITE A consumer walking the operand list therefore saw neither the value being stored nor the address it is stored to. cs_regs_access() happened to report both registers, which is why this survived: only the operand view was broken. The five SIMD&FP STLUR forms (STLURbi/di/hi/qi/si) were already correct and are untouched; LDAPUR, the load half, was correct too. Adds the correction to suite/auto-sync/inc_patches so it survives regeneration, and regression cases for all four fixed forms plus one SIMD&FP form as the unchanged control.
gaul
force-pushed
the
aarch64-stlur-operand-mapping
branch
from
August 28, 2026 15:43
2b38fa3 to
e260d4f
Compare
Rot127
approved these changes
Aug 31, 2026
Rot127
left a comment
Collaborator
There was a problem hiding this comment.
Thanks!
Here you can keep the patch file.
Couldn't see an easy fix in our LLVM branch. So need to debug later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
Detailed description
STLURB, STLURH and the two STLUR integer forms were generated with CS_OP_MEM set on their Rt data operand and CS_AC_WRITE for its access. Both are wrong: Rt is a plain source register, exactly as in the STUR forms these mirror.
The stray CS_OP_MEM made the mapping fold Rt into the memory operand, so the data register became mem.base, the real base became mem.index, and the displacement started a second MEM operand -- leaving the instruction with no register operand at all:
against STUR's correct
A consumer walking the operand list therefore saw neither the value being stored nor the address it is stored to. cs_regs_access() happened to report both registers, which is why this survived: only the operand view was broken.
The five SIMD&FP STLUR forms (STLURbi/di/hi/qi/si) were already correct and are untouched; LDAPUR, the load half, was correct too.
Test plan
Adds the correction to suite/auto-sync/inc_patches so it survives regeneration, and regression cases for all four fixed forms plus one SIMD&FP form as the unchanged control.
Closing issues