0

我有以下 armv8-a 代码,但出现汇编错误。我无法找出错误

#include <stdio.h>
#include <arm_neon.h>

void main()
{
char a = 10, b = 10, c = 10, d = 10;
uint8_t *source = (uint8_t*) malloc(sizeof(uint8_t)*40)
for(int i = 0; i < 40; i++)
*(source + i) = rand() % 255;

uint8x8_t src0 = vld1_u8(source);
uint8x8_t src1 = vld1_u8(source + 8);
uint8x8_t src2 = vld1_u8(source + 16);
uint8x8_t src3 = vld1_u8(source + 24);

uint16x8_t dst0 = vmulq_n_u16(vmovl_u8(src0), 32 - a);
uint16x8_t dst1 = vmulq_n_u16(vmovl_u8(src1), b);
uint16x8_t dst2 = vmulq_n_u16(vmovl_u8(src2), 32 - c);
uint16x8_t dst3 = vmulq_n_u16(vmovl_u8(src3), d);
}

在 gcc 7.4.0 版本上编译时出错(命令使用 gcc -O3 main.c):

/tmp/ccAKq1je.s: Assembler messages:
/tmp/ccAKq1je.s:884: Error: register number out of range 0 to 15 at operand 3 -- `mla v1.8h,v23.8h,v24.h[0]`
/tmp/ccAKq1je.s:906: Error: register number out of range 0 to 15 at operand 3 -- `mla v0.8h,v22.8h,v23.h[0]'

我有类似的代码,不使用 vmovl_u8 指令并成功编​​译。使用 vmovl_u8 指令时出错。请帮我。

4

0 回答 0