Skip to content

Commit

Permalink
fixup! [builtins] Refactor cpu_model support to reduce #if nesting. NFCI
Browse files Browse the repository at this point in the history
  • Loading branch information
jroelofs committed Dec 19, 2023
1 parent 2fd4084 commit a5a17e8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions compiler-rt/lib/builtins/cpu_model/aarch64/fmv/android.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
if (__isExynos9810())
return;

unsgined long hwcap = getauxval(AT_HWCAP);
unsigned long hwcap2 = getauxval(AT_HWCAP2);

__ifunc_arg_t arg;
arg._size = sizeof(__ifunc_arg_t);
arg._hwcap = getauxval(AT_HWCAP);
arg._hwcap2 = getauxval(AT_HWCAP2);
arg._hwcap = hwcap;
arg._hwcap2 = hwcap2;
__init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
}
7 changes: 5 additions & 2 deletions compiler-rt/lib/builtins/cpu_model/aarch64/fmv/fuchsia.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
if (__aarch64_cpu_features.features)
return;

unsgined long hwcap = getauxval(AT_HWCAP);
unsigned long hwcap2 = getauxval(AT_HWCAP2);

__ifunc_arg_t arg;
arg._size = sizeof(__ifunc_arg_t);
arg._hwcap = getauxval(AT_HWCAP);
arg._hwcap2 = getauxval(AT_HWCAP2);
arg._hwcap = hwcap;
arg._hwcap2 = hwcap2;
__init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
}
8 changes: 6 additions & 2 deletions compiler-rt/lib/builtins/cpu_model/aarch64/fmv/sysauxv.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
// CPU features already initialized.
if (__aarch64_cpu_features.features)
return;

unsgined long hwcap = getauxval(AT_HWCAP);
unsigned long hwcap2 = getauxval(AT_HWCAP2);

__ifunc_arg_t arg;
arg._size = sizeof(__ifunc_arg_t);
arg._hwcap = getauxval(AT_HWCAP);
arg._hwcap2 = getauxval(AT_HWCAP2);
arg._hwcap = hwcap;
arg._hwcap2 = hwcap2;
__init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
}

0 comments on commit a5a17e8

Please sign in to comment.