On 6/5/24 21:00, maobibo wrote:
No, because the ifdef checks that the *compiler* is prepared to use LASX/LSX
instructions itself without further checks. There's no point in qemu checking further.
By my understanding, currently compiler option is the same with all files, there is no
separate compiler option with single file or file function.
So if compiler is prepared to use LASX/LSX instructions itself, host hardware must support
LASX/LSX instructions, else there will be problem.
Correct.
My main concern is that there is one hw machine which supports LSX, but no LASX, no KVM
neither. QEMU binary maybe fails to run on such hw machine if it is compiled with LASX
option.
Yes, that would be a problem for packaging qemu for distribution.
An alternative is to write these functions in assembly. While it's worth prioritizing
implementation of __attribute__((target())) in the compilers, the very earliest that could
happen is gcc 15. Which is far away from being reliable for qemu. It would also allow
this optimization to happen with gcc 13, which doesn't support the builtins either.
I just sent a patch set along these lines.
r~