简体   繁体   中英

armv8 RRX register usage

In one of my homework exercises, I'm asked to write an armv8 program that counts number of 1-bits in a register. Here's my implementation:

    .arch armv8-a   // specifies the ARMv8 Architecture
    .text
    .align  2       // align to a multiple of 4 (1<<2)
    .global start   // arm64_emu.sh starts execution at start
    .type   start, %function
start:
    movz    x0,  #8    
    movz    x10, #0
    movz    x1,  #0
loop:
    rrx     x0,  x0 //rotate x0 and put the last bit into carry
    bcs     skip
    add     x10, x10, 1
skip:
    cmp     x1,  #3
    bne     loop           
    svc     0          // dump registers
    svc     999        // stop the emulation
    .size   start, .-start

A nice flow chart from this site gives a good overview of my program: http://www.8085projects.info/Program21.html

However, it gives me this error:

zl5022@enterprise:~$ arm64_emu.sh c.s
c.s: Assembler messages:
c.s:11: Error: unknown mnemonic `rrx' -- `rrx x0,x0'

According to http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjacbgca.html , rrx takes two registers as input, so am I missing something here?

The ARMv8 rotate instruction is ROR.

ROR Xd, Xm, #uimm
Rotate Right (immediate, 64-bit)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM