我有以下 armv8-a 代码,但出现汇编错误。我无法找出错误
#include <stdio.h>
#include <arm_neon.h>
int main(char source)
{
char a = 10, b = 10, c = 10, d = 10;
uint16_t sum;
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);
dst0 = vaddq_u16(dst0, dst1);
dst2 = vaddq_u16(dst2, dst3);
dst0 = vaddq_u16(dst0, dst2);
sum = vaddvq_u16(dst0);
return sum;
}
在 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 指令时出错。请帮我。