[llvm] [FMV][GlobalOpt] Statically resolve calls to versioned functions. (PR #87939)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 12:43:01 PST 2025
labrinea wrote:
Update: @DavidSpickett has fixed the host info on the linaro-g4 builders and it is now correctly showing Neoverse-V2. From my end I tried the following test on Graviton4:
```
$ cat specres.c
#include <stdio.h>
__attribute__((target_version("predres"))) void f(void) { printf("Has FEAT_SPECRES\n"); }
__attribute__((target_version("default"))) void f(void) { printf("Does not have FEAT_SPECRES\n"); }
int main() {
f();
asm volatile (
"cfp rctx, x0" "\n"
"dvp rctx, x1" "\n"
"cpp rctx, x2" "\n"
);
return 0;
}
$ ./release/bin/clang --target=aarch64-linux-gnu -mcpu=neoverse-v2 specres.c -O0 -rtlib=compiler-rt
$ ./a.out
Does not have FEAT_SPECRES
Illegal instruction (core dumped)
```
The runtime detection suggests `predres` isn't available. I am now trying to understand whether this has to do with reading ID_AA64ISAR1_EL1 from EL0 and whether the CFP/DVP/CPP RCTX , Xt instructions are valid at EL0. ArmARM says yes, but
> In AArch64 state, EL0 access to the System instructions is controlled by:
• When HCR_EL2.{E2H, TGE} is not {1, 1}, SCTLR_EL1.EnRCTX.
• When HCR_EL2.{E2H, TGE} == {1, 1}, SCTLR_EL2.EnRCTX.
https://github.com/llvm/llvm-project/pull/87939
More information about the llvm-commits
mailing list