0

在我的一个作业练习中,我被要求编写一个计算寄存器中 1 位数量的 armv8 程序。这是我的实现:

    .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

这个网站的一个很好的流程图很好地概述了我的程序:http ://www.8085projects.info/Program21.html

但是,它给了我这个错误:

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

根据http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjacbgca.html, rrx 需要两个寄存器作为输入,所以我在这里遗漏了什么吗?

4

1 回答 1

2

ARMv8 循环指令是 ROR。

ROR Xd, Xm, #uimm
Rotate Right (immediate, 64-bit)
于 2020-11-11T22:44:27.103 回答