0

I have the following armv8-a code and I am getting the assembler error. I am unable to figure out the error

#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;
}

Error while compiling on gcc 7.4.0 version (command used 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]'

I have similar code that doesn't use vmovl_u8 instruction and gets compiled succesfully. Getting error while using vmovl_u8 instruction. Please help me.

  • Are you trying to target the 32- or 64-bit instruction set? What does `gcc -v` say under `Target:`? – Nate Eldredge Nov 08 '20 at 16:51
  • This is most likely a compiler bug or setup problem, but your example may be complicating things - you read uninitialized variables, don't return a value from `main`, and your code has no effect. So it could all be optimized out or otherwise have undefined behavior. This doesn't really explain the assembler error but it could make it difficult to tell when you've fixed it. – Nate Eldredge Nov 08 '20 at 17:23
  • Target: aarch64-linux-gnu @NateEldredge – Mallikarjun Kamble Nov 09 '20 at 05:12
  • With gcc 9.3 I get a ton of warnings that `vld1_u8` expects a pointer. – Nate Eldredge Nov 09 '20 at 05:20
  • I have updated the code, initialized the variables and returning value from 'main' – Mallikarjun Kamble Nov 09 '20 at 05:21
  • You seem to have two copies of this question, with the other one [here](https://stackoverflow.com/questions/64736045/why-do-i-get-assembler-error-while-using-vmovl-u8-instruction). Perhaps it's a mistake, but please don't do that in the future. If a question is closed, edit it to fix the problems and other users can reopen it, but don't post a second copy; that's against site rules and can lead to account suspension. – Nate Eldredge Nov 09 '20 at 06:46

0 Answers0