简体   繁体   English

armv8 RRX 寄存器使用

[英]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.在我的一个家庭作业练习中,我被要求编写一个 armv8 程序来计算寄存器中 1 位的数量。 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这个站点的一个不错的流程图很好地概述了我的程序: 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?根据http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204j/Cjacbgca.html , rrx 将两个寄存器作为输入,所以我在这里遗漏了什么?

The ARMv8 rotate instruction is ROR. ARMv8 循环指令是 ROR。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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