This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

armclang:error: couldn't allocate output register for constraint 'w'

Hi,

     There is an inline assembler code, and compiled okay with arm-none-eabi-gcc,

but there is error when built with armclang.

     Here is the code:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//wrong-reg.c
#include <stdio.h>
#include <stdint.h>
#define __asm__ asm volatile
float __vabs(const float a) {
//VABS{cond}.F32 Sd, Sm
float result;
__asm volatile("vabs.f32 %0, %1" : "=w"(result) : "w"(a):);
return result;
}
int __vcvta_s32(float a) {
int result;
__asm volatile("vcvta.s32.f32 %0, %1" : "=w"(result) : "w"(a):);
return result;
}
int main(int argc, char *argv[])
{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

compiled with:

armclang --target=arm-arm-none-eabi -mcpu=cortex-m55 -O2 -g -c -mfpu=fp-armv8-fullfp16-sp-d16 wrong-regs.c -o wrong-regs.o

then it report:

wrong-regs.c:17:17: error: couldn't allocate output register for constraint 'w'
        __asm volatile("vcvta.s32.f32 %0, %1" : "=w"(result) : "w"(a):);

arm-none-eabi-gcc -mcpu=cortex-m55 -march=armv8.1-m.main+mve.fp+fp.dp -mfloat-abi=hard --specs=rdimon.specs -mfpu=auto -g -O2 wrong-regs.c -o wrong-regs-gcc

This command is okay.

Anyone has ideas?

PS,

armclang --version

Product: Arm Compiler for Embedded 6.17 Professional
Component: Arm Compiler for Embedded 6.17

arm-none-eabi-gcc --version

arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)

Br,

Yingchun

0