Skip to content

ArmPattern: bitfield, shift and extend aliases #9

Closed

Description

@scizzydo

All aliases of UBFM/SBFM/BFM (or EXTR) with computed immr/imms; wildcards today.

  • LSL/LSR/ASR Rd, Rn, #imm (LSL #n = UBFM immr = -n mod size, imms = size-1-n) and ROR #imm (EXTR)
  • Register shifts LSL/LSR/ASR/ROR Rd, Rn, Rm (LSLV etc.)
  • UBFX/SBFX/UBFIZ/SBFIZ/BFI/BFXIL
  • SXTB/SXTH/SXTW/UXTB/UXTH

#? should leave immr/imms open (LSL Rd, Rn, #? can't pin either field). Like MOV, encode them the way assemblers do and check against clang in tests/test_arm.cpp.

🤖 Generated with Claude Code

Activity

  1. scizzydo commented on Oct 12, 2026

    @scizzydo
    OwnerAuthor

    Addressed in #12 (parse_bitfield<kind>, parse_shift):

    • LSL/LSR/ASR #imm (UBFM/SBFM) and ROR #imm (EXTR Rd, Rn, Rn); the register forms LSL/LSR/ASR/ROR Rd, Rn, Rm and LSLV etc.
    • UBFX/SBFX/BFXIL/UBFIZ/SBFIZ/BFI, raw UBFM/SBFM/BFM/EXTR, and SXTB/SXTH/SXTW/UXTB/UXTH.
    • Wildcards: LSR/ASR #? keep imms pinned (exact); LSL #? has to open immr and imms, so it also matches other UBFM forms (documented). A field computed from a ? is left open (UBFX #?, #8 leaves imms open). With a bare ? register, the 32- and 64-bit encodings are both computed and only the bits they share stay pinned; if only one size fits (LSL ?, ?, #40), that one is used.
    • Out-of-range immediates, SXTW W0, W1 and UXTB X0, W1 give mask 0. All encodings were checked against clang.

    🤖 Generated with Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions