[kvm-unit-tests] arm64: Build failures in fpu.c test with clang

From: Raghavendra Rao Ananta
Date: Wed Oct 16 2024 - 16:10:24 EST


Hello,

Compiling the kvm-unit-tests for arm64 with clang gives the following error:

arm/fpu.c:235:3: error: unknown register name 'q0' in asm
fpu_reg_read(outdata);
^
arm/fpu.c:59:10: note: expanded from macro 'fpu_reg_read'
: "q0", "q1", "q2", "q3", \
^
arm/fpu.c:281:3: error: unknown register name 'q0' in asm
fpu_reg_write(*indata);
^
arm/fpu.c:92:10: note: expanded from macro 'fpu_reg_write'
: "q0", "q1", "q2", "q3", \
^
2 errors generated.

It's likely that clang doesn't have "q" registers in its dictionary,
so I tried replacing it with "v" registers, only in the clobbered
list. However, I think this granted clang to optimize the code in a
way that causes data abort at in fpu_reg_read() at the first
instruction:

stp q0, q1, [%0], #32\n\t"

Although removing the optimization flag, -O2, generates correct code
and the test passes.

Any suggestions on how to deal with this in a better way?

Thank you.
Raghavendra