• Ard Biesheuvel's avatar
    arm64: assembler: introduce wxN aliases for wN registers · 4c4dcd35
    Ard Biesheuvel authored
    
    
    The AArch64 asm syntax has this slightly tedious property that the names
    used in mnemonics to refer to registers depend on whether the opcode in
    question targets the entire 64-bits (xN), or only the least significant
    8, 16 or 32 bits (wN). When writing parameterized code such as macros,
    this can be annoying, as macro arguments don't lend themselves to
    indexed lookups, and so generating a reference to wN in a macro that
    receives xN as an argument is problematic.
    
    For instance, an upcoming patch that modifies the implementation of the
    cond_yield macro to be able to refer to 32-bit registers would need to
    modify invocations such as
    
      cond_yield	3f, x8
    
    to
    
      cond_yield	3f, 8
    
    so that the second argument can be token pasted after x or w to emit the
    correct register reference. Unfortunately, this interferes with the self
    documenting nature of the first example, where the second argument is
    obviously a register, whereas in the second example, one would need to
    go and look at the code to find out what '8' means.
    
    So let's fix this by defining wxN aliases for all xN registers, which
    resolve to the 32-bit alias of each respective 64-bit register. This
    allows the macro implementation to paste the xN reference after a w to
    obtain the correct register name.
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Acked-by: default avatarWill Deacon <will@kernel.org>
    Link: https://lore.kernel.org/r/20210302090118.30666-3-ardb@kernel.org
    
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    4c4dcd35
assembler.h 17.6 KB