将此ARM64程序集转换为Python?

2024-04-16 13:56:03 发布

您现在位置:Python中文网/ 问答频道 /正文

假设X6是数组“A”的基址

假设X7是数组“B”的基址

F,G,H,I分别=X0,X1,X2,X3,X4

这个AArch64组件到底在做什么?你知道吗

使用上述变量的python代码表示将是惊人的:)

ADD  X9,  X6, #8     // I understand this is X9 = A + 8, not sure what the value of the array would be here

ADD  X10, X7, #16    // Same idea

STUR X1, [X6, #0]    // I believe this "Stores" the value at X1 into A[0]?

LDUR X8,  [X10,#0]   // This "stores" the value at ?X10[0]? into X8?

LDUR X5,  [X9, #0]   // This "stores" the value at ?X9[0]? into X5?

ADD  X0,  X8, X5     // F = X8 + X5

我在LDUR阶段迷路了,X5和X8到底是什么


Tags: theaddvalue数组atx1x10into
1条回答
网友
1楼 · 发布于 2024-04-16 13:56:03

ADD X9, X6, #8

I understand this is X9 = A + 8, not sure what the value of the array would be here

正确。正如问题描述所说,X6的值只是数组的基址。你知道吗

STUR X1, [X6, #0]

I believe this "Stores" the value at X1 into A[0]?

正确。X1在问题描述中被定义为变量G。那就是A[0] = G;

LDUR X8, [X10,#0]

This "stores" the value at ?X10[0]? into X8?

正确,但将数据从内存移到寄存器中称为加载。因此指令名(LD=load)。还要记住,X10被设置为X7+16X7是数组B。此外,LDUR使用字节索引,因此16表示16字节。假设B是一个包含64位数字的数组,每个项目8字节,那么16字节就是2个项目。所有这些归结为X8 = B[2];。你知道吗

LDUR X5, [X9, #0]

根据相同的逻辑,这是X5 = A[1];,所以最终结果是F = B[2] + A[1];。你知道吗

相关问题 更多 >